8000 Merge pull request #40 from mattmoor/test-head · tmc/rules_python@72456c9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 72456c9

Browse files
authored
Merge pull request bazel-contrib#40 from mattmoor/test-head
This updates WORKSPACE to the latest subpar, and ./update_tools.sh.
2 parents e003509 + 73dc6fb commit 72456c9

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

WORKSPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ _piptool_install()
5252
git_repository(
5353
name = "subpar",
5454
remote = "https://github.com/google/subpar",
55-
tag = "1.0.0",
55+
tag = "1.1.0",
5656
)
5757

5858
# Test data for WHL tool testing.

rules_python/piptool.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ def extract_packages(package_names):
4848
# Add extracted directories to import path ahead of their zip file
4949
# counterparts.
5050
sys.path[0:0] = dirs_to_add
51-
existing_pythonpath = os.environ['PYTHONPATH'].split(':')
52-
os.environ['PYTHONPATH'] = ':'.join(dirs_to_add + existing_pythonpath)
51+
existing_pythonpath = os.environ.get('PYTHONPATH')
52+
if existing_pythonpath:
53+
dirs_to_add.extend(existing_pythonpath.split(':'))
54+
os.environ['PYTHONPATH'] = ':'.join(dirs_to_add)
5355

5456

5557
# Wheel, pip, and setuptools are much happier running from actual
@@ -68,7 +70,12 @@ def extract_packages(package_names):
6870

6971

7072
def pip_main(argv):
71-
argv = ["--disable-pip-version-check"] + argv
73+
# Extract the certificates from the PAR following the example of get-pip.py
74+
# https://github.com/pypa/get-pip/blob/430ba37776ae2ad89/template.py#L164-L168
75+
cert_path = os.path.join(tempfile.mkdtemp(), "cacert.pem")
76+
with open(cert_path, "wb") as cert:
77+
cert.write(pkgutil.get_data("pip._vendor.requests", "cacert.pem"))
78+
argv = ["--disable-pip-version-check", "--cert", cert_path] + argv
7279
return pip.main(argv)
7380

7481

tools/piptool.par

2.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)
0