Show More
@@ -1,4 +1,5 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | ||
|
2 | 3 | # RhodeCode VCSServer provides access to different vcs backends via network. |
|
3 | 4 | # Copyright (C) 2014-2019 RodeCode GmbH |
|
4 | 5 | # |
@@ -20,22 +21,48 b'' | |||
|
20 | 21 | from setuptools import setup, find_packages |
|
21 | 22 | |
|
22 | 23 | import os |
|
24 | import re | |
|
23 | 25 | import sys |
|
24 | 26 | import pkgutil |
|
25 | 27 | import platform |
|
26 | 28 | import codecs |
|
27 | 29 | |
|
28 | try: # for pip >= 10 | |
|
30 | import pip | |
|
31 | ||
|
32 | pip_major_version = int(pip.__version__.split(".")[0]) | |
|
33 | if pip_major_version >= 20: | |
|
29 | 34 | from pip._internal.req import parse_requirements |
|
30 | except ImportError: # for pip <= 9.0.3 | |
|
35 | from pip._internal.network.session import PipSession | |
|
36 | elif pip_major_version >= 10: | |
|
37 | from pip._internal.req import parse_requirements | |
|
38 | from pip._internal.download import PipSession | |
|
39 | else: | |
|
31 | 40 | from pip.req import parse_requirements |
|
32 | ||
|
33 | try: # for pip >= 10 | |
|
34 | from pip._internal.download import PipSession | |
|
35 | except ImportError: # for pip <= 9.0.3 | |
|
36 | 41 | from pip.download import PipSession |
|
37 | 42 | |
|
38 | 43 | |
|
44 | def get_package_name(req_object): | |
|
45 | package_name = None | |
|
46 | try: | |
|
47 | from pip._internal.req.constructors import install_req_from_parsed_requirement | |
|
48 | except ImportError: | |
|
49 | install_req_from_parsed_requirement = None | |
|
50 | ||
|
51 | # In 20.1 of pip, the requirements object changed | |
|
52 | if hasattr(req_object, 'req'): | |
|
53 | package_name = req_object.req.name | |
|
54 | ||
|
55 | if package_name is None: | |
|
56 | if install_req_from_parsed_requirement: | |
|
57 | package = install_req_from_parsed_requirement(req_object) | |
|
58 | package_name = package.req.name | |
|
59 | ||
|
60 | if package_name is None: | |
|
61 | # fallback for older pip | |
|
62 | package_name = re.split('===|<=|!=|==|>=|~=|<|>', req_object.requirement)[0] | |
|
63 | ||
|
64 | return package_name | |
|
65 | ||
|
39 | 66 | |
|
40 | 67 | if sys.version_info < (2, 7): |
|
41 | 68 | raise Exception('VCSServer requires Python 2.7 or later') |
@@ -62,14 +89,15 b' def _get_requirements(req_filename, excl' | |||
|
62 | 89 | parsed = parse_requirements(os.path.join(here, req_filename)) |
|
63 | 90 | |
|
64 | 91 | requirements = [] |
|
65 | for ir in parsed: | |
|
66 | if ir.req and ir.name not in exclude: | |
|
67 | requirements.append(str(ir.req)) | |
|
92 | for int_req in parsed: | |
|
93 | req_name = get_package_name(int_req) | |
|
94 | if req_name not in exclude: | |
|
95 | requirements.append(req_name) | |
|
68 | 96 | return requirements + extras |
|
69 | 97 | |
|
70 | 98 | |
|
71 | 99 | # requirements extract |
|
72 |
setup_requirements = [ |
|
|
100 | setup_requirements = [] | |
|
73 | 101 | install_requirements = _get_requirements( |
|
74 | 102 | 'requirements.txt', exclude=['setuptools']) |
|
75 | 103 | test_requirements = _get_requirements( |
@@ -113,7 +141,7 b' setup(' | |||
|
113 | 141 | keywords=keywords, |
|
114 | 142 | license=__license__, |
|
115 | 143 | author=__author__, |
|
116 |
author_email=' |
|
|
144 | author_email='support@rhodecode.com', | |
|
117 | 145 | url=__url__, |
|
118 | 146 | setup_requires=setup_requirements, |
|
119 | 147 | install_requires=install_requirements, |
General Comments 0
You need to be logged in to leave comments.
Login now