diff --git a/setup.py b/setup.py index 437dd15..af0fd8a 100755 --- a/setup.py +++ b/setup.py @@ -5,6 +5,7 @@ import os from setuptools import setup, find_packages from setuptools.command.sdist import sdist +from wheel.bdist_wheel import bdist_wheel class eo_sdist(sdist): @@ -22,6 +23,21 @@ class eo_sdist(sdist): os.remove('VERSION') +class eo_bdist_wheel(bdist_wheel): + def run(self): + print("creating VERSION file") + if os.path.exists('VERSION'): + os.remove('VERSION') + version = get_version() + version_file = open('VERSION', 'w') + version_file.write(version) + version_file.close() + super(eo_bdist_wheel, self).run() + print("removing VERSION file") + if os.path.exists('VERSION'): + os.remove('VERSION') + + def get_version(): '''Use the VERSION, if absent generates a version with git describe, if not tag exists, take 0.0- and add the length of the commit log. @@ -74,4 +90,7 @@ setup(name="django-gssapi", 'static/js/*.js', ], }, - cmdclass={'sdist': eo_sdist}) + cmdclass={ + 'sdist': eo_sdist, + 'bdist_wheel': eo_bdist_wheel, + })