diff options
author | Steve Dower <steve.dower@python.org> | 2019-11-20 09:30:47 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-20 09:30:47 -0800 |
commit | de148f263fba75cd10d2cb010fe9c495cee4ec83 (patch) | |
tree | 7559853c00252bb9e300e6815ee3615a90e3973b /PC/layout/support/nuspec.py | |
parent | abce2d9bc6b990831d303f4cf9f2de8a6712a1fc (diff) | |
download | cpython-git-de148f263fba75cd10d2cb010fe9c495cee4ec83.tar.gz |
bpo-33125: Add support for building and releasing Windows ARM64 packages (GH-16828)
Note that the support is not actually enabled yet, and so we won't be publishing these packages. However, for those who want to build it themselves (even by reusing the Azure Pipelines definition), it's now relatively easy to enable.
Diffstat (limited to 'PC/layout/support/nuspec.py')
-rw-r--r-- | PC/layout/support/nuspec.py | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/PC/layout/support/nuspec.py b/PC/layout/support/nuspec.py index ba26ff337e..b85095c555 100644 --- a/PC/layout/support/nuspec.py +++ b/PC/layout/support/nuspec.py @@ -13,25 +13,21 @@ PYTHON_NUSPEC_NAME = "python.nuspec" NUSPEC_DATA = { "PYTHON_TAG": VER_DOT, "PYTHON_VERSION": os.getenv("PYTHON_NUSPEC_VERSION"), - "PYTHON_BITNESS": "64-bit" if IS_X64 else "32-bit", - "PACKAGENAME": os.getenv("PYTHON_NUSPEC_PACKAGENAME"), - "PACKAGETITLE": os.getenv("PYTHON_NUSPEC_PACKAGETITLE"), "FILELIST": r' <file src="**\*" target="tools" />', } -if not NUSPEC_DATA["PYTHON_VERSION"]: - if VER_NAME: - NUSPEC_DATA["PYTHON_VERSION"] = "{}.{}-{}{}".format( - VER_DOT, VER_MICRO, VER_NAME, VER_SERIAL - ) - else: - NUSPEC_DATA["PYTHON_VERSION"] = "{}.{}".format(VER_DOT, VER_MICRO) - -if not NUSPEC_DATA["PACKAGETITLE"]: - NUSPEC_DATA["PACKAGETITLE"] = "Python" if IS_X64 else "Python (32-bit)" +NUSPEC_PLATFORM_DATA = dict( + _keys=("PYTHON_BITNESS", "PACKAGENAME", "PACKAGETITLE"), + win32=("32-bit", "pythonx86", "Python (32-bit)"), + amd64=("64-bit", "python", "Python"), + arm32=("ARM", "pythonarm", "Python (ARM)"), + arm64=("ARM64", "pythonarm64", "Python (ARM64)"), +) -if not NUSPEC_DATA["PACKAGENAME"]: - NUSPEC_DATA["PACKAGENAME"] = "python" if IS_X64 else "pythonx86" +if not NUSPEC_DATA["PYTHON_VERSION"]: + NUSPEC_DATA["PYTHON_VERSION"] = "{}.{}{}{}".format( + VER_DOT, VER_MICRO, "-" if VER_SUFFIX else "", VER_SUFFIX + ) FILELIST_WITH_PROPS = r""" <file src="**\*" exclude="python.props" target="tools" /> <file src="python.props" target="build\native" />""" @@ -56,11 +52,21 @@ NUSPEC_TEMPLATE = r"""<?xml version="1.0"?> """ +def _get_nuspec_data_overrides(ns): + for k, v in zip(NUSPEC_PLATFORM_DATA["_keys"], NUSPEC_PLATFORM_DATA[ns.arch]): + ev = os.getenv("PYTHON_NUSPEC_" + k) + if ev: + yield k, ev + yield k, v + + def get_nuspec_layout(ns): if ns.include_all or ns.include_nuspec: - data = NUSPEC_DATA + data = dict(NUSPEC_DATA) + for k, v in _get_nuspec_data_overrides(ns): + if not data.get(k): + data[k] = v if ns.include_all or ns.include_props: - data = dict(data) data["FILELIST"] = FILELIST_WITH_PROPS nuspec = NUSPEC_TEMPLATE.format_map(data) yield "python.nuspec", ("python.nuspec", nuspec.encode("utf-8")) |