src/setup.py
author ymh <ymh.work@gmail.com>
Fri, 22 Feb 2013 18:01:04 +0100
changeset 7 18d9ac498468
parent 1 35eb0cbadae0
permissions -rw-r--r--
correct setup

import os
import re
import ast
from distutils.core import setup

here = os.path.dirname(os.path.abspath(__file__))

def get_version():
    f = open(os.path.join(here, 'fablib','__init__.py'))
    version_file = f.read()
    f.close()
    version_match = re.search(r"^VERSION\s*=\s*(\([^\)]*\))",
                              version_file, re.M)
    if version_match:
            VERSION = ast.literal_eval(version_match.group(1))
             
            version = '%s.%s' % (VERSION[0], VERSION[1])
            if VERSION[2]:
                version = '%s.%s' % (version, VERSION[2])
            if VERSION[3:] == ('alpha', 0):
                version = '%s.pre-alpha' % version
            elif VERSION[3] != 'final':
                version = '%s.%s.%s' % (version, VERSION[3], VERSION[4])
            return version

        
    raise RuntimeError("Unable to find version string.")

setup(
    name='fablib',
    version=get_version(),
    description='IRI fablib',
    author='IRI',
    author_email='dev@iri.centrepompidou.fr',
    url='http://www.iri.centrepompidou.fr',
    packages=['fablib'],
    requires=["fabric(>1.5)", "mercurial(>=2.5)"]
)