Skip to content

Commit b16b486

Browse files
committed
feat: Add poetry-core support
# Conflicts: # src/python/supply/supply_test.go
1 parent 5585417 commit b16b486

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

src/python/supply/supply.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,15 @@ func (s *Supplier) InstallCommonBuildDependencies() error {
764764
return fmt.Errorf("could not install build-time dependency %s: %v", dep, err)
765765
}
766766
}
767+
768+
if err := s.Installer.InstallOnlyVersion("poetry-core", tempPath); err != nil {
769+
return fmt.Errorf("could not prepare build-time dependency poetry-core: %v", err)
770+
}
771+
s.Log.Info("Installing build-time dependency poetry-core (bootstrap)")
772+
if err := s.runPipInstall(tempPath, "--no-build-isolation"); err != nil {
773+
return fmt.Errorf("could not bootstrap-install poetry-core: %v", err)
774+
}
775+
767776
return nil
768777
}
769778

src/python/supply/supply_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,27 @@ MarkupSafe==2.0.1
662662
Expect(supplier.InstallCommonBuildDependencies()).To(MatchError("could not install build-time dependency wheel: some-pip-error"))
663663
})
664664
})
665+
666+
Context("poetry-core preparation fails", func() {
667+
It("returns a useful error message", func() {
668+
mockInstaller.EXPECT().InstallOnlyVersion("pip", "/tmp/common_build_deps")
669+
mockCommand.EXPECT().Execute(buildDir, gomock.Any(), gomock.Any(), "python", "-m", "pip", "install", "wheel", "--no-index", "--upgrade-strategy=only-if-needed", "--find-links=/tmp/common_build_deps")
670+
mockCommand.EXPECT().Execute(buildDir, gomock.Any(), gomock.Any(), "python", "-m", "pip", "install", "setuptools", "--no-index", "--upgrade-strategy=only-if-needed", "--find-links=/tmp/common_build_deps")
671+
mockInstaller.EXPECT().InstallOnlyVersion("poetry-core", "/tmp/common_build_deps").Return(fmt.Errorf("prepare-error"))
672+
Expect(supplier.InstallCommonBuildDependencies()).To(MatchError("could not prepare build-time dependency poetry-core: prepare-error"))
673+
})
674+
})
675+
676+
Context("poetry-core bootstrap fails", func() {
677+
It("returns a useful error message", func() {
678+
mockInstaller.EXPECT().InstallOnlyVersion("pip", "/tmp/common_build_deps")
679+
mockCommand.EXPECT().Execute(buildDir, gomock.Any(), gomock.Any(), "python", "-m", "pip", "install", "wheel", "--no-index", "--upgrade-strategy=only-if-needed", "--find-links=/tmp/common_build_deps")
680+
mockCommand.EXPECT().Execute(buildDir, gomock.Any(), gomock.Any(), "python", "-m", "pip", "install", "setuptools", "--no-index", "--upgrade-strategy=only-if-needed", "--find-links=/tmp/common_build_deps")
681+
mockInstaller.EXPECT().InstallOnlyVersion("poetry-core", "/tmp/common_build_deps")
682+
mockCommand.EXPECT().Execute(buildDir, gomock.Any(), gomock.Any(), "python", "-m", "pip", "install", "/tmp/common_build_deps", "--no-build-isolation").Return(fmt.Errorf("poetry-error"))
683+
Expect(supplier.InstallCommonBuildDependencies()).To(MatchError("could not bootstrap-install poetry-core: poetry-error"))
684+
})
685+
})
665686
})
666687

667688
Describe("CreateDefaultEnv", func() {

0 commit comments

Comments
 (0)