Skip to content

Commit 8734956

Browse files
authored
Scrub multiple ways of describing index-url from requiremnts.txt when using vendored installs (#544)
See pypa/pip#11276 for the upstream problem. A fix was already in-place in the python buildback, but it was limited to a single notation of `index-url=...`
1 parent 30c0c06 commit 8734956

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/python/supply/supply.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -699,15 +699,15 @@ func (s *Supplier) RunPipVendored() error {
699699
installArgs = append(installArgs, "--no-build-isolation")
700700
}
701701

702-
// Remove lines from requirements.txt that begin with -i
702+
// Remove lines from requirements.txt that begin with -i, --index-url and --extra-index-url
703703
// because specifying index links here makes pip always want internet access,
704704
// and pipenv generates requirements.txt with -i.
705705
originalReqs, err := ioutil.ReadFile(requirementsPath)
706706
if err != nil {
707707
return fmt.Errorf("could not read requirements.txt: %v", err)
708708
}
709709

710-
re := regexp.MustCompile(`(?m)^\s*-i.*$`)
710+
re := regexp.MustCompile(`(?m)^\s*(-i|--index-url|--extra-index-url)\s+(.*)$`)
711711
modifiedReqs := re.ReplaceAll(originalReqs, []byte{})
712712
err = ioutil.WriteFile(requirementsPath, modifiedReqs, 0644)
713713
if err != nil {

0 commit comments

Comments
 (0)