This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author techtonik
Recipients cdavid, eric.araujo, loewis, rogerbinns, tarek, techtonik, tim.golden
Date 2011-04-05.21:39:38
SpamBayes Score 8.801822e-08
Marked as misclassified No
Message-id <1302039580.52.0.258371864759.issue6040@psf.upfronthosting.co.za>
In-reply-to
Content
All right. The ultimate solution:

{{{
# Imports for converting version to MSI format for bdist_msi
from distutils.command.bdist_msi import bdist_msi
import inspect
import types
 
...

class bdist_msi_patch_version(bdist_msi):
    """ MSI builder requires version to be in the x.x.x format """
    def run(self):
        def monkey_get_version(self):
            """ monkey patch replacement for metadata.get_version() that
                returns MSI compatible version string for bdist_msi
            """
            # get filename of the calling function
            if inspect.stack()[1][1].endswith('bdist_msi.py'):
                # strip revision from version (if any), e.g. 11.0.0-r31546
                return self.version.split('-')[0]
            else:
                return self.version

        # monkeypatching get_version() call for DistributionMetadata
        self.distribution.metadata.get_version = \
            types.MethodType(monkey_get_version, self.distribution.metadata)
        bdist_msi.run(self)


...
setup(
    ...
    cmdclass={'bdist_msi': bdist_msi_version_hack},
)
}}}
History
Date User Action Args
2011-04-05 21:39:40techtoniksetrecipients: + techtonik, loewis, tim.golden, tarek, cdavid, eric.araujo, rogerbinns
2011-04-05 21:39:40techtoniksetmessageid: <1302039580.52.0.258371864759.issue6040@psf.upfronthosting.co.za>
2011-04-05 21:39:38techtoniklinkissue6040 messages
2011-04-05 21:39:38techtonikcreate