Skip to content

Commit 468a15a

Browse files
authored
bpo-34977: Add Windows App Store package (GH-10245)
1 parent c9566b8 commit 468a15a

Some content is hidden

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

52 files changed

+3082
-331
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
jobs:
2+
- job: Prebuild
3+
displayName: Pre-build checks
4+
5+
pool:
6+
vmImage: ubuntu-16.04
7+
8+
steps:
9+
- template: ./prebuild-checks.yml
10+
11+
12+
- job: Windows_Appx_Tests
13+
displayName: Windows Appx Tests
14+
dependsOn: Prebuild
15+
condition: and(succeeded(), eq(dependencies.Prebuild.outputs['tests.run'], 'true'))
16+
17+
pool:
18+
vmImage: vs2017-win2016
19+
20+
strategy:
21+
matrix:
22+
win64:
23+
arch: amd64
24+
buildOpt: '-p x64'
25+
testRunTitle: '$(Build.SourceBranchName)-win64-appx'
26+
testRunPlatform: win64
27+
maxParallel: 2
28+
29+
steps:
30+
- checkout: self
31+
clean: true
32+
fetchDepth: 5
33+
34+
- powershell: |
35+
# Relocate build outputs outside of source directory to make cleaning faster
36+
Write-Host '##vso[task.setvariable variable=Py_IntDir]$(Build.BinariesDirectory)\obj'
37+
# UNDONE: Do not build to a different directory because of broken tests
38+
Write-Host '##vso[task.setvariable variable=Py_OutDir]$(Build.SourcesDirectory)\PCbuild'
39+
Write-Host '##vso[task.setvariable variable=EXTERNAL_DIR]$(Build.BinariesDirectory)\externals'
40+
displayName: Update build locations
41+
42+
- script: PCbuild\build.bat -e $(buildOpt)
43+
displayName: 'Build CPython'
44+
45+
- script: python.bat PC\layout -vv -s "$(Build.SourcesDirectory)" -b "$(Py_OutDir)\$(arch)" -t "$(Py_IntDir)\layout-tmp-$(arch)" --copy "$(Py_IntDir)\layout-$(arch)" --precompile --preset-appx --include-tests
46+
displayName: 'Create APPX layout'
47+
48+
- script: .\python.exe -m test.pythoninfo
49+
workingDirectory: $(Py_IntDir)\layout-$(arch)
50+
displayName: 'Display build info'
51+
52+
- script: .\python.exe -m test -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0 --junit-xml="$(Build.BinariesDirectory)\test-results.xml" --tempdir "$(Py_IntDir)\tmp-$(arch)"
53+
workingDirectory: $(Py_IntDir)\layout-$(arch)
54+
displayName: 'Tests'
55+
env:
56+
PREFIX: $(Py_IntDir)\layout-$(arch)
57+
58+
- task: PublishTestResults@2
59+
displayName: 'Publish Test Results'
60+
inputs:
61+
testResultsFiles: '$(Build.BinariesDirectory)\test-results.xml'
62+
mergeTestResults: true
63+
testRunTitle: $(testRunTitle)
64+
platform: $(testRunPlatform)
65+
condition: succeededOrFailed()

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
# Specific binary files
2121
Lib/test/sndhdrdata/sndhdr.* binary
22+
PC/classicAppCompat.* binary
2223

2324
# Text files that should not be subject to eol conversion
2425
Lib/test/cjkencodings/* -text

Doc/make.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,12 @@ if not exist "%BUILDDIR%" mkdir "%BUILDDIR%"
117117

118118
if exist ..\Misc\NEWS (
119119
echo.Copying Misc\NEWS to build\NEWS
120+
if not exist build mkdir build
120121
copy ..\Misc\NEWS build\NEWS > nul
121122
) else if exist ..\Misc\NEWS.D (
122123
if defined BLURB (
123124
echo.Merging Misc/NEWS with %BLURB%
125+
if not exist build mkdir build
124126
%BLURB% merge -f build\NEWS
125127
) else (
126128
echo.No Misc/NEWS file and Blurb is not available.

Lib/test/test_pathlib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1521,7 +1521,7 @@ def test_resolve_common(self):
15211521
# resolves to 'dirB/..' first before resolving to parent of dirB.
15221522
self._check_resolve_relative(p, P(BASE, 'foo', 'in', 'spam'), False)
15231523
# Now create absolute symlinks
1524-
d = support._longpath(tempfile.mkdtemp(suffix='-dirD'))
1524+
d = support._longpath(tempfile.mkdtemp(suffix='-dirD', dir=os.getcwd()))
15251525
self.addCleanup(support.rmtree, d)
15261526
os.symlink(os.path.join(d), join('dirA', 'linkX'))
15271527
os.symlink(join('dirB'), os.path.join(d, 'linkY'))

Lib/test/test_venv.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ def test_isolation(self):
243243
self.assertIn('include-system-site-packages = %s\n' % s, data)
244244

245245
@unittest.skipUnless(can_symlink(), 'Needs symlinks')
246+
@unittest.skipIf(os.name == 'nt', 'Symlinks are never used on Windows')
246247
def test_symlinking(self):
247248
"""
248249
Test symlinking works as expected

Lib/venv/__init__.py

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,11 @@ def create(self, env_dir):
6464
self.system_site_packages = False
6565
self.create_configuration(context)
6666
self.setup_python(context)
67+
if not self.upgrade:
68+
self.setup_scripts(context)
6769
if self.with_pip:
6870
self._setup_pip(context)
6971
if not self.upgrade:
70-
self.setup_scripts(context)
7172
self.post_setup(context)
7273
if true_system_site_packages:
7374
# We had set it to False before, now
@@ -158,14 +159,6 @@ def create_configuration(self, context):
158159
f.write('include-system-site-packages = %s\n' % incl)
159160
f.write('version = %d.%d.%d\n' % sys.version_info[:3])
160161

161-
if os.name == 'nt':
162-
def include_binary(self, f):
163-
if f.endswith(('.pyd', '.dll')):
164-
result = True
165-
else:
166-
result = f.startswith('python') and f.endswith('.exe')
167-
return result
168-
169162
def symlink_or_copy(self, src, dst, relative_symlinks_ok=False):
170163
"""
171164
Try symlinking a file, and if that fails, fall back to copying.
@@ -195,9 +188,9 @@ def setup_python(self, context):
195188
binpath = context.bin_path
196189
path = context.env_exe
197190
copier = self.symlink_or_copy
198-
copier(context.executable, path)
199191
dirname = context.python_dir
200192
if os.name != 'nt':
193+
copier(context.executable, path)
201194
if not os.path.islink(path):
202195
os.chmod(path, 0o755)
203196
for suffix in ('python', 'python3'):
@@ -209,26 +202,22 @@ def setup_python(self, context):
209202
if not os.path.islink(path):
210203
os.chmod(path, 0o755)
211204
else:
212-
# See bpo-34011. When using a proper install, we should only need to
213-
# copy the top-level of DLLs.
214-
include = self.include_binary
215-
files = [f for f in os.listdir(dirname) if include(f)]
216-
for f in files:
217-
src = os.path.join(dirname, f)
218-
dst = os.path.join(binpath, f)
219-
if dst != context.env_exe: # already done, above
220-
copier(src, dst)
221-
222-
# When creating from a build directory, we continue to copy all files.
205+
# For normal cases, the venvlauncher will be copied from
206+
# our scripts folder. For builds, we need to copy it
207+
# manually.
223208
if sysconfig.is_python_build(True):
224-
subdir = 'DLLs'
225-
dirname = os.path.join(dirname, subdir)
226-
if os.path.isdir(dirname):
227-
files = [f for f in os.listdir(dirname) if include(f)]
228-
for f in files:
229-
src = os.path.join(dirname, f)
230-
dst = os.path.join(binpath, f)
231-
copier(src, dst)
209+
suffix = '.exe'
210+
if context.python_exe.lower().endswith('_d.exe'):
211+
suffix = '_d.exe'
212+
213+
src = os.path.join(dirname, "venvlauncher" + suffix)
214+
dst = os.path.join(binpath, context.python_exe)
215+
copier(src, dst)
216+
217+
src = os.path.join(dirname, "venvwlauncher" + suffix)
218+
dst = os.path.join(binpath, "pythonw" + suffix)
219+
copier(src, dst)
220+
232221
# copy init.tcl over
233222
for root, dirs, files in os.walk(context.python_dir):
234223
if 'init.tcl' in files:
@@ -326,7 +315,7 @@ def install_scripts(self, context, path):
326315
dstfile = os.path.join(dstdir, f)
327316
with open(srcfile, 'rb') as f:
328317
data = f.read()
329-
if not srcfile.endswith('.exe'):
318+
if not srcfile.endswith(('.exe', '.pdb')):
330319
try:
331320
data = data.decode('utf-8')
332321
data = self.replace_variables(data, context)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Adds support for building a Windows App Store package

PC/classicAppCompat.can.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<CustomCapabilityDescriptor xmlns="http://schemas.microsoft.com/appx/2016/sccd" xmlns:s="http://schemas.microsoft.com/appx/2016/sccd"><CustomCapabilities><CustomCapability Name="Microsoft.classicAppCompat_8wekyb3d8bbwe"></CustomCapability></CustomCapabilities><AuthorizedEntities><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.14_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.15_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.14_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.15_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity></AuthorizedEntities></CustomCapabilityDescriptor>

PC/classicAppCompat.cat

10.7 KB
Binary file not shown.

PC/classicAppCompat.sccd

Lines changed: 28 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)