#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2005-2010 Lele Gaifax # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://trac.edgewall.com/license.html. # # This software consists of voluntary contributions made by many # individuals. For the exact contribution history, see the revision # history and logs, available at http://projects.edgewall.com/trac/. # # Author: Lele Gaifax import re, sys from os.path import join, dirname from setuptools import setup initpy = open(join(dirname(__file__), 'tracdarcs', '__init__.py')).read() try: VERSION = re.compile(r".*__version__ = '(.*?)'", re.S).match(initpy).group(1) except: print "Cannot recognize a valid version in tracdarcs/__init__.py!" sys.exit(1) setup_requires=[] # darcsver is needed only if you want "./setup.py darcsver" to write a new # version stamp in tracdarcs/_version.py, with a version number derived from # darcs history. http://pypi.python.org/pypi/darcsver if "darcsver" in sys.argv[1:]: setup_requires.append('darcsver >= 1.0.0') VERSIONFILE = join(dirname(__file__), 'tracdarcs', '_version.py') verstr = VERSION try: verstrline = open(VERSIONFILE, "rt").read() except EnvironmentError: pass # Okay, there is no version file. else: VSRE = r"^verstr = ['\"]([^'\"]*)['\"]" mo = re.search(VSRE, verstrline, re.M) if mo: verstr = mo.group(1) else: print "unable to find version in %s" % (VERSIONFILE,) raise RuntimeError("if %s.py exists, it is required to be well-formed" % (VERSIONFILE,)) setup(name='TracDarcs', description='Darcs plugin for Trac', keywords='trac scm plugin darcs', version=verstr, setup_requires=setup_requires, url='http://darcs.arstecnica.it/trac-darcs', license='http://trac.edgewall.com/license.html', author='Lele Gaifax', author_email='lele@metapensiero.it', long_description=open('README.rst').read(), packages=['tracdarcs'], entry_points={'trac.plugins': 'darcs = tracdarcs'}, zip_safe=False )