annotate setup.py @ 2046:994d81caec68

test: update test to check for various way to import the serveronly things We add a "setup script" that update the PYTHONPATH to allow direct import of the extension code. Then we tests that all way to import the extensions works.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Tue, 07 Mar 2017 12:10:05 +0100
parents 2d9e7b936ee1
children b81d3775006b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1242
cf846d47bb7e setup: allow including inhibit in the build
Durham Goode <durham@fb.com>
parents: 1149
diff changeset
1 import os
1839
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
2 from distutils.core import setup
1149
a206ee74f129 evolve: add various version info to save time on troubleshooting
anatoly techtonik <techtonik@gmail.com>
parents: 1138
diff changeset
3 from os.path import dirname, join
a206ee74f129 evolve: add various version info to save time on troubleshooting
anatoly techtonik <techtonik@gmail.com>
parents: 1138
diff changeset
4
a206ee74f129 evolve: add various version info to save time on troubleshooting
anatoly techtonik <techtonik@gmail.com>
parents: 1138
diff changeset
5 def get_version(relpath):
a206ee74f129 evolve: add various version info to save time on troubleshooting
anatoly techtonik <techtonik@gmail.com>
parents: 1138
diff changeset
6 '''Read version info from a file without importing it'''
a206ee74f129 evolve: add various version info to save time on troubleshooting
anatoly techtonik <techtonik@gmail.com>
parents: 1138
diff changeset
7 for line in open(join(dirname(__file__), relpath), 'rb'):
a206ee74f129 evolve: add various version info to save time on troubleshooting
anatoly techtonik <techtonik@gmail.com>
parents: 1138
diff changeset
8 # Decode to a fail-safe string for PY3
a206ee74f129 evolve: add various version info to save time on troubleshooting
anatoly techtonik <techtonik@gmail.com>
parents: 1138
diff changeset
9 # (gives unicode object in PY2)
a206ee74f129 evolve: add various version info to save time on troubleshooting
anatoly techtonik <techtonik@gmail.com>
parents: 1138
diff changeset
10 line = line.decode('utf8')
a206ee74f129 evolve: add various version info to save time on troubleshooting
anatoly techtonik <techtonik@gmail.com>
parents: 1138
diff changeset
11 if '__version__' in line:
2036
2d9e7b936ee1 flake8: fix error in 'setup.py'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2020
diff changeset
12 if "'" in line:
2d9e7b936ee1 flake8: fix error in 'setup.py'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2020
diff changeset
13 return line.split("'")[1]
496
d3d9df795b4d [pkg] Add a setup.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
14
2020
143c8e4dc22d topic: merge the topic extension in the evolve repository
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1808 2016
diff changeset
15 def min_hg_version(relpath):
143c8e4dc22d topic: merge the topic extension in the evolve repository
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1808 2016
diff changeset
16 '''Read version info from a file without importing it'''
143c8e4dc22d topic: merge the topic extension in the evolve repository
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1808 2016
diff changeset
17 for line in open(join(dirname(__file__), relpath), 'rb'):
143c8e4dc22d topic: merge the topic extension in the evolve repository
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1808 2016
diff changeset
18 # Decode to a fail-safe string for PY3
143c8e4dc22d topic: merge the topic extension in the evolve repository
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1808 2016
diff changeset
19 # (gives unicode object in PY2)
143c8e4dc22d topic: merge the topic extension in the evolve repository
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1808 2016
diff changeset
20 line = line.decode('utf8')
143c8e4dc22d topic: merge the topic extension in the evolve repository
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1808 2016
diff changeset
21 if 'testedwith' in line:
2036
2d9e7b936ee1 flake8: fix error in 'setup.py'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2020
diff changeset
22 if "'" in line:
2d9e7b936ee1 flake8: fix error in 'setup.py'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2020
diff changeset
23 return min(line.split("'")[1].split())
2020
143c8e4dc22d topic: merge the topic extension in the evolve repository
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1808 2016
diff changeset
24
1808
202ac6c94b7f hgext3rd: move 'simple4server' as 'evolve.serveronly'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1807
diff changeset
25 py_modules = [
2020
143c8e4dc22d topic: merge the topic extension in the evolve repository
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1808 2016
diff changeset
26 'hgext3rd.evolve.serveronly',
1808
202ac6c94b7f hgext3rd: move 'simple4server' as 'evolve.serveronly'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1807
diff changeset
27 ]
1806
9f42f819267b evolve: move the extensions to 'hgext3rd'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1642
diff changeset
28 py_packages = [
9f42f819267b evolve: move the extensions to 'hgext3rd'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1642
diff changeset
29 'hgext3rd',
2020
143c8e4dc22d topic: merge the topic extension in the evolve repository
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1808 2016
diff changeset
30 'hgext3rd.topic',
1242
cf846d47bb7e setup: allow including inhibit in the build
Durham Goode <durham@fb.com>
parents: 1149
diff changeset
31 ]
cf846d47bb7e setup: allow including inhibit in the build
Durham Goode <durham@fb.com>
parents: 1149
diff changeset
32
1452
1bcbd14cf159 merge back with 3.3 compat branch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1451
diff changeset
33 if os.environ.get('INCLUDE_INHIBIT'):
1807
a53efee7d8b0 hgext3rd: move 'directaccess' and 'inhibit' in 'evolve.hack'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1806
diff changeset
34 py_modules.append('hgext3rd.evolve.hack.inhibit')
a53efee7d8b0 hgext3rd: move 'directaccess' and 'inhibit' in 'evolve.hack'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1806
diff changeset
35 py_modules.append('hgext3rd.evolve.hack.directaccess')
1452
1bcbd14cf159 merge back with 3.3 compat branch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1451
diff changeset
36
2020
143c8e4dc22d topic: merge the topic extension in the evolve repository
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1808 2016
diff changeset
37
143c8e4dc22d topic: merge the topic extension in the evolve repository
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1808 2016
diff changeset
38 EVOLVE_PATH = 'hgext3rd/evolve/__init__.py'
1839
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
39
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
40 requires = []
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
41 try:
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
42 import mercurial
1929
99f983e8e18f setup: make sure we use the imported module
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1919
diff changeset
43 mercurial.__all__
1839
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
44 except ImportError:
2020
143c8e4dc22d topic: merge the topic extension in the evolve repository
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1808 2016
diff changeset
45 requires.append('mercurial>=%s' % min_hg_version(EVOLVE_PATH))
1839
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
46
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
47 setup(
496
d3d9df795b4d [pkg] Add a setup.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
48 name='hg-evolve',
2020
143c8e4dc22d topic: merge the topic extension in the evolve repository
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1808 2016
diff changeset
49 version=get_version(EVOLVE_PATH),
496
d3d9df795b4d [pkg] Add a setup.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
50 author='Pierre-Yves David',
d3d9df795b4d [pkg] Add a setup.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
51 maintainer='Pierre-Yves David',
916
48e68d3b0144 fix maintainer email
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 859
diff changeset
52 maintainer_email='pierre-yves.david@ens-lyon.org',
1642
fb5e479080d8 project: change evolution domain to mercurial-scm
timeless@gmail.com
parents: 1617
diff changeset
53 url='https://www.mercurial-scm.org/doc/evolution/',
496
d3d9df795b4d [pkg] Add a setup.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
54 description='Flexible evolution of Mercurial history.',
d3d9df795b4d [pkg] Add a setup.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
55 long_description=open('README').read(),
1839
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
56 keywords='hg mercurial',
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
57 license='GPLv2+',
1806
9f42f819267b evolve: move the extensions to 'hgext3rd'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1642
diff changeset
58 py_modules=py_modules,
9f42f819267b evolve: move the extensions to 'hgext3rd'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1642
diff changeset
59 packages=py_packages
1839
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
60 )