setup.py sdist: store version into the archive
This commit is contained in:
parent
24f717a0c1
commit
3b5aa541c5
|
@ -6,3 +6,6 @@ recursive-include passerelle/register/templates *.html
|
|||
recursive-include passerelle/static *
|
||||
recursive-include passerelle/apps/makorepost/templates.mako *.mako
|
||||
recursive-include passerelle/apps/solis/templates.mako *.mako
|
||||
|
||||
include LICENSE
|
||||
include VERSION
|
||||
|
|
27
setup.py
27
setup.py
|
@ -1,17 +1,41 @@
|
|||
#!/usr/bin/python
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
from distutils.command.sdist import sdist
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
VERSION='0.1'
|
||||
|
||||
def get_version():
|
||||
if os.path.exists('VERSION'):
|
||||
version_file = open('VERSION', 'r')
|
||||
version = version_file.read()
|
||||
version_file.close()
|
||||
return version
|
||||
if os.path.exists('.git'):
|
||||
p = subprocess.Popen(['git','describe','--dirty'], stdout=subprocess.PIPE)
|
||||
result = p.communicate()[0]
|
||||
return result.split()[0].replace('-','.')
|
||||
return VERSION
|
||||
|
||||
|
||||
class eo_sdist(sdist):
|
||||
|
||||
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')
|
||||
|
||||
setup(name='passerelle',
|
||||
version=get_version(),
|
||||
license='AGPLv3',
|
||||
|
@ -31,4 +55,5 @@ setup(name='passerelle',
|
|||
dependency_links = [
|
||||
'http://pypi.python.org/packages/source/d/django-jsonresponse/django-jsonresponse-0.5.tar.gz',
|
||||
],
|
||||
cmdclass={'sdist': eo_sdist},
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue