Skip to content

Commit 670c746

Browse files
committed
Add ARM64 shell extension and conditional installation.
Fixes #50
1 parent 2e4203c commit 670c746

File tree

7 files changed

+65
-44
lines changed

7 files changed

+65
-44
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
python-version: 3.14-dev
3737

3838
- name: Install build dependencies
39-
run: python -m pip install pymsbuild
39+
run: python -m pip install "pymsbuild>=1.2.0b1"
4040

4141
- name: 'Install test runner'
4242
run: python -m pip install pytest pytest-cov

_msbuild.py

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,29 @@ def mainw_exe(name):
127127
)
128128

129129

130+
def pyshellext(platform):
131+
return CProject(f"pyshellext-{platform}",
132+
VersionInfo(
133+
FileDescription="Python shell extension",
134+
OriginalFilename=f"pyshellext.{platform}.dll",
135+
),
136+
Property('StaticLibcppLinkage', 'true'),
137+
ItemDefinition('ClCompile', LanguageStandard='stdcpp20'),
138+
ItemDefinition('Link',
139+
AdditionalDependencies=Prepend("RuntimeObject.lib;"),
140+
SubSystem='WINDOWS',
141+
ModuleDefinitionFile='$(SourceRootDir)src\\pyshellext\\pyshellext.def',
142+
),
143+
Manifest('default.manifest'),
144+
CSourceFile('shellext.cpp'),
145+
ResourceFile('pyshellext.rc'),
146+
SourceFile('pyshellext.def'),
147+
source='src/pyshellext',
148+
Platform=platform,
149+
TargetName=f"pyshellext.{platform}",
150+
)
151+
152+
130153
PACKAGE = Package('python-manager',
131154
PyprojectTomlFile('pyproject.toml'),
132155
# MSIX manifest
@@ -149,8 +172,7 @@ def mainw_exe(name):
149172
CProject('launcher',
150173
VersionInfo(FileDescription="Python launcher", OriginalFilename="launcher.exe"),
151174
CPP_SETTINGS,
152-
Property('DynamicLibcppLinkage', 'true'),
153-
ItemDefinition('ClCompile', RuntimeLibrary='MultiThreaded'),
175+
Property('StaticLibcppLinkage', 'true'),
154176
ItemDefinition('Link', SubSystem='CONSOLE'),
155177
Manifest('default.manifest'),
156178
ResourceFile('pyicon.rc'),
@@ -163,8 +185,7 @@ def mainw_exe(name):
163185
CProject('launcherw',
164186
VersionInfo(FileDescription="Python launcher (windowed)", OriginalFilename="launcherw.exe"),
165187
CPP_SETTINGS,
166-
Property('DynamicLibcppLinkage', 'true'),
167-
ItemDefinition('ClCompile', RuntimeLibrary='MultiThreaded'),
188+
Property('StaticLibcppLinkage', 'true'),
168189
ItemDefinition('Link', SubSystem='WINDOWS'),
169190
Manifest('default.manifest'),
170191
ResourceFile('pywicon.rc'),
@@ -203,27 +224,8 @@ def mainw_exe(name):
203224
main_exe("python3"),
204225
mainw_exe("pythonw3"),
205226

206-
CProject("pyshellext",
207-
VersionInfo(
208-
FileDescription="Python shell extension",
209-
OriginalFilename="pyshellext.dll",
210-
),
211-
Property('DynamicLibcppLinkage', 'true'),
212-
ItemDefinition('ClCompile',
213-
LanguageStandard='stdcpp20',
214-
RuntimeLibrary='MultiThreaded',
215-
),
216-
ItemDefinition('Link',
217-
AdditionalDependencies=Prepend("RuntimeObject.lib;"),
218-
SubSystem='WINDOWS',
219-
ModuleDefinitionFile='$(SourceRootDir)src\\pyshellext\\pyshellext.def',
220-
),
221-
Manifest('default.manifest'),
222-
CSourceFile('shellext.cpp'),
223-
ResourceFile('pyshellext.rc'),
224-
SourceFile('pyshellext.def'),
225-
source='src/pyshellext',
226-
)
227+
pyshellext("x64"),
228+
pyshellext("arm64"),
227229
)
228230

229231

ci/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ stages:
8989
workingDirectory: $(Build.BinariesDirectory)
9090
9191
- powershell: |
92-
python -m pip install pymsbuild
92+
python -m pip install "pymsbuild>=1.2.0b1"
9393
displayName: 'Install build dependencies'
9494
9595
- ${{ if eq(parameters.PreTest, 'true') }}:

make.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import subprocess
33
import sys
44
from subprocess import check_call as run
5-
from _make_helper import get_dirs, rmtree, unlink
5+
from _make_helper import copyfile, get_dirs, rmtree, unlink
66

77
# Clean DEBUG flag in case it affects build
88
os.environ["PYMANAGER_DEBUG"] = ""
@@ -42,6 +42,7 @@
4242
cwd=DIRS["root"],
4343
env={**os.environ, "BUILD_SOURCEBRANCH": ref})
4444

45+
4546
# Bundle current latest release
4647
run([LAYOUT / "py-manager.exe", "install", "-v", "-f", "--download", TEMP / "bundle", "default"])
4748
(LAYOUT / "bundled").mkdir(parents=True, exist_ok=True)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ['pymsbuild>=1.1.1,<2.0']
2+
requires = ['pymsbuild>=1.2.0b1,<2.0']
33
build-backend = "pymsbuild"
44

55
[tool.coverage.run]

src/pymanager/appxmanifest.xml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
<Package IgnorableNamespaces="desktop4 desktop6 desktop7 uap13 uap17"
33
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
44
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
5-
xmlns:com="http://schemas.microsoft.com/appx/manifest/com/windows10"
5+
xmlns:com4="http://schemas.microsoft.com/appx/manifest/com/windows10/4"
66
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
77
xmlns:rescap4="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities/4"
88
xmlns:desktop4="http://schemas.microsoft.com/appx/manifest/desktop/windows10/4"
99
xmlns:desktop6="http://schemas.microsoft.com/appx/manifest/desktop/windows10/6"
1010
xmlns:desktop7="http://schemas.microsoft.com/appx/manifest/desktop/windows10/7"
11+
xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"
1112
xmlns:uap4="http://schemas.microsoft.com/appx/manifest/uap/windows10/4"
1213
xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5"
1314
xmlns:uap13="http://schemas.microsoft.com/appx/manifest/uap/windows10/13"
1415
xmlns:uap17="http://schemas.microsoft.com/appx/manifest/uap/windows10/17">
1516
<Identity Name="PythonSoftwareFoundation.PythonManager"
1617
Version="1.0.0.0"
17-
Publisher="CN=00000000-0000-0000-0000-000000000000"
18-
ProcessorArchitecture="x64" />
18+
Publisher="CN=00000000-0000-0000-0000-000000000000" />
1919
<Properties>
2020
<DisplayName>Python Install Manager</DisplayName>
2121
<PublisherDisplayName>Python Software Foundation</PublisherDisplayName>
@@ -194,20 +194,24 @@
194194
</uap:SupportedFileTypes>
195195
</uap:FileTypeAssociation>
196196
</uap:Extension>
197-
<com:Extension Category="windows.comServer">
198-
<com:ComServer>
199-
<com:SurrogateServer AppId="C7E29CB0-9691-4DE8-B72B-6719DDC0B4A1" DisplayName="EditInIdleCommand">
200-
<com:Class Id="C7E29CB0-9691-4DE8-B72B-6719DDC0B4A1" Path="pyshellext.dll" ThreadingModel="Both"/>
201-
</com:SurrogateServer>
202-
</com:ComServer>
203-
</com:Extension>
204197
<desktop4:Extension Category="windows.fileExplorerContextMenus">
205198
<desktop4:FileExplorerContextMenus>
206199
<desktop4:ItemType Type=".py">
207200
<desktop4:Verb Id="EditInIdle" Clsid="C7E29CB0-9691-4DE8-B72B-6719DDC0B4A1" />
208201
</desktop4:ItemType>
209202
</desktop4:FileExplorerContextMenus>
210203
</desktop4:Extension>
204+
<com4:Extension Category="windows.comServer">
205+
<com4:ComServer>
206+
<com4:InProcessServer>
207+
<com4:Class Id="C7E29CB0-9691-4DE8-B72B-6719DDC0B4A1"
208+
ThreadingModel="Both"
209+
DisplayName="EditInIdleCommand" />
210+
<com4:InProcessServerDll Path="pyshellext.x64.dll" ProcessorArchitecture="x64" />
211+
<com4:InProcessServerDll Path="pyshellext.arm64.dll" ProcessorArchitecture="arm64" />
212+
</com4:InProcessServer>
213+
</com4:ComServer>
214+
</com4:Extension>
211215
</Extensions>
212216
</Application>
213217

src/pymanager/msi.wxs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
<Property Id="ARPNOMODIFY" Value="1" />
1717
<Property Id="DISABLEADVTSHORTCUTS" Value="1" />
1818

19+
<util:QueryNativeMachine />
20+
1921
<StandardDirectory Id="ProgramFiles64Folder">
2022
<Directory Id="INSTALLFOLDER" Name="PyManager">
2123
<Directory Id="RUNTIME" Name="runtime" />
@@ -27,6 +29,8 @@
2729
<ComponentRef Id="ProductComponent" />
2830
<ComponentRef Id="RuntimeComponent" />
2931
<ComponentRef Id="TemplatesComponent" />
32+
<ComponentRef Id="PyShellExt.x64" />
33+
<ComponentRef Id="PyShellExt.ARM64" />
3034
</Feature>
3135

3236
<util:BroadcastEnvironmentChange />
@@ -44,11 +48,6 @@
4448
<File Source="vcruntime140.dll" />
4549
<File Source="vcruntime140_1.dll" />
4650

47-
<File Source="pyshellext.dll">
48-
<Class Id="{C7E29CB0-9691-4DE8-B72B-6719DDC0B4A1}" Advertise="no"
49-
Context="InprocServer32" ThreadingModel="both" />
50-
</File>
51-
5251
<File Source="version.txt" />
5352
<Environment Id="PATH" Action="set" Name="PATH" Part="last" System="yes" Value="[INSTALLFOLDER]" />
5453

@@ -104,5 +103,20 @@
104103
<File Source="templates\launcherw.exe" Name="launcherw.exe" />
105104
</Component>
106105

106+
<Component Id="PyShellExt.x64" Directory="INSTALLFOLDER" Guid="0E2D4BFC-10DC-4103-B86E-58943429AE4B"
107+
Condition="WIX_NATIVE_MACHINE == 0x8664">
108+
<File Source="pyshellext.x64.dll" KeyPath="yes">
109+
<Class Id="{C7E29CB0-9691-4DE8-B72B-6719DDC0B4A1}" Advertise="no"
110+
Context="InprocServer32" ThreadingModel="both" />
111+
</File>
112+
</Component>
113+
<Component Id="PyShellExt.ARM64" Directory="INSTALLFOLDER" Guid="DB020B5A-BD1F-4443-9859-A163FCF2CA77"
114+
Condition="WIX_NATIVE_MACHINE == 0xAA64">
115+
<File Source="pyshellext.arm64.dll" KeyPath="yes">
116+
<Class Id="{C7E29CB0-9691-4DE8-B72B-6719DDC0B4A1}" Advertise="no"
117+
Context="InprocServer32" ThreadingModel="both" />
118+
</File>
119+
</Component>
120+
107121
</Package>
108122
</Wix>

0 commit comments

Comments
 (0)