Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Carlos Cordoba <ccordoba12@gmail.com>
  • Loading branch information
mrclary and ccordoba12 authored Oct 19, 2022
1 parent 4fb9e49 commit 5555dc6
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions installers-conda/build_installers.py
Original file line number Diff line number Diff line change
@@ -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`.
Expand Down Expand Up @@ -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')
Expand All @@ -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:
Expand Down Expand Up @@ -125,6 +133,7 @@
"paramiko": "",
"pyxdg": "",
}

if SPECS.exists():
logger.info(f"Reading specs from {SPECS}...")
_specs = yaml.load(SPECS.read_text())
Expand All @@ -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
Expand Down Expand Up @@ -237,6 +246,7 @@ def _definitions():
condarc: ".condarc",
},
}

if not args.no_local:
definitions["channels"].insert(0, "local")

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 5555dc6

Please sign in to comment.