From c9b46630335cceab8c87d2c5be318c5c484ac6cc Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Fri, 29 May 2015 10:52:03 +0200 Subject: [PATCH] setup.py,MANIFEST.in: include the VERSION file in distribution --- MANIFEST.in | 1 + setup.py | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index c90b2c9..41f8bd9 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,4 @@ recursive-include mellon/templates *.html *.xml recursive-include mellon/locale *.po *.mo include MANIFEST.in +include VERSION diff --git a/setup.py b/setup.py index 45e8b0e..2958cde 100755 --- a/setup.py +++ b/setup.py @@ -35,8 +35,21 @@ class compile_translations(Command): class build(_build): sub_commands = [('compile_translations', None)] + _build.sub_commands -class sdist(_sdist): - sub_commands = [('compile_translations', None)] + _sdist.sub_commands +class eo_sdist(_sdist): + sub_commands = [('compile_translations', None)] + _build.sub_commands + + 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() + _sdist.run(self) + print "removing VERSION file" + if os.path.exists('VERSION'): + os.remove('VERSION') class install_lib(_install_lib): def run(self): @@ -87,6 +100,6 @@ setup(name="django-mellon", 'build': build, 'install_lib': install_lib, 'compile_translations': compile_translations, - 'sdist': sdist, + 'sdist': eo_sdist, }, )