Skip to content

Commit

Permalink
Attempt to fix "No module named 'pip.req'" (added backward compatibil…
Browse files Browse the repository at this point in the history
…ity).
  • Loading branch information
jose committed Feb 17, 2021
1 parent 2edd2e2 commit 233964d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,22 @@


from setuptools import setup, find_packages
from pip.req import parse_requirements
try: # for pip >= 10
from pip._internal.req import parse_requirements
except ImportError: # for pip <= 9.0.3
from pip.req import parse_requirements
import os

dir = os.path.dirname(os.path.abspath(__file__))
version = {}
with open(os.path.join(dir, "schwa", "version.py")) as fp:
exec(fp.read(), version)

requirements = [str(ir.req) for ir in parse_requirements("requirements.txt", session=True)]
install_reqs = parse_requirements("requirements.txt", session=False)
try:
requirements = [str(ir.req) for ir in install_reqs]
except:
requirements = [str(ir.requirement) for ir in install_reqs]
packages = find_packages('.')

setup(name='Schwa',
Expand Down

0 comments on commit 233964d

Please sign in to comment.