setup.py sdist: store version into the archive
This commit is contained in:
parent
113ccfb3d9
commit
2892964c46
|
@ -1,5 +1,6 @@
|
|||
include au-quotidien-wcs-settings.xml
|
||||
include wcs-au-quotidien.cfg-sample
|
||||
include VERSION
|
||||
include po/Makefile
|
||||
include po/*.po
|
||||
include po/*.pot
|
||||
|
|
28
setup.py
28
setup.py
|
@ -4,16 +4,22 @@ import os
|
|||
import subprocess
|
||||
import distutils.core
|
||||
|
||||
from distutils.command.sdist import sdist
|
||||
from quixote.ptl.qx_distutils import qx_build_py
|
||||
|
||||
__version__ = '1.9'
|
||||
VERSION = '1.9'
|
||||
|
||||
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','--long'], stdout=subprocess.PIPE)
|
||||
result = p.communicate()[0]
|
||||
return result.split()[0].replace('-','.')
|
||||
return __version__
|
||||
return VERSION
|
||||
|
||||
def data_tree(destdir, sourcedir):
|
||||
extensions = ['.css', '.png', '.jpeg', '.jpg', '.xml', '.html', '.js', '.ezt', '.gif']
|
||||
|
@ -27,6 +33,21 @@ def data_tree(destdir, sourcedir):
|
|||
dirs.remove('.svn')
|
||||
return r
|
||||
|
||||
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')
|
||||
|
||||
distutils.core.setup(
|
||||
name = 'wcs-au-quotidien',
|
||||
version = get_version(),
|
||||
|
@ -34,7 +55,8 @@ distutils.core.setup(
|
|||
maintainer_email = 'fpeters@entrouvert.com',
|
||||
package_dir = { 'extra': 'extra' },
|
||||
packages = ['extra', 'extra.modules', 'extra.modules.pyatom'],
|
||||
cmdclass = {'build_py': qx_build_py},
|
||||
cmdclass = {'build_py': qx_build_py,
|
||||
'sdist': eo_sdist},
|
||||
data_files = data_tree('share/wcs/texts', 'texts') +\
|
||||
data_tree('share/wcs/themes/auquotidien', 'theme') +\
|
||||
data_tree('share/wcs/themes/', 'data/themes/') + \
|
||||
|
|
Reference in New Issue