This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
auquotidien/setup.py

69 lines
2.3 KiB
Python

#! /usr/bin/env python
import os
import subprocess
import distutils.core
from distutils.command.sdist import sdist
from quixote.ptl.qx_distutils import qx_build_py
VERSION = '1.12.14'
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','--match=v*'], stdout=subprocess.PIPE)
result = p.communicate()[0]
version = result.split()[0][1:]
version = version.replace('-','.')
return version
return VERSION
def data_tree(destdir, sourcedir):
extensions = ['.css', '.png', '.jpeg', '.jpg', '.xml', '.html', '.js', '.ezt', '.gif', '.otf']
r = []
for root, dirs, files in os.walk(sourcedir):
l = [os.path.join(root, x) for x in files if os.path.splitext(x)[1] in extensions]
r.append( (root.replace(sourcedir, destdir, 1), l) )
if 'CVS' in dirs:
dirs.remove('CVS')
if '.svn' in dirs:
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(),
maintainer = 'Frederic Peters',
maintainer_email = 'fpeters@entrouvert.com',
package_dir = { 'extra': 'extra' },
packages = ['extra', 'extra.modules', 'extra.modules.pyatom'],
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/') + \
data_tree('share/auquotidien/apache-errors', 'apache-errors') +\
data_tree('share/wcs/qommon/auquotidien', 'static') +\
[('share/wcs/', ['au-quotidien-wcs-settings.xml',])]
)