Skip to content

Commit 40c8189

Browse files
committed
Merge branch 'main' into improve-csv
2 parents 4a8a77f + ffcd936 commit 40c8189

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+3638
-465
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: Ask a question
3+
about: Not sure it's a bug? Ask us here
4+
title: ''
5+
labels: question
6+
assignees: ''
7+
8+
---
9+
10+
# Background
11+
12+
Please let us know how you installed the Python install manager, and/or what you are trying to do. A lot of questions are answered at https://docs.python.org/dev/using/windows.html.
13+
14+
# Details
15+
16+
Any more details about what you've tried, what you expected to happen, or what you would like to see.
17+
18+
Got logs? (Check your `%TEMP%` directory.) Drag-and-drop files to attach them here, or paste relevant output in a code block.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Additional context**
24+
If you have log files (check your `%TEMP%` directory!), drag-and-drop them here to include them.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/workflows/build.yml

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,33 @@ jobs:
3030
}
3131
shell: powershell
3232

33-
- name: Set up Python 3.14
34-
uses: actions/setup-python@v5
35-
with:
36-
python-version: 3.14-dev
33+
#- name: Set up Python 3.14
34+
# uses: actions/setup-python@v5
35+
# with:
36+
# python-version: 3.14-dev
37+
38+
# We move faster than GitHub's Python runtimes, so use NuGet instead
39+
# One day we can use ourselves to download Python, but not yet...
40+
- name: Set up NuGet
41+
uses: nuget/[email protected]
42+
43+
- name: Set up Python 3.14.0b1
44+
run: |
45+
nuget install python -Version 3.14.0-b1 -x -o .
46+
$py = Get-Item python\tools
47+
Write-Host "Adding $py to PATH"
48+
"$py" | Out-File $env:GITHUB_PATH -Encoding UTF8 -Append
49+
working-directory: ${{ runner.temp }}
50+
51+
- name: Check Python version is 3.14.0b1
52+
run: >
53+
python -c "import sys;
54+
print(sys.version);
55+
print(sys.executable);
56+
sys.exit(0 if sys.version_info[:5] == (3, 14, 0, 'beta', 1) else 1)"
3757
3858
- name: Install build dependencies
39-
run: python -m pip install pymsbuild
59+
run: python -m pip install "pymsbuild>=1.2.0b1"
4060

4161
- name: 'Install test runner'
4262
run: python -m pip install pytest pytest-cov
@@ -129,6 +149,13 @@ jobs:
129149

130150
- name: 'Launch default runtime'
131151
run: pymanager exec -m site
152+
env:
153+
PYMANAGER_DEBUG: true
154+
155+
- name: 'Uninstall runtime'
156+
run: pymanager uninstall -y default
157+
env:
158+
PYMANAGER_DEBUG: true
132159

133160
- name: 'Emulate first launch'
134161
run: |
@@ -138,7 +165,7 @@ jobs:
138165
download_dir="$i\_cache";
139166
global_dir="$i\_bin";
140167
} | Out-File $env:PYTHON_MANAGER_CONFIG -Encoding utf8
141-
pymanager exec
168+
pymanager install --configure -y
142169
if ($?) { pymanager list }
143170
env:
144171
PYTHON_MANAGER_INCLUDE_UNMANAGED: false

_msbuild.py

Lines changed: 70 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
DLL_NAME = "python314"
7-
EMBED_URL = "https://www.python.org/ftp/python/3.14.0/python-3.14.0a7-embed-amd64.zip"
7+
EMBED_URL = "https://www.python.org/ftp/python/3.14.0/python-3.14.0b1-embed-amd64.zip"
88

99
def can_embed(tag):
1010
"""Return False if tag doesn't match DLL_NAME and EMBED_URL.
@@ -84,6 +84,9 @@ class ResourceFile(CSourceFile):
8484
CFunction('date_as_str'),
8585
CFunction('datetime_as_str'),
8686
CFunction('reg_rename_key'),
87+
CFunction('get_current_package'),
88+
CFunction('read_alias_package'),
89+
CFunction('broadcast_settings_change'),
8790
source='src/_native',
8891
RootNamespace='_native',
8992
)
@@ -107,6 +110,7 @@ def main_exe(name):
107110
ConfigurationType='Application',
108111
)
109112

113+
110114
def mainw_exe(name):
111115
return CProject(name,
112116
VersionInfo(FileDescription="Python Install Manager (windowed)"),
@@ -127,11 +131,60 @@ def mainw_exe(name):
127131
)
128132

129133

134+
def launcher_exe(name, platform, windowed=False):
135+
return CProject(name,
136+
VersionInfo(
137+
FileDescription="Python launcher" + (" (windowed)" if windowed else ""),
138+
OriginalFilename=f"{name}.exe"
139+
),
140+
CPP_SETTINGS,
141+
Property('StaticLibcppLinkage', 'true'),
142+
ItemDefinition('Link', SubSystem='WINDOWS' if windowed else 'CONSOLE'),
143+
Manifest('default.manifest'),
144+
ResourceFile('pywicon.rc' if windowed else 'pyicon.rc'),
145+
CSourceFile('launcher.cpp'),
146+
CSourceFile('_launch.cpp'),
147+
IncludeFile('*.h'),
148+
source='src/pymanager',
149+
ConfigurationType='Application',
150+
Platform=platform,
151+
)
152+
153+
154+
def pyshellext(ext='.exe', **props):
155+
link_opts = ItemDefinition(
156+
'Link',
157+
AdditionalDependencies=Prepend('RuntimeObject.lib;'),
158+
)
159+
if ext != '.exe':
160+
link_opts.options['ModuleDefinitionFile'] = '$(SourceRootDir)src\\pyshellext\\pyshellext.def'
161+
162+
163+
return CProject(f"pyshellext{ext.rpartition('.')[0]}",
164+
VersionInfo(
165+
FileDescription='Python shell extension',
166+
OriginalFilename=f'pyshellext{ext}',
167+
),
168+
ItemDefinition('ClCompile', LanguageStandard='stdcpp20'),
169+
link_opts,
170+
Manifest('default.manifest'),
171+
CSourceFile('shellext.cpp'),
172+
ResourceFile('pyshellext.rc'),
173+
source='src/pyshellext',
174+
StaticLibcppLinkage=True,
175+
**props,
176+
)
177+
178+
130179
PACKAGE = Package('python-manager',
131180
PyprojectTomlFile('pyproject.toml'),
132181
# MSIX manifest
133-
File('src/pymanager/appxmanifest.xml', name='appxmanifest.xml'),
134-
File('src/pymanager/pymanager.appinstaller', name='pymanager.appinstaller'),
182+
File('src/pymanager/appxmanifest.xml'),
183+
File('src/pymanager/pymanager.appinstaller'),
184+
Package(
185+
'MSIX.AppInstaller.Data',
186+
File('src/pymanager/MSIXAppInstallerData.xml'),
187+
),
135188

136189
# Default settings
137190
File('src/pymanager.json'),
@@ -146,34 +199,12 @@ def mainw_exe(name):
146199
Package(
147200
'templates',
148201
File('src/pymanager/templates/template.py'),
149-
CProject('launcher',
150-
VersionInfo(FileDescription="Python launcher", OriginalFilename="launcher.exe"),
151-
CPP_SETTINGS,
152-
Property('DynamicLibcppLinkage', 'true'),
153-
ItemDefinition('ClCompile', RuntimeLibrary='MultiThreaded'),
154-
ItemDefinition('Link', SubSystem='CONSOLE'),
155-
Manifest('default.manifest'),
156-
ResourceFile('pyicon.rc'),
157-
CSourceFile('launcher.cpp'),
158-
CSourceFile('_launch.cpp'),
159-
IncludeFile('*.h'),
160-
source='src/pymanager',
161-
ConfigurationType='Application',
162-
),
163-
CProject('launcherw',
164-
VersionInfo(FileDescription="Python launcher (windowed)", OriginalFilename="launcherw.exe"),
165-
CPP_SETTINGS,
166-
Property('DynamicLibcppLinkage', 'true'),
167-
ItemDefinition('ClCompile', RuntimeLibrary='MultiThreaded'),
168-
ItemDefinition('Link', SubSystem='WINDOWS'),
169-
Manifest('default.manifest'),
170-
ResourceFile('pywicon.rc'),
171-
CSourceFile('launcher.cpp'),
172-
CSourceFile('_launch.cpp'),
173-
IncludeFile('*.h'),
174-
source='src/pymanager',
175-
ConfigurationType='Application',
176-
),
202+
launcher_exe("launcher-64", "x64", windowed=False),
203+
launcher_exe("launcherw-64", "x64", windowed=True),
204+
launcher_exe("launcher-arm64", "ARM64", windowed=False),
205+
launcher_exe("launcherw-arm64", "ARM64", windowed=True),
206+
launcher_exe("launcher-32", "Win32", windowed=False),
207+
launcher_exe("launcherw-32", "Win32", windowed=True),
177208
),
178209

179210
# Directory for MSIX resources
@@ -202,6 +233,10 @@ def mainw_exe(name):
202233
mainw_exe("pythonw"),
203234
main_exe("python3"),
204235
mainw_exe("pythonw3"),
236+
237+
pyshellext(".exe", ConfigurationType="Application"),
238+
pyshellext("-64.dll", Platform="x64"),
239+
pyshellext("-arm64.dll", Platform="ARM64"),
205240
)
206241

207242

@@ -215,6 +250,9 @@ def get_commands():
215250
# Check if a subclass of BaseCommand
216251
if not any(b.id in command_bases for b in cls.bases):
217252
continue
253+
# Ignore exec command - it gets handled separately.
254+
if cls.name == "ExecCommand":
255+
continue
218256
command_bases.add(cls.name)
219257
for a in filter(lambda s: isinstance(s, ast.Assign), cls.body):
220258
if not any(t.id == "CMD" for t in a.targets):
@@ -300,6 +338,7 @@ def init_METADATA():
300338
fileversion = _make_xyzw_version(METADATA["Version"], ",")
301339
for vi in PACKAGE.findall("**/VersionInfo"):
302340
vi.from_metadata(METADATA)
341+
vi.options["LegalCopyright"] = "Copyright (c) Python Software Foundation. All Rights Reserved."
303342
vi.options["FILEVERSION"] = fileversion
304343

305344

_msbuild_test.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,28 @@
5050
CFunction('date_as_str'),
5151
CFunction('datetime_as_str'),
5252
CFunction('reg_rename_key'),
53+
CFunction('get_current_package'),
54+
CFunction('read_alias_package'),
55+
CFunction('broadcast_settings_change'),
5356
source='src/_native',
5457
),
58+
DllPackage('_shellext_test',
59+
PyFile('_native/__init__.py'),
60+
ItemDefinition('ClCompile',
61+
PreprocessorDefinitions=Prepend("PYSHELLEXT_TEST=1;"),
62+
LanguageStandard='stdcpp20',
63+
),
64+
ItemDefinition('Link', AdditionalDependencies=Prepend("RuntimeObject.lib;")),
65+
CSourceFile('pyshellext/shellext.cpp'),
66+
CSourceFile('pyshellext/shellext_test.cpp'),
67+
IncludeFile('pyshellext/shellext.h'),
68+
CSourceFile('_native/helpers.cpp'),
69+
IncludeFile('_native/helpers.h'),
70+
CFunction('shellext_RegReadStr'),
71+
CFunction('shellext_ReadIdleInstalls'),
72+
CFunction('shellext_ReadAllIdleInstalls'),
73+
CFunction('shellext_PassthroughTitle'),
74+
CFunction('shellext_IdleCommand'),
75+
source='src',
76+
)
5577
)

0 commit comments

Comments
 (0)