diff --git a/binary/_win/python/python.py b/binary/_win/python/python.py --- a/binary/_win/python/python.py +++ b/binary/_win/python/python.py @@ -1,5 +1,29 @@ -import info +# -*- coding: utf-8 -*- +# Copyright 2018 Łukasz Wojniłowicz +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +import info +import utils class subinfo(info.infoclass): def setTargets(self): @@ -7,31 +31,50 @@ if CraftCore.compiler.isX64(): arch = "amd64" - for ver in ["3.5.1", "3.6.0"]: - self.targets[ver] = f"https://www.python.org/ftp/python/{ver}/python-{ver}-embed-{arch}.zip" + for ver in ["2.7.15", "3.5.1", "3.6.0"]: + if ver.startswith("2"): + if arch == "win32": + self.targets[ver] = f"https://www.python.org/ftp/python/{ver}/python-{ver}.msi" + else: + self.targets[ver] = f"https://www.python.org/ftp/python/{ver}/python-{ver}.{arch}.msi" + + else: + self.targets[ver] = f"https://www.python.org/ftp/python/{ver}/python-{ver}-embed-{arch}.zip" self.targetInstallPath[ver] = "python" self.defaultTarget = "3.6.0" def setDependencies(self): self.runtimeDependencies["virtual/bin-base"] = "default" - from Package.BinaryPackageBase import * - class Package(BinaryPackageBase): def __init__(self): BinaryPackageBase.__init__(self) def install(self): - if not BinaryPackageBase.install(self): - return False - # https://bugs.python.org/issue29319 - files = os.listdir(self.installDir()) - reZipName = re.compile(r"python\d\d.*") - name = None - for f in files: - if reZipName.match(f): - name, _ = os.path.splitext(f) - break - return utils.deleteFile(os.path.join(self.installDir(), f"{name}._pth")) + if self.subinfo.buildTarget.startswith("2"): + executable = "msiexec.exe" + if CraftCore.compiler.isX64(): + installer = os.path.join(self.sourceDir(), f"python-{self.subinfo.buildTarget}.amd64.msi") + else: + installer = os.path.join(self.sourceDir(), f"python-{self.subinfo.buildTarget}.msi") + targetdir = self.installDir() + arguments = f"/i {installer} TARGETDIR={targetdir} /quiet" + if not self.cleanImage(): + return False + if not utils.system(executable + " " + arguments): + return False + return True + else: + if not BinaryPackageBase.install(self): + return False + # https://bugs.python.org/issue29319 + files = os.listdir(self.installDir()) + reZipName = re.compile(r"python\d\d.*") + name = None + for f in files: + if reZipName.match(f): + name, _ = os.path.splitext(f) + break + return utils.deleteFile(os.path.join(self.installDir(), f"{name}._pth")) diff --git a/extragear/kmymoney/kmymoney.py b/extragear/kmymoney/kmymoney.py --- a/extragear/kmymoney/kmymoney.py +++ b/extragear/kmymoney/kmymoney.py @@ -67,6 +67,8 @@ self.runtimeDependencies["extragear/kdiagram"] = "default" self.buildDependencies["libs/gettext"] = "default" self.runtimeDependencies["libs/qt5/qtwebkit"] = "default" + if OsUtils.isWin(): + self.runtimeDependencies["python-modules/weboob"] = "default" from Package.CMakePackageBase import * @@ -80,6 +82,21 @@ os.path.join(os.path.dirname(__file__), 'blacklist.txt') ] + def configure(self): + if OsUtils.isWin(): + if ("Paths", "Python27") in CraftCore.settings: + pythonexe = os.path.join(CraftCore.settings.get("Paths", "Python27"), f"python{CraftCore.compiler.executableSuffix}") + if not os.path.exists(pythonexe): + if CraftCore.compiler.isWindows: + CraftCore.log.warning(f"Could not find {python} as provided by [Paths]Python, using {sys.executable} as a fallback") + pythonexe = sys.executable + + pythonRoot, _ = os.path.split(pythonexe) + pythoninc = os.path.join(pythonRoot, "include") + pythonlib = os.path.join(pythonRoot, "python27.dll") + self.subinfo.options.configure.args = f" -DPYTHON_EXECUTABLE=\"{pythonexe}\" -DPYTHON_INCLUDE_DIR=\"{pythoninc}\" -DPYTHON_LIBRARY=\"{pythonlib}\"" + return CMakePackageBase.configure(self) + def createPackage(self): self.defines["executable"] = "bin\\kmymoney.exe" self.defines["icon"] = os.path.join(self.packageDir(), "kmymoney.ico") diff --git a/python-modules/weboob/weboob.py b/python-modules/weboob/weboob.py new file mode 100644 --- /dev/null +++ b/python-modules/weboob/weboob.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2018 Łukasz Wojniłowicz +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +import info +from Package.PipPackageBase import * + + +class subinfo(info.infoclass): + def setDependencies(self): + self.runtimeDependencies["binary/python"] = "2.7.15" + self.runtimeDependencies["dev-utils/python2"] = "default" + + def setTargets(self): + self.svnTargets['master'] = '' + self.description = "Web Outside of Browsers." + self.defaultTarget = 'master' + + +class Package(PipPackageBase): + def __init__(self, **args): + PipPackageBase.__init__(self) + self.python3 = False