|
7 | 7 | from os.path import abspath, dirname, exists, join |
8 | 8 | from setuptools import find_packages, setup |
9 | 9 |
|
10 | | -try: |
11 | | - # pip >=20 |
12 | | - from pip._internal.network.session import PipSession |
13 | | - from pip._internal.req import parse_requirements |
14 | | -except ImportError: |
15 | | - try: |
16 | | - # 10.0.0 <= pip <= 19.3.1 |
17 | | - from pip._internal.download import PipSession |
18 | | - from pip._internal.req import parse_requirements |
19 | | - except ImportError: |
20 | | - # pip <= 9.0.3 |
21 | | - from pip.download import PipSession |
22 | | - from pip.req import parse_requirements |
| 10 | +import pathlib |
| 11 | +import pkg_resources |
23 | 12 |
|
24 | 13 | # noinspection PyTypeChecker |
25 | | -install_reqs = parse_requirements( |
26 | | - join( |
27 | | - dirname(abspath(__file__)), |
28 | | - 'requirements', |
29 | | - 'sdk.txt', |
30 | | - ), session='None') |
| 14 | +with pathlib.Path('requirements/sdk.txt').open() as requirements_txt: |
| 15 | + install_reqs = [ |
| 16 | + str(requirement) |
| 17 | + for requirement |
| 18 | + in pkg_resources.parse_requirements(requirements_txt) |
| 19 | + ] |
31 | 20 |
|
32 | 21 | PACKAGES = find_packages(exclude=['tests*']) |
33 | 22 |
|
|
47 | 36 | url='https://github.com/ingrammicro/connect-python-sdk', |
48 | 37 | license='Apache Software License', |
49 | 38 | include_package_data=True, |
50 | | - install_requires=[str(ir.req) for ir in install_reqs], |
| 39 | + install_requires=install_reqs, |
51 | 40 |
|
52 | 41 | classifiers=[ |
53 | 42 | 'Development Status :: 5 - Production/Stable', |
|
0 commit comments