Skip to content

Commit

Permalink
PipPackageSystem: Avoid calling sage-get-system-packages for pypi:DIS…
Browse files Browse the repository at this point in the history
…TRIBUTION-NAME
  • Loading branch information
Matthias Koeppe committed Feb 25, 2024
1 parent 6976afa commit e234fd9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/sage/features/pkg_systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,17 @@ def _spkg_installation_hint(self, spkgs, prompt, feature):
lines.append(f' $ deactivate')
return '\n'.join(lines)
return super()._spkg_installation_hint(spkgs, prompt, feature)

def _system_packages(self, spkgs):
all_packages = spkgs.split()
pypi_packages = [package[len('pypi:'):] for package in all_packages
if package.startswith('pypi:')]
other_packages = [package for package in all_packages
if not package.startswith('pypi:')]
if other_packages:
from subprocess import run, CalledProcessError
system = self.name
proc = run(f'sage-get-system-packages {system} {spkgs}',
shell=True, capture_output=True, text=True, check=True)
pypi_packages.extend(proc.stdout.split())
return ' '.join(pypi_packages)

0 comments on commit e234fd9

Please sign in to comment.