Skip to content

Instantly share code, notes, and snippets.

@junaruga
Created August 24, 2017 11:09
Show Gist options
  • Select an option

  • Save junaruga/a27c875f7b1a7872b861b9db63f4ebb2 to your computer and use it in GitHub Desktop.

Select an option

Save junaruga/a27c875f7b1a7872b861b9db63f4ebb2 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
import rpm
if __name__ == "__main__":
if len(sys.argv) < 3:
print("Usage: %s <specfile> <macro>" % sys.argv[0])
sys.exit(1)
spec = sys.argv[1]
macro = sys.argv[2]
ts = rpm.ts()
spec = ts.parseSpec(spec)
print(rpm.expandMacro(macro))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment