From 5555dc683089f11ccd7a9db92faffbe2c7c10a88 Mon Sep 17 00:00:00 2001 From: Ryan Clary <9618975+mrclary@users.noreply.github.com> Date: Wed, 19 Oct 2022 09:17:35 -0700 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Carlos Cordoba --- installers-conda/build_installers.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/installers-conda/build_installers.py b/installers-conda/build_installers.py index e9194392306..961437c99e1 100644 --- a/installers-conda/build_installers.py +++ b/installers-conda/build_installers.py @@ -1,3 +1,9 @@ +# -*- coding: utf-8 -*- +# +# Copyright © Spyder Project Contributors +# Licensed under the terms of the MIT License +# (see spyder/__init__.py for details) + """ Create Spyder installers using `constructor`. @@ -33,6 +39,7 @@ from textwrap import dedent, indent from time import time +# Local imports from build_conda_pkgs import HERE, DIST, RESOURCES, SPECS, h, get_version logger = getLogger('BuildInstallers') @@ -45,11 +52,12 @@ MACOS = sys.platform == "darwin" LINUX = sys.platform.startswith("linux") TARGET_PLATFORM = os.environ.get("CONSTRUCTOR_TARGET_PLATFORM") +PY_VER = f"{sys.version_info.major}.{sys.version_info.minor}" + if TARGET_PLATFORM == "osx-arm64": ARCH = "arm64" else: ARCH = (platform.machine() or "generic").lower().replace("amd64", "x86_64") -PY_VER = f"{sys.version_info.major}.{sys.version_info.minor}" if WINDOWS: EXT, OS = "exe", "Windows" elif LINUX: @@ -125,6 +133,7 @@ "paramiko": "", "pyxdg": "", } + if SPECS.exists(): logger.info(f"Reading specs from {SPECS}...") _specs = yaml.load(SPECS.read_text()) @@ -146,7 +155,7 @@ def _generate_background_images(installer_type): - """Requires pillow""" + """This requires Pillow.""" if installer_type == "sh": # shell installers are text-based, no graphics return @@ -237,6 +246,7 @@ def _definitions(): condarc: ".condarc", }, } + if not args.no_local: definitions["channels"].insert(0, "local") @@ -268,6 +278,7 @@ def _definitions(): "post_install": str(RESOURCES / "post-install.sh"), } ) + if args.cert_id: definitions["signing_identity_name"] = args.cert_id definitions["notarization_identity_name"] = args.cert_id @@ -293,6 +304,7 @@ def _definitions(): "installer_type": "exe", } ) + signing_certificate = os.environ.get("CONSTRUCTOR_SIGNING_CERTIFICATE") if signing_certificate: definitions["signing_certificate"] = signing_certificate @@ -307,16 +319,6 @@ def _constructor(): """ Create a temporary `construct.yaml` input file and run `constructor`. - - Parameters - ---------- - version: str - Version of `spyder` to be built. Defaults to the - one detected by `importlib` from the source code. - extra_specs: list of str - Additional packages to be included in the installer. - A list of conda spec strings (`numpy`, `python=3`, etc) - is expected. """ constructor = find_executable("constructor") if not constructor: