setup.py
changeset 2020 143c8e4dc22d
parent 1808 202ac6c94b7f
parent 2016 192c9f92148d
child 2036 2d9e7b936ee1
equal deleted inserted replaced
2019:996a562b6c9f 2020:143c8e4dc22d
       
     1 import os
     1 from distutils.core import setup
     2 from distutils.core import setup
       
     3 from os.path import dirname, join
       
     4 
       
     5 def get_version(relpath):
       
     6     '''Read version info from a file without importing it'''
       
     7     for line in open(join(dirname(__file__), relpath), 'rb'):
       
     8         # Decode to a fail-safe string for PY3
       
     9         # (gives unicode object in PY2)
       
    10         line = line.decode('utf8')
       
    11         if '__version__' in line:
       
    12           if "'" in line:
       
    13             return line.split("'")[1]
       
    14 
       
    15 def min_hg_version(relpath):
       
    16     '''Read version info from a file without importing it'''
       
    17     for line in open(join(dirname(__file__), relpath), 'rb'):
       
    18         # Decode to a fail-safe string for PY3
       
    19         # (gives unicode object in PY2)
       
    20         line = line.decode('utf8')
       
    21         if 'testedwith' in line:
       
    22           if "'" in line:
       
    23             return min(line.split("'")[1].split())
       
    24 
       
    25 py_modules = [
       
    26     'hgext3rd.evolve.serveronly',
       
    27 ]
       
    28 py_packages = [
       
    29     'hgext3rd',
       
    30     'hgext3rd.topic',
       
    31 ]
       
    32 
       
    33 if os.environ.get('INCLUDE_INHIBIT'):
       
    34     py_modules.append('hgext3rd.evolve.hack.inhibit')
       
    35     py_modules.append('hgext3rd.evolve.hack.directaccess')
       
    36 
       
    37 
       
    38 EVOLVE_PATH = 'hgext3rd/evolve/__init__.py'
     2 
    39 
     3 requires = []
    40 requires = []
     4 try:
    41 try:
     5     import mercurial
    42     import mercurial
     6     mercurial.__all__
    43     mercurial.__all__
     7 except ImportError:
    44 except ImportError:
     8     requires.append('mercurial')
    45     requires.append('mercurial>=%s' % min_hg_version(EVOLVE_PATH))
     9 
    46 
    10 setup(
    47 setup(
    11     name='hg-topics',
    48     name='hg-evolve',
    12     version='1.0.0',
    49     version=get_version(EVOLVE_PATH),
    13     author='Augie Fackler',
    50     author='Pierre-Yves David',
    14     maintainer='Augie Fackler',
    51     maintainer='Pierre-Yves David',
    15     maintainer_email='augie@google.com',
    52     maintainer_email='pierre-yves.david@ens-lyon.org',
    16     url='http://bitbucket.org/durin42/hg-topics/',
    53     url='https://www.mercurial-scm.org/doc/evolution/',
    17     description=('Experimental tinkering with workflow ideas '
    54     description='Flexible evolution of Mercurial history.',
    18                  'for topic branches.'),
    55     long_description=open('README').read(),
    19     long_description=open('README.md').read(),
       
    20     keywords='hg mercurial',
    56     keywords='hg mercurial',
    21     license='GPLv2+',
    57     license='GPLv2+',
    22     packages=['hgext3rd'],
    58     py_modules=py_modules,
    23     install_requires=requires,
    59     packages=py_packages
    24 )
    60 )