Skip to content

Commit 8bfc414

Browse files
committed
delete unused requirements parsing code in dist_utils.py
Please people. Do not do things on import! Plus, all the magic around parsing requirements was entirely unnecessary for this repo as there are NO reqs.
1 parent 36abbc1 commit 8bfc414

File tree

2 files changed

+2
-57
lines changed

2 files changed

+2
-57
lines changed

dist_utils.py

-53
Original file line numberDiff line numberDiff line change
@@ -21,66 +21,13 @@
2121

2222
from distutils.version import StrictVersion
2323

24-
GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python'
25-
26-
try:
27-
import pip
28-
from pip import __version__ as pip_version
29-
except ImportError as e:
30-
print('Failed to import pip: %s' % (str(e)))
31-
print('')
32-
print('Download pip:\n%s' % (GET_PIP))
33-
sys.exit(1)
34-
35-
try:
36-
# pip < 10.0
37-
from pip.req import parse_requirements
38-
except ImportError:
39-
# pip >= 10.0
40-
41-
try:
42-
from pip._internal.req.req_file import parse_requirements
43-
except ImportError as e:
44-
print('Failed to import parse_requirements from pip: %s' % (str(e)))
45-
print('Using pip: %s' % (str(pip_version)))
46-
sys.exit(1)
47-
4824
__all__ = [
49-
'check_pip_version',
50-
'fetch_requirements',
5125
'apply_vagrant_workaround',
5226
'get_version_string',
5327
'parse_version_string'
5428
]
5529

5630

57-
def check_pip_version(min_version='6.0.0'):
58-
"""
59-
Ensure that a minimum supported version of pip is installed.
60-
"""
61-
if StrictVersion(pip.__version__) < StrictVersion(min_version):
62-
print("Upgrade pip, your version '{0}' "
63-
"is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__,
64-
min_version,
65-
GET_PIP))
66-
sys.exit(1)
67-
68-
69-
def fetch_requirements(requirements_file_path):
70-
"""
71-
Return a list of requirements and links by parsing the provided requirements file.
72-
"""
73-
links = []
74-
reqs = []
75-
for req in parse_requirements(requirements_file_path, session=False):
76-
# Note: req.url was used before 9.0.0 and req.link is used in all the recent versions
77-
link = getattr(req, 'link', getattr(req, 'url', None))
78-
if link:
79-
links.append(str(link))
80-
reqs.append(str(req.req))
81-
return (reqs, links)
82-
83-
8431
def apply_vagrant_workaround():
8532
"""
8633
Function which detects if the script is being executed inside vagrant and if it is, it deletes

setup.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@
1717

1818
from setuptools import setup, find_packages
1919

20-
from dist_utils import fetch_requirements
2120
from dist_utils import parse_version_string
2221

2322
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
2423
REQUIREMENTS_FILE = os.path.join(BASE_DIR, "requirements.txt")
2524
INIT_FILE = os.path.join(BASE_DIR, "st2rbac_backend", "__init__.py")
2625

2726
version = parse_version_string(INIT_FILE)
28-
install_reqs, dep_links = fetch_requirements(REQUIREMENTS_FILE)
2927

3028
setup(
3129
name="st2-rbac-backend",
@@ -50,8 +48,8 @@
5048
provides=["st2rbac_backend"],
5149
packages=find_packages(),
5250
include_package_data=True,
53-
install_requires=install_reqs,
54-
dependency_links=dep_links,
51+
install_requires=[],
52+
dependency_links=[],
5553
test_suite="tests",
5654
entry_points={
5755
"st2common.rbac.backend": [

0 commit comments

Comments
 (0)