-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
70 lines (53 loc) · 1.99 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# This file was auto-generated by zetup
#
# https://bitbucket.org/userzimmermann/zetup.py
from __future__ import print_function
import sys
import os
import re
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
SETUP_REQUIRES = [
'zetup >= 0.2.27',
] + (os.path.exists('requirements.setup.txt')
and [line for line in map(str.strip, open('requirements.setup.txt'))
if line and not line.startswith('#')]
or []) + [
]
try:
from setuptools.dist import Distribution
from pkg_resources import get_distribution, working_set, \
DistributionNotFound, VersionConflict
except ImportError: # no setuptools
pass
else:
# make sure that setup requirements
# are always correctly resolved and accessible by:
# - pre-processing them one after another
# - recursively resolving their runtime requirements
# - moving any installed eggs to the front of sys.path
# - updating pkg_resources.working_set accordingly
installer = Distribution().fetch_build_egg
def resolve(requirements, parent=None):
for req in requirements:
qualreq = parent and '%s->%s' % (req, parent) or req
print("Resolving setup requirement %s:" % qualreq)
try:
dist = get_distribution(req)
print(repr(dist))
except (DistributionNotFound, VersionConflict):
dist = installer(req)
sys.path.insert(0, dist.location)
working_set.entries.insert(0, dist.location)
working_set.by_key[dist.key] = dist
extras = re.match(r'[^#\[]*\[([^#\]]*)\]', req)
if extras:
extras = list(map(str.strip, extras.group(1).split(',')))
resolve(map(str, dist.requires(extras=extras or ())), qualreq)
resolve(SETUP_REQUIRES)
dist = setup(
setup_requires=SETUP_REQUIRES,
use_zetup=True,
)