src/setup.py
changeset 0 3820e8d1316d
child 1 35eb0cbadae0
equal deleted inserted replaced
-1:000000000000 0:3820e8d1316d
       
     1 import os
       
     2 import re
       
     3 import ast
       
     4 from distutils.core import setup
       
     5 
       
     6 here = os.path.dirname(os.path.abspath(__file__))
       
     7 
       
     8 def get_version():
       
     9     f = open(os.path.join(here, 'fablib','__init__.py'))
       
    10     version_file = f.read()
       
    11     f.close()
       
    12     version_match = re.search(r"^VERSION\s*=\s*(\([^\)]*\))",
       
    13                               version_file, re.M)
       
    14     if version_match:
       
    15             VERSION = ast.literal_eval(version_match.group(1))
       
    16              
       
    17             version = '%s.%s' % (VERSION[0], VERSION[1])
       
    18             if VERSION[2]:
       
    19                 version = '%s.%s' % (version, VERSION[2])
       
    20             if VERSION[3:] == ('alpha', 0):
       
    21                 version = '%s.pre-alpha' % version
       
    22             elif VERSION[3] != 'final':
       
    23                 version = '%s.%s.%s' % (version, VERSION[3], VERSION[4])
       
    24             return version
       
    25 
       
    26         
       
    27     raise RuntimeError("Unable to find version string.")
       
    28 
       
    29 setup(
       
    30     name='fablib',
       
    31     version=get_version(),
       
    32     description='IRI fablib',
       
    33     author='IRI',
       
    34     author_email='dev@iri.centrepompidou.fr',
       
    35     url='http://www.iri.centrepompidou.fr',
       
    36     packages=['fablib'],
       
    37     data_files=[('','README.rst')]
       
    38 )