From 87349562b92cd92cb5bb5d6980eb2ecb206d2196 Mon Sep 17 00:00:00 2001 From: Klaas van Schelven Date: Wed, 27 Jul 2022 23:12:47 +0200 Subject: [PATCH] Scrub multiple ways of describing index-url from requiremnts.txt when using vendored installs (#544) See https://github.com/pypa/pip/issues/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=...` --- src/python/supply/supply.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/python/supply/supply.go b/src/python/supply/supply.go index 1a1a30335..6c7d3bf8f 100644 --- a/src/python/supply/supply.go +++ b/src/python/supply/supply.go @@ -699,7 +699,7 @@ func (s *Supplier) RunPipVendored() error { installArgs = append(installArgs, "--no-build-isolation") } - // Remove lines from requirements.txt that begin with -i + // Remove lines from requirements.txt that begin with -i, --index-url and --extra-index-url // because specifying index links here makes pip always want internet access, // and pipenv generates requirements.txt with -i. originalReqs, err := ioutil.ReadFile(requirementsPath) @@ -707,7 +707,7 @@ func (s *Supplier) RunPipVendored() error { return fmt.Errorf("could not read requirements.txt: %v", err) } - re := regexp.MustCompile(`(?m)^\s*-i.*$`) + re := regexp.MustCompile(`(?m)^\s*(-i|--index-url|--extra-index-url)\s+(.*)$`) modifiedReqs := re.ReplaceAll(originalReqs, []byte{}) err = ioutil.WriteFile(requirementsPath, modifiedReqs, 0644) if err != nil {