Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,30 @@ jobs:
}
shell: powershell

#- name: Set up Python 3.14
#- name: Set up Python 3.15
# uses: actions/setup-python@v5
# with:
# python-version: 3.14-dev
# python-version: 3.15-dev

# We move faster than GitHub's Python runtimes, so use NuGet instead
# One day we can use ourselves to download Python, but not yet...
- name: Set up NuGet
uses: nuget/setup-nuget@b26b823c478ee115be5c9403e62c90b0bf943843 # v3.1.0

- name: Set up Python 3.14.6
- name: Set up Python 3.15.0rc1
run: |
nuget install python -Version 3.14.6 -x -o .
nuget install python -Version 3.15.0-rc1 -x -o .
$py = Get-Item python\tools
Write-Host "Adding $py to PATH"
"$py" | Out-File $env:GITHUB_PATH -Encoding UTF8 -Append
working-directory: ${{ runner.temp }}

- name: Check Python version is 3.14.6
- name: Check Python version is 3.15.0rc1
run: >
python -c "import sys;
print(sys.version);
print(sys.executable);
sys.exit(0 if sys.version_info[:5] == (3, 14, 6, 'final', 0) else 1)"
sys.exit(0 if sys.version_info[:5] == (3, 15, 0, 'candidate', 1) else 1)"

- name: Install build dependencies
run: python -m pip install "pymsbuild==1.2.2"
Expand Down
6 changes: 5 additions & 1 deletion _msbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@

DLL_NAME = "python{0.major}{0.minor}".format(sys.version_info)
VER_NUM = "{0.major}.{0.minor}.{0.micro}".format(sys.version_info)
EMBED_URL = f"https://www.python.org/ftp/python/{VER_NUM}/python-{VER_NUM}-embed-amd64.zip"
if sys.version_info.releaselevel == "candidate":
VER_NUM_RC = f"rc{sys.version_info.serial}"
else:
VER_NUM_RC = ""
EMBED_URL = f"https://www.python.org/ftp/python/{VER_NUM}/python-{VER_NUM}{VER_NUM_RC}-embed-amd64.zip"

def can_embed(tag):
"""Return False if tag doesn't match DLL_NAME and EMBED_URL.
Expand Down
8 changes: 4 additions & 4 deletions ci/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,19 @@ stages:
displayName: 'Install Nuget'

- powershell: |
nuget install python -Version 3.14.6 -x -noninteractive -o host_python
nuget install python -Version 3.15.0-rc1 -x -noninteractive -o host_python
$py = Get-Item host_python\python\tools
Write-Host "Adding $py to PATH"
Write-Host "##vso[task.prependpath]$py"
displayName: Set up Python 3.14.6
displayName: Set up Python 3.15.0rc1
workingDirectory: $(Build.BinariesDirectory)

- powershell: >
python -c "import sys;
print(sys.version);
print(sys.executable);
sys.exit(0 if sys.version_info[:5] == (3, 14, 6, 'final', 0) else 1)"
displayName: Check Python version is 3.14.6
sys.exit(0 if sys.version_info[:5] == (3, 15, 0, 'candidate', 1) else 1)"
displayName: Check Python version is 3.15.0rc1

- powershell: |
python -m pip install "pymsbuild==1.2.2"
Expand Down
15 changes: 15 additions & 0 deletions src/manage/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
################################################################################
# HACK: Work around gh-148750 in 3.15
# In short, encodings is now partially frozen, which means its submodules can
# only be loaded if they are also frozen or if they are in their default
# location relative to the executable. For embedded runtimes, this is not true,
# so we need to patch the __path__ to point at our expected location.
# This code is very fragile and should not be reused.
import sys
import encodings
for p in sys.path:
if p.endswith(".zip"):
encodings.__path__[:] = [f"{p}\\encodings"]
break
################################################################################

from .exceptions import (
ArgumentError,
AutomaticInstallDisabledError,
Expand Down
5 changes: 2 additions & 3 deletions src/manage/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,10 +472,9 @@ def __init__(self, args, root=None):

if not self.default_platform:
from _native import get_processor_architecture
LOGGER.debug("Get CPU architecture, its prefix is %s", get_processor_architecture())
self.default_platform = get_processor_architecture()
LOGGER.debug("Default to current CPU architecture: %s", self.default_platform)

# Currently, we always default to -64.
self.default_platform = "-64"

# If our command has any config, load them to override anything that
# wasn't set on the command line.
Expand Down
4 changes: 2 additions & 2 deletions src/manage/firstrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,9 +413,9 @@ def first_run(cmd):
LOGGER.print("!Y!The global shortcuts directory is not "
"configured.!W!", level=logging.WARN)
LOGGER.print("\nConfiguring this enables commands like "
"!B!python3.14.exe!W! to run from your terminal, "
"!B!python3.15.exe!W! to run from your terminal, "
"but is not needed for the !B!python!W! or !B!py!W! "
"commands (for example, !B!py -V:3.14!W!).",
"commands (for example, !B!py -V:3.15!W!).",
wrap=True)
LOGGER.print("\nWe can add the directory (!B!%s!W!) to PATH now, "
"but you will need to restart your terminal to use "
Expand Down
10 changes: 10 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@
_native.coinitialize()


################################################################################
# HACK: Work around gh-148750 in 3.15
import encodings
_orig_encodings_path = encodings.__path__[:]
import manage
# Importing manage has changed this value because of our hack
encodings.__path__[:] = _orig_encodings_path
################################################################################


# Importing in order carefully to ensure the variables we override are handled
# correctly by submodules.
import manage
Expand Down