Skip to content
This repository was archived by the owner on Oct 15, 2021. It is now read-only.

Commit 53b7253

Browse files
authored
adapt setup.py to pip 20 (#88)
1 parent fc7c083 commit 53b7253

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

python/setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[metadata]
2-
version = 1.0.2
2+
version = 1.0.3
33
name = rockets
44
summary = Rockets python client
55
url = https://github.com/BlueBrain/Rockets

python/setup.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
# Copyright (c) 2018, Blue Brain Project
55
# Daniel Nachbaur <[email protected]>
6+
# Pawel Podhajski <[email protected]>
67
#
78
# This file is part of Rockets <https://github.com/BlueBrain/Rockets>
89
#
@@ -23,25 +24,20 @@
2324
"""setup.py"""
2425
import os
2526
from setuptools import setup
26-
27-
try: # for pip >= 10
28-
from pip._internal.req import parse_requirements
29-
from pip._internal.download import PipSession
30-
except ImportError: # for pip <= 9.0.3
31-
from pip.req import parse_requirements
32-
from pip.download import PipSession
33-
from optparse import Option
27+
import pathlib
28+
import pkg_resources
3429

3530
BASEDIR = os.path.dirname(os.path.abspath(__file__))
3631

3732

3833
def parse_reqs(reqs_file):
3934
''' parse the requirements '''
40-
options = Option("--workaround")
41-
options.skip_requirements_regex = None
42-
options.isolated_mode = True
43-
install_reqs = parse_requirements(reqs_file, options=options, session=PipSession())
44-
return [str(ir.req) for ir in install_reqs]
35+
install_reqs = list()
36+
with pathlib.Path(reqs_file).open() as requirements_txt:
37+
install_reqs = [str(requirement)
38+
for requirement
39+
in pkg_resources.parse_requirements(requirements_txt)]
40+
return install_reqs
4541

4642

4743
REQS = parse_reqs(os.path.join(BASEDIR, "requirements.txt"))

0 commit comments

Comments
 (0)