Skip to content

Commit d0191f0

Browse files
AustinSchuhbrandjon
authored andcommitted
Remove the temporary directory containing cacert.pem when done (bazel-contrib#169)
Our verification machines were filling up /tmp/ with this temporary folder. This patch removes it when piptool exits.
1 parent 120590e commit d0191f0

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

rules_python/piptool.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ def extract_packages(package_names):
7373
def pip_main(argv):
7474
# Extract the certificates from the PAR following the example of get-pip.py
7575
# https://github.com/pypa/get-pip/blob/430ba37776ae2ad89/template.py#L164-L168
76-
cert_path = os.path.join(tempfile.mkdtemp(), "cacert.pem")
76+
cert_tmpdir = tempfile.mkdtemp()
77+
cert_path = os.path.join(cert_tmpdir, "cacert.pem")
78+
atexit.register(lambda: shutil.rmtree(cert_tmpdir, ignore_errors=True))
7779
with open(cert_path, "wb") as cert:
7880
cert.write(pkgutil.get_data("pip._vendor.requests", "cacert.pem"))
7981
argv = ["--disable-pip-version-check", "--cert", cert_path] + argv

tools/piptool.par

212 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy