Skip to content

Commit 0583d27

Browse files
committed
Address the cert issue in piptool as a PAR.
With this change I am able to build/test my PR on my macbook without pip installed. The only additional change I have locally is to switch from running piptool.py as a simple .py file to downloading/using a PAR built from this change. I believe we still have the problem that the .par picks the host's version of pip instead of our embedded copy, but I haven't reverified that issue still exists (this just does nothing to address that issue).
1 parent b44ba59 commit 0583d27

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

python/piptool.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
# Fallback on using it as a CLI.
3333
from pip._vendor import requests
3434

35-
from pip import main as pip_main
36-
# def pip_main(argv):
37-
# # Extract the certificates from the PAR following the example of get-pip.py
38-
# # https://github.com/pypa/get-pip/blob/430ba37776ae2ad89/template.py#L164-L168
39-
# cert_path = os.path.join(tempfile.mkdtemp(), "cacert.pem")
40-
# with open(cert_path, "wb") as cert:
41-
# cert.write(pkgutil.get_data("pip._vendor.requests", "cacert.pem"))
42-
# return _pip_main(argv + ["--cert", os.path.basename(cert_path)])
35+
from pip import main as _pip_main
36+
def pip_main(argv):
37+
# Extract the certificates from the PAR following the example of get-pip.py
38+
# https://github.com/pypa/get-pip/blob/430ba37776ae2ad89/template.py#L164-L168
39+
cert_path = os.path.join(tempfile.mkdtemp(), "cacert.pem")
40+
with open(cert_path, "wb") as cert:
41+
cert.write(pkgutil.get_data("pip._vendor.requests", "cacert.pem"))
42+
return _pip_main(argv + ["--cert", cert_path])
4343

4444
except:
4545
import subprocess

0 commit comments

Comments
 (0)