Skip to content

Commit 3c91be7

Browse files
vanschelvenbrayanhenao
authored andcommitted
Don't warn about script locations (#601)
* Don't warn about script locations See e.g. https://stackoverflow.com/q/59790562/339144 for the confusion this causes. When installing files into a buildpack, script locations shouldn't matter since these files are presumably not run as scripts anyway (but included as python modules). * Fix the tests
1 parent a5a5f5d commit 3c91be7

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

src/python/supply/supply.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,7 @@ func (s *Supplier) RunPipUnvendored() error {
642642
"--exists-action=w",
643643
"--src="+filepath.Join(s.Stager.DepDir(), "src"),
644644
"--disable-pip-version-check",
645+
"--no-warn-script-location",
645646
); err != nil {
646647
return fmt.Errorf("could not run pip: %v", err)
647648
}
@@ -673,6 +674,7 @@ func (s *Supplier) RunPipVendored() error {
673674
"--no-index",
674675
"--find-links=file://" + filepath.Join(s.Stager.BuildDir(), "vendor"),
675676
"--disable-pip-version-check",
677+
"--no-warn-script-location",
676678
}
677679

678680
if s.hasBuildOptions() {

src/python/supply/supply_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ var _ = Describe("Supply", func() {
153153
Expect(ioutil.WriteFile(filepath.Join(buildDir, "requirements.txt"), []byte{}, 0644)).To(Succeed())
154154
mockStager.EXPECT().LinkDirectoryInDepDir(gomock.Any(), gomock.Any())
155155

156-
mockCommand.EXPECT().Execute(buildDir, gomock.Any(), gomock.Any(), "python", "-m", "pip", "install", "-r", filepath.Join(buildDir, "requirements.txt"), "--ignore-installed", "--exists-action=w", fmt.Sprintf("--src=%s/src", depDir), "--disable-pip-version-check")
156+
mockCommand.EXPECT().Execute(buildDir, gomock.Any(), gomock.Any(), "python", "-m", "pip", "install", "-r", filepath.Join(buildDir, "requirements.txt"), "--ignore-installed", "--exists-action=w", fmt.Sprintf("--src=%s/src", depDir), "--disable-pip-version-check", "--no-warn-script-location")
157157
Expect(supplier.RunPipUnvendored()).To(Succeed())
158158
})
159159
})
@@ -179,7 +179,7 @@ var _ = Describe("Supply", func() {
179179
Expect(ioutil.WriteFile(filepath.Join(buildDir, "requirements.txt"), []byte{}, 0644)).To(Succeed())
180180
mockStager.EXPECT().LinkDirectoryInDepDir(gomock.Any(), gomock.Any())
181181

182-
mockCommand.EXPECT().Execute(buildDir, gomock.Any(), gomock.Any(), "pip", "install", "-r", filepath.Join(buildDir, "requirements.txt"), "--ignore-installed", "--exists-action=w", fmt.Sprintf("--src=%s/src", depDir), "--disable-pip-version-check")
182+
mockCommand.EXPECT().Execute(buildDir, gomock.Any(), gomock.Any(), "pip", "install", "-r", filepath.Join(buildDir, "requirements.txt"), "--ignore-installed", "--exists-action=w", fmt.Sprintf("--src=%s/src", depDir), "--disable-pip-version-check", "--no-warn-script-location")
183183
Expect(supplier.RunPipUnvendored()).To(Succeed())
184184
})
185185
})
@@ -548,15 +548,15 @@ cffi`
548548
})
549549

550550
It("Runs and outputs pip", func() {
551-
mockCommand.EXPECT().Execute(buildDir, gomock.Any(), gomock.Any(), "python", "-m", "pip", "install", "-r", filepath.Join(buildDir, "requirements.txt"), "--ignore-installed", "--exists-action=w", fmt.Sprintf("--src=%s/src", depDir), "--disable-pip-version-check")
551+
mockCommand.EXPECT().Execute(buildDir, gomock.Any(), gomock.Any(), "python", "-m", "pip", "install", "-r", filepath.Join(buildDir, "requirements.txt"), "--ignore-installed", "--exists-action=w", fmt.Sprintf("--src=%s/src", depDir), "--disable-pip-version-check", "--no-warn-script-location")
552552
Expect(supplier.RunPipUnvendored()).To(Succeed())
553553
})
554554
})
555555

556556
Context("requirements.txt exists in dep dir and pip install fails", func() {
557557
BeforeEach(func() {
558558
Expect(ioutil.WriteFile(filepath.Join(buildDir, "requirements.txt"), []byte{}, 0644)).To(Succeed())
559-
mockCommand.EXPECT().Execute(buildDir, gomock.Any(), gomock.Any(), "python", "-m", "pip", "install", "-r", filepath.Join(buildDir, "requirements.txt"), "--ignore-installed", "--exists-action=w", fmt.Sprintf("--src=%s/src", depDir), "--disable-pip-version-check").Return(fmt.Errorf("exit 28"))
559+
mockCommand.EXPECT().Execute(buildDir, gomock.Any(), gomock.Any(), "python", "-m", "pip", "install", "-r", filepath.Join(buildDir, "requirements.txt"), "--ignore-installed", "--exists-action=w", fmt.Sprintf("--src=%s/src", depDir), "--disable-pip-version-check", "--no-warn-script-location").Return(fmt.Errorf("exit 28"))
560560
})
561561

562562
const proTip = "Running pip install failed. You need to include all dependencies in the vendor directory."
@@ -590,7 +590,7 @@ MarkupSafe==2.0.1
590590
})
591591

592592
It("check index_url, find_links, allow_hosts values", func() {
593-
mockCommand.EXPECT().Execute(buildDir, gomock.Any(), gomock.Any(), "python", "-m", "pip", "install", "-r", filepath.Join(buildDir, "requirements.txt"), "--ignore-installed", "--exists-action=w", fmt.Sprintf("--src=%s/src", depDir), "--disable-pip-version-check")
593+
mockCommand.EXPECT().Execute(buildDir, gomock.Any(), gomock.Any(), "python", "-m", "pip", "install", "-r", filepath.Join(buildDir, "requirements.txt"), "--ignore-installed", "--exists-action=w", fmt.Sprintf("--src=%s/src", depDir), "--disable-pip-version-check", "--no-warn-script-location")
594594
Expect(supplier.RunPipUnvendored()).To(Succeed())
595595
filePath := filepath.Join(os.Getenv("HOME"), ".pydistutils.cfg")
596596
fileContents, err := ioutil.ReadFile(filePath)
@@ -621,7 +621,7 @@ MarkupSafe==2.0.1
621621

622622
It("installs the vendor directory", func() {
623623
mockCommand.EXPECT().Execute(buildDir, gomock.Any(), gomock.Any(), "python", "-m", "pip", "install", "--no-build-isolation", "-h").Return(nil)
624-
mockCommand.EXPECT().Execute(buildDir, gomock.Any(), gomock.Any(), "python", "-m", "pip", "install", "-r", filepath.Join(buildDir, "requirements.txt"), "--ignore-installed", "--exists-action=w", fmt.Sprintf("--src=%s/src", depDir), "--no-index", fmt.Sprintf("--find-links=file://%s/vendor", buildDir), "--disable-pip-version-check", "--no-build-isolation")
624+
mockCommand.EXPECT().Execute(buildDir, gomock.Any(), gomock.Any(), "python", "-m", "pip", "install", "-r", filepath.Join(buildDir, "requirements.txt"), "--ignore-installed", "--exists-action=w", fmt.Sprintf("--src=%s/src", depDir), "--no-index", fmt.Sprintf("--find-links=file://%s/vendor", buildDir), "--disable-pip-version-check", "--no-warn-script-location", "--no-build-isolation")
625625
Expect(supplier.RunPipVendored()).To(Succeed())
626626
})
627627
})
@@ -631,8 +631,8 @@ MarkupSafe==2.0.1
631631
Expect(ioutil.WriteFile(filepath.Join(buildDir, "requirements.txt"), []byte{}, 0644)).To(Succeed())
632632
Expect(os.Mkdir(filepath.Join(buildDir, "vendor"), 0755)).To(Succeed())
633633
mockCommand.EXPECT().Execute(buildDir, gomock.Any(), gomock.Any(), "python", "-m", "pip", "install", "--no-build-isolation", "-h").Return(nil)
634-
mockCommand.EXPECT().Execute(buildDir, gomock.Any(), gomock.Any(), "python", "-m", "pip", "install", "-r", filepath.Join(buildDir, "requirements.txt"), "--ignore-installed", "--exists-action=w", fmt.Sprintf("--src=%s/src", depDir), "--no-index", fmt.Sprintf("--find-links=file://%s/vendor", buildDir), "--disable-pip-version-check", "--no-build-isolation").Return(fmt.Errorf("exit 28"))
635-
mockCommand.EXPECT().Execute(buildDir, gomock.Any(), gomock.Any(), "python", "-m", "pip", "install", "-r", filepath.Join(buildDir, "requirements.txt"), "--ignore-installed", "--exists-action=w", fmt.Sprintf("--src=%s/src", depDir), "--disable-pip-version-check").Return(fmt.Errorf("exit 28"))
634+
mockCommand.EXPECT().Execute(buildDir, gomock.Any(), gomock.Any(), "python", "-m", "pip", "install", "-r", filepath.Join(buildDir, "requirements.txt"), "--ignore-installed", "--exists-action=w", fmt.Sprintf("--src=%s/src", depDir), "--no-index", fmt.Sprintf("--find-links=file://%s/vendor", buildDir), "--disable-pip-version-check", "--no-warn-script-location", "--no-build-isolation").Return(fmt.Errorf("exit 28"))
635+
mockCommand.EXPECT().Execute(buildDir, gomock.Any(), gomock.Any(), "python", "-m", "pip", "install", "-r", filepath.Join(buildDir, "requirements.txt"), "--ignore-installed", "--exists-action=w", fmt.Sprintf("--src=%s/src", depDir), "--disable-pip-version-check", "--no-warn-script-location").Return(fmt.Errorf("exit 28"))
636636
})
637637

638638
const proTip = "Running pip install failed. You need to include all dependencies in the vendor directory."

0 commit comments

Comments
 (0)