Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-132930: Implement PEP 773#132931

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
zooba merged 15 commits intopython:mainfromzooba:pymanager
Apr 28, 2025
Merged
Changes from1 commit
Commits
Show all changes
15 commits
Select commitHold shift + click to select a range
39c5950
Add PyManager support to PC/layout
zoobaJan 17, 2025
9bd959a
Merge remote-tracking branch 'upstream/main' into pymanager
zoobaMar 19, 2025
d5f2be2
Update tags for consistency with PyManager updates
zoobaMar 20, 2025
ff7c9be
Merge remote-tracking branch 'upstream/main' into pymanager
zoobaMar 24, 2025
3f8b982
Merge remote-tracking branch 'upstream/main' into pymanager
zoobaApr 17, 2025
d38fdee
Merge remote-tracking branch 'upstream/main' into pymanager
zoobaApr 22, 2025
9156ec6
Add warning message to py.exe if subcommands are invoked
zoobaApr 22, 2025
e1304db
Add deprecation message to traditional installer
zoobaApr 23, 2025
45ba014
Refer to Windows documentation instead of download page
zoobaApr 23, 2025
47c5019
Merge remote-tracking branch 'upstream/main' into pymanager
zoobaApr 24, 2025
603f958
Simplify and fix up generated pymanager package manifests
zoobaApr 24, 2025
e2e8315
Update using/windows docs
zoobaApr 25, 2025
c6b570e
Remove trailing space
zoobaApr 25, 2025
a2293c5
Docs updates
zoobaApr 25, 2025
828f8ff
Add NEWS
zoobaApr 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Simplify and fix up generated pymanager package manifests
  • Loading branch information
@zooba
zooba committedApr 24, 2025
commit603f9580fa97b4f72f67909c33158b262ff9e019
144 changes: 61 additions & 83 deletionsPC/layout/support/pymanager.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,32 +20,14 @@ def _not_empty(n, key=None):
return result


def _unique(n, key=None):
seen = set()
result = []
for i in n:
if key:
i_l = i[key]
else:
i_l = i
if not i_l:
continue
i_l = i_l.casefold()
if i_l not in seen:
seen.add(i_l)
result.append(i)
return result


def calculate_install_json(ns, *, for_embed=False, for_test=False):
TARGET = "python.exe"
TARGETW = "pythonw.exe"

SYS_ARCH = {
"win32": "32bit",
"amd64": "64bit",
# Unfortunate, but this is how it's spec'd
"arm64": "64bit",
"arm64": "64bit", # Unfortunate, but this is how it's spec'd
}[ns.arch]
TAG_ARCH = {
"win32": "-32",
Expand DownExpand Up@@ -75,11 +57,11 @@ def calculate_install_json(ns, *, for_embed=False, for_test=False):
# Embeddable distro comes under a different Company
COMPANY = "PythonEmbed"
TARGETW = None
# Bit unwieldly, but we don't expect people to use the aliases anyway.
# You should 'install --target' the embeddable distro.
ALIAS_PREFIX = "embed-python"
ALIAS_PREFIX = None
DISPLAY_TAGS.append("embeddable")
FILE_SUFFIX = f"-embed-{ns.arch}"
# Deliberately name the file differently from the existing distro
# so we can republish old versions without replacing files.
FILE_SUFFIX = f"-embeddable-{ns.arch}"
if ns.include_freethreaded:
# Free-threaded distro comes with a tag suffix
TAG_SUFFIX = "t"
Expand All@@ -92,11 +74,8 @@ def calculate_install_json(ns, *, for_embed=False, for_test=False):
FULL_ARCH_TAG = f"{FULL_TAG}{TAG_ARCH}"
XY_TAG = f"{VER_MAJOR}.{VER_MINOR}{TAG_SUFFIX}"
XY_ARCH_TAG = f"{XY_TAG}{TAG_ARCH}"
if not VER_SUFFIX:
X_TAG = f"{VER_MAJOR}{TAG_SUFFIX}"
X_ARCH_TAG = f"{X_TAG}{TAG_ARCH}"
else:
X_TAG = X_ARCH_TAG = ""
X_TAG = f"{VER_MAJOR}{TAG_SUFFIX}"
X_ARCH_TAG = f"{X_TAG}{TAG_ARCH}"

# Tag used in runtime ID (for side-by-side install/updates)
ID_TAG = XY_ARCH_TAG
Expand All@@ -114,60 +93,57 @@ def calculate_install_json(ns, *, for_embed=False, for_test=False):
STD_START = []
STD_UNINSTALL = []

# The list of 'py install <TAG>' tags that will match this runtime.
# Architecture should always be included here because PyManager will add it.
INSTALL_TAGS = [
FULL_TAG,
FULL_ARCH_TAG,
XY_TAG,
XY_ARCH_TAG,
X_TAG,
X_ARCH_TAG,
]
if VER_SUFFIX:
# X_TAG and XY_TAG doesn't include VER_SUFFIX, so create -dev versions
INSTALL_TAGS.extend([
f"{XY_TAG}-dev" if XY_TAG else "",
f"{XY_TAG}-dev{TAG_ARCH}" if XY_TAG else "",
f"{X_TAG}-dev" if X_TAG else "",
f"{X_TAG}-dev{TAG_ARCH}" if X_TAG else "",
])
f"{XY_TAG}-dev{TAG_ARCH}" if XY_TAG and VER_SUFFIX else "",
f"{X_TAG}-dev{TAG_ARCH}" if X_TAG and VER_SUFFIX else "",
]

# Generate run-for and alias entries for each target
# Generate run-for entries for each target.
# Again, include architecture because PyManager will add it.
for base in [
{"target": TARGET},
{"target": TARGETW, "windowed": 1},
]:
if not base["target"]:
continue
STD_RUN_FOR.extend([
{**base, "tag": FULL_ARCH_TAG},
{**base, "tag": FULL_TAG},
])
STD_RUN_FOR.append({**base, "tag": FULL_ARCH_TAG})
if XY_TAG:
STD_RUN_FOR.extend([
{**base, "tag": XY_ARCH_TAG},
{**base, "tag": XY_TAG},
])
STD_ALIAS.extend([
{**base, "name": f"{ALIAS_PREFIX}{XY_TAG}.exe"},
{**base, "name": f"{ALIAS_PREFIX}{XY_ARCH_TAG}.exe"},
])
STD_RUN_FOR.append({**base, "tag": XY_ARCH_TAG})
if X_TAG:
STD_RUN_FOR.extend([
{**base, "tag": X_ARCH_TAG},
{**base, "tag": X_TAG},
])
STD_ALIAS.extend([
{**base, "name": f"{ALIAS_PREFIX}{X_TAG}.exe"},
{**base, "name": f"{ALIAS_PREFIX}{X_ARCH_TAG}.exe"},
])
STD_RUN_FOR.append({**base, "tag": X_ARCH_TAG})
if VER_SUFFIX:
STD_RUN_FOR.extend([
{**base, "tag": f"{XY_TAG}-dev" if XY_TAG else ""},
{**base, "tag": f"{XY_TAG}-dev{TAG_ARCH}" if XY_TAG else ""},
{**base, "tag": f"{X_TAG}-dev" if X_TAG else ""},
{**base, "tag": f"{X_TAG}-dev{TAG_ARCH}" if X_TAG else ""},
])

# Generate alias entries for each target. We need both arch and non-arch
# versions as well as windowed/non-windowed versions to make sure that all
# necessary aliases are created.
if ALIAS_PREFIX:
for prefix, base in [
(ALIAS_PREFIX, {"target": TARGET}),
(f"{ALIAS_PREFIX}w", {"target": TARGETW, "windowed": 1}),
]:
if not base["target"]:
continue
if XY_TAG:
STD_ALIAS.extend([
{**base, "name": f"{prefix}{XY_TAG}.exe"},
{**base, "name": f"{prefix}{XY_ARCH_TAG}.exe"},
])
if X_TAG:
STD_ALIAS.extend([
{**base, "name": f"{prefix}{X_TAG}.exe"},
{**base, "name": f"{prefix}{X_ARCH_TAG}.exe"},
])

STD_PEP514.append({
"kind": "pep514",
"Key": rf"{COMPANY}\{ID_TAG}",
Expand All@@ -179,6 +155,7 @@ def calculate_install_json(ns, *, for_embed=False, for_test=False):
"InstallPath": {
"_": "%PREFIX%",
"ExecutablePath": f"%PREFIX%{TARGET}",
# WindowedExecutablePath is added below
},
"Help": {
"Online Python Documentation": {
Expand All@@ -202,9 +179,13 @@ def calculate_install_json(ns, *, for_embed=False, for_test=False):
"IconIndex": 13,
"Target": f"https://docs.python.org/{VER_DOT}/",
},
# IDLE and local documentation items are added below
],
})

if TARGETW:
STD_PEP514[0]["InstallPath"]["WindowedExecutablePath"] = f"%PREFIX%{TARGETW}"

if ns.include_idle:
STD_START[0]["Items"].append({
"Name": f"IDLE {VER_DOT}{DISPLAY_SUFFIX}",
Expand All@@ -221,26 +202,23 @@ def calculate_install_json(ns, *, for_embed=False, for_test=False):
"IconIndex": 0,
})

if STD_PEP514:
if TARGETW:
STD_PEP514[0]["InstallPath"]["WindowedExecutablePath"] = f"%PREFIX%{TARGETW}"
if ns.include_html_doc:
STD_PEP514[0]["Help"]["Main Python Documentation"] = {
"_": rf"%PREFIX%Doc\html\index.html",
}
STD_START[0]["Items"].append({
"Name": f"{DISPLAY_NAME} {VER_DOT} Manuals{DISPLAY_SUFFIX}",
"Target": r"%PREFIX%Doc\html\index.html",
})
elif ns.include_chm:
STD_PEP514[0]["Help"]["Main Python Documentation"] = {
"_": rf"%PREFIX%Doc\{PYTHON_CHM_NAME}",
}
STD_START[0]["Items"].append({
"Name": f"{DISPLAY_NAME} {VER_DOT} Manuals{DISPLAY_SUFFIX}",
"Target": "%WINDIR%hhc.exe",
"Arguments": rf"%PREFIX%Doc\{PYTHON_CHM_NAME}",
})
if ns.include_html_doc:
STD_PEP514[0]["Help"]["Main Python Documentation"] = {
"_": rf"%PREFIX%Doc\html\index.html",
}
STD_START[0]["Items"].append({
"Name": f"{DISPLAY_NAME} {VER_DOT} Manuals{DISPLAY_SUFFIX}",
"Target": r"%PREFIX%Doc\html\index.html",
})
elif ns.include_chm:
STD_PEP514[0]["Help"]["Main Python Documentation"] = {
"_": rf"%PREFIX%Doc\{PYTHON_CHM_NAME}",
}
STD_START[0]["Items"].append({
"Name": f"{DISPLAY_NAME} {VER_DOT} Manuals{DISPLAY_SUFFIX}",
"Target": "%WINDIR%hhc.exe",
"Arguments": rf"%PREFIX%Doc\{PYTHON_CHM_NAME}",
})
Comment on lines +213 to +221
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I had thought we removed CHM ages ago?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This script can be used to repackage releases a long way back, so it still has the support in there. Even though it lives in the repo alongside a particular version, it is pretty independent of the actual version it's laying out.


STD_UNINSTALL.append({
"kind": "uninstall",
Expand All@@ -255,7 +233,7 @@ def calculate_install_json(ns, *, for_embed=False, for_test=False):
"sort-version": FULL_VERSION,
"company": COMPANY,
"tag": DISPLAY_TAG,
"install-for":_unique(INSTALL_TAGS),
"install-for":_not_empty(INSTALL_TAGS),
"run-for": _not_empty(STD_RUN_FOR, "tag"),
"alias": _not_empty(STD_ALIAS, "name"),
"shortcuts": [
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp