On Fri, Jun 20, 2014 at 09:17:48PM -0700, T.C. Hollingsworth wrote: > On Fri, Jun 20, 2014 at 8:00 PM, Jeff Peeler <jpeeler@xxxxxxxxxx> wrote: > > It would be great if there were a solution available in python, but I've not > > found anything in the TransactionSet API of value. Surely this must be possible > > as "fedpkg mockbuild" works as expected. > > This looks wrong but actually works just fine: > > In [1]: import rpm > > In [2]: rpm.spec('js-jquery.spec') > Out[2]: <rpm.spec at 0x7f223f00bb70> > > In [3]: rpm.expandMacro('%{shortcommit}') > Out[3]: '4dec426' > > (%{shortcommit} in this spec is used as explained in [1].) > > There ought to be a more OO-way but I couldn't find it poking around > when I needed this awhile ago. > > -T.C. > > [1] http://fedoraproject.org/wiki/Packaging:SourceURL#Github It sure does, thanks! Just in case it's useful, I'll include the snippet for the archives since my macro also uses a source file: #!/usr/bin/env python import rpm import os rpm.addMacro("_sourcedir", os.getcwd()) rpm.spec('openstack-heat.spec') print rpm.expandMacro('%{release_version}') -- packaging mailing list packaging@xxxxxxxxxxxxxxxxxxxxxxx https://admin.fedoraproject.org/mailman/listinfo/packaging