Skip to content

Commit ba26e39

Browse files
committedJan 24, 2024
pip 23 finally broke my use of pip internal functions to parse requirements because it appears to 'sandbox' the setup() function. So I'm changing to a more naive approach.
1 parent e466c20 commit ba26e39

File tree

3 files changed

+6
-21
lines changed

3 files changed

+6
-21
lines changed
 

‎.ci/concourse/test_pipeline.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ jobs:
3131
params:
3232
state: pending
3333
commit: authserver
34+
- task: setup-env
35+
file: authserver/.ci/concourse/mypy-env.yaml
3436
- task: run-mypy
3537
file: authserver/.ci/concourse/mypy.yaml
3638
on_failure:

‎authserver/mailauth/patches/auth.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313

1414
def mauth_identify_hasher(encoded: str) -> 'hashers.BasePasswordHasher':
1515
from mailauth.auth import UnixCryptCompatibleSHA256Hasher
16-
from django.contrib.auth import hashers
1716
_log.debug("mauth_identify_hasher called (%s)", encoded)
18-
if encoded.startswith("$5"):
17+
if orig_identify_hasher is None or encoded.startswith("$5"):
1918
return UnixCryptCompatibleSHA256Hasher()
2019
return orig_identify_hasher(encoded)
2120

‎setup.py

+3-19
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,7 @@
77
from setuptools import setup, find_packages
88

99

10-
try:
11-
from pip._internal.req import parse_requirements
12-
except ImportError:
13-
from pip.req import parse_requirements
14-
15-
try:
16-
from pip._internal.download import PipSession
17-
except ImportError:
18-
try:
19-
from pip.download import PipSession
20-
except ImportError:
21-
from pip._internal.network.session import PipSession
22-
23-
24-
_INCLUDE = re.compile("\.(txt|gif|jpg|png|css|html|js|xml|po|mo)$")
10+
_INCLUDE = re.compile(r"\.(txt|gif|jpg|png|css|html|js|xml|po|mo)$")
2511
_HERE = os.path.abspath(os.path.dirname(__file__))
2612

2713

@@ -73,10 +59,8 @@ def read_version() -> str:
7359

7460
_packages = find_packages(where='authserver', exclude=["*.tests", "*.tests.*", "tests.*", "tests"])
7561

76-
pipsession = PipSession()
77-
reqs_generator = parse_requirements(os.path.join(_HERE, "requirements.txt"),
78-
session=pipsession) # prepend setup.py's path (make no assumptions about cwd)
79-
reqs = [(str(r.requirement) if hasattr(r, 'requirement') else str(r.req)) for r in reqs_generator]
62+
with open(os.path.join(_HERE, "requirements.txt"), "rt") as reqfile:
63+
reqs = reqfile.readlines()
8064

8165
# on windows remove python-daemon
8266
if sys.platform == "win32":

0 commit comments

Comments
 (0)
Please sign in to comment.