diff --git a/bin/Package/PipPackageBase.py b/bin/Package/PipPackageBase.py index b3beffa55..de23d5218 100644 --- a/bin/Package/PipPackageBase.py +++ b/bin/Package/PipPackageBase.py @@ -1,33 +1,27 @@ from BuildSystem.PipBuildSystem import * from Package.PackageBase import * from Packager.PackagerBase import * from Package.VirtualPackageBase import * from Source.MultiSource import * class PipPackageBase(PackageBase, PipBuildSystem, PackagerBase): """provides a base class for pip packages""" def __init__(self): CraftCore.log.debug("PipPackageBase.__init__ called") PackageBase.__init__(self) if self.subinfo.svnTarget() or self.subinfo.hasTarget(): self.__class__.__bases__ += (MultiSource,) MultiSource.__init__(self) else: self.__class__.__bases__ += (VirtualPackageBase,) VirtualPackageBase.__init__(self) PipBuildSystem.__init__(self) PackagerBase.__init__(self) # from PackagerBase def createPackage(self): return True def preArchive(self): return True - - def make(self): - return PipBuildSystem.make(self) - - def install(self): - return PipBuildSystem.install(self) diff --git a/blueprints/python-modules/pip/pip.py b/blueprints/python-modules/pip/pip.py index f723e98ae..fa952c326 100644 --- a/blueprints/python-modules/pip/pip.py +++ b/blueprints/python-modules/pip/pip.py @@ -1,39 +1,33 @@ -import info -from Package.MaybeVirtualPackageBase import * +import subprocess -from pathlib import Path -import sys +import info +import utils from Package.PipPackageBase import PipPackageBase +from Utils import CraftHash class subinfo(info.infoclass): def setTargets(self): - self.targets["master"] = f"https://bootstrap.pypa.io/get-pip.py" - self.defaultTarget = "master" - -from Package.PipPackageBase import * + for ver in ["3.4"]: + self.targets[ver] = f"https://bootstrap.pypa.io/3.4/get-pip.py" + self.targetDigests[ver] = (['b86f36cc4345ae87bfd4f10ef6b2dbfa7a872fbff70608a1e43944d283fd0eee'], CraftHash.HashAlgorithm.SHA256) + self.defaultTarget = "3.4" -class PPackage(PipPackageBase): +class Package(PipPackageBase): def __init__(self): PipPackageBase.__init__(self) + def unpack(self): + return True + def make(self): get_pip = self.localFilePath()[0] for ver, python in self._pythons: + hasPip = utils.system([python, "-m", "pip"], stdout=subprocess.DEVNULL) + if hasPip: + continue if not utils.system([python, get_pip, "--user"]): return False - return utils.deleteFile(get_pip) - - -class PipPackage(PipPackageBase): - def __init__(self, **args): - PipPackageBase.__init__(self) - - -class Package(MaybeVirtualPackageBase): - def __init__(self): - root = Path(CraftCore.standardDirs.craftRoot()) - py = Path(sys.executable) - MaybeVirtualPackageBase.__init__(self, condition=CraftCore.compiler.isMacOS or root in py.parents, classA=PPackage, classB=PipPackage) + return True