Skip to content

Commit 147153e

Browse files
committed
Simplify packing
1 parent 1ac5ce5 commit 147153e

File tree

5 files changed

+87
-112
lines changed

5 files changed

+87
-112
lines changed

windows-release/azure-pipelines.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,6 @@ stages:
183183
${{ if eq(parameters.SignNuget, 'true') }}:
184184
SigningCertificate: ${{ parameters.SigningCertificate }}
185185
DoFreethreaded: ${{ parameters.DoFreethreaded }}
186-
- template: stage-pack-pymanager.yml
187-
parameters:
188-
${{ if and(parameters.SigningCertificate, ne(parameters.SigningCertificate, 'Unsigned')) }}:
189-
SigningCertificate: ${{ parameters.SigningCertificate }}
190-
DoFreethreaded: ${{ parameters.DoFreethreaded }}
191-
DoEmbed: ${{ parameters.DoEmbed }}
192186

193187
- stage: Test
194188
dependsOn: Pack

windows-release/merge-and-upload.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,11 @@ def purge(url):
151151

152152

153153
def calculate_uploads():
154-
for p in sorted(Path().absolute().glob("__install__.*.json")):
154+
for p in sorted(Path().absolute().iterdir()):
155+
p /= "__install__.json"
156+
if not p.is_file():
157+
continue
158+
print("Processing", p)
155159
i = json.loads(p.read_bytes())
156160
u = urlparse(i["url"])
157161
src = Path(u.path.rpartition("/")[-1]).absolute()

windows-release/stage-layout-pymanager.yml

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,26 @@ jobs:
3939
IncludeDoc: true
4040
${{ if eq(parameters.ARM64TclTk, 'true') }}:
4141
TclLibrary: tcltk_lib_arm64\tcl8
42+
win32_test:
43+
Name: win32_test
44+
Arch: win32
45+
TclLibrary: tcltk_lib_win32\tcl8
46+
LayoutOptions: '--preset-pymanager-test'
47+
IncludeDoc: true
48+
amd64_test:
49+
Name: amd64_test
50+
Arch: amd64
51+
TclLibrary: tcltk_lib_amd64\tcl8
52+
LayoutOptions: '--preset-pymanager-test'
53+
IncludeDoc: true
54+
arm64_test:
55+
Name: arm64_test
56+
Arch: arm64
57+
HostArch: amd64
58+
LayoutOptions: '--preset-pymanager-test'
59+
IncludeDoc: true
60+
${{ if eq(parameters.ARM64TclTk, 'true') }}:
61+
TclLibrary: tcltk_lib_arm64\tcl8
4262
${{ if eq(parameters.DoFreethreaded, 'true') }}:
4363
win32_t:
4464
Name: win32_t
@@ -80,6 +100,9 @@ jobs:
80100

81101
steps:
82102
- template: ./checkout.yml
103+
parameters:
104+
IncludeSelf: true
105+
Path: $(Build.SourcesDirectory)\cpython
83106

84107
- download: current
85108
artifact: bin_$(Name)
@@ -103,14 +126,44 @@ jobs:
103126
- powershell: |
104127
copy "$(Pipeline.Workspace)\bin_$(Name)\Activate.ps1" Lib\venv\scripts\common\Activate.ps1 -Force
105128
displayName: 'Copy signed files into sources'
129+
workingDirectory: $(Build.SourcesDirectory)\cpython
106130
condition: and(succeeded(), variables['SigningCertificate'])
107131
108132
- template: ./layout-command.yml
133+
parameters:
134+
Sources: $(Build.SourcesDirectory)\cpython
109135

110-
- powershell: |
111-
$(LayoutCmd) --copy "$(Build.ArtifactStagingDirectory)\layout" $(LayoutOptions)
136+
- powershell: >
137+
$(LayoutCmd)
138+
--copy "$(Build.ArtifactStagingDirectory)\layout"
139+
--zip "$(Build.ArtifactStagingDirectory)\zip\package.zip"
140+
$(LayoutOptions)
112141
displayName: 'Generate PyManager layout'
113142
143+
- powershell: |
144+
# ConvertFrom-Json can't handle empty keys, but we don't need them anyway.
145+
# Replace with an underscore so it can load.
146+
$install = (gc -raw "layout\__install__.json") -replace '"":', '"_":' | ConvertFrom-Json
147+
# Bring a copy of the install data separate from the ZIP
148+
copy "layout\__install__.json" "zip\__install__.json"
149+
# Rename the ZIP to match the target filename
150+
# (which we didn't know when we named it package.zip)
151+
$filename = Split-Path -Leaf $install.url
152+
move "zip\package.zip" "zip\$filename"
153+
displayName: 'Prepare PyManager distribution files'
154+
workingDirectory: $(Build.ArtifactStagingDirectory)
155+
156+
- powershell: >
157+
& $(Python) "$(Build.SourcesDirectory)\release-tools\sbom.py"
158+
"--cpython-source-dir=$(Build.SourcesDirectory)\cpython"
159+
$(gci "zip\*.zip")
160+
workingDirectory: $(Build.ArtifactStagingDirectory)
161+
displayName: 'Create SBOMs for package'
162+
114163
- publish: '$(Build.ArtifactStagingDirectory)\layout'
115164
artifact: layout_pymanager_$(Name)
116165
displayName: 'Publish Artifact: layout_pymanager_$(Name)'
166+
167+
- publish: '$(Build.ArtifactStagingDirectory)\zip'
168+
artifact: pymanager_$(Name)
169+
displayName: 'Publish Artifact: pymanager_$(Name)'

windows-release/stage-pack-pymanager.yml

Lines changed: 0 additions & 68 deletions
This file was deleted.

windows-release/stage-publish-pymanager.yml

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
parameters:
22
BuildToPublish: ''
33
HashAlgorithms: ['SHA256']
4-
FeedPath: 'srv/ftp/download/__index_windows__.json'
54

65
jobs:
7-
- job: Publish_Python
8-
displayName: Publish python.org packages
9-
condition: and(succeeded(), eq(variables['DoMSI'], 'true'), eq(variables['DoEmbed'], 'true'), ne(variables['SkipPythonOrgPublish'], 'true'))
6+
- job: Publish_PyManager
7+
displayName: Publish PyManager packages to python.org
8+
condition: and(succeeded(), ne(variables['SkipPythonOrgPublish'], 'true'))
109

1110
pool:
1211
vmImage: windows-2022
@@ -24,29 +23,23 @@ jobs:
2423
versionSpec: '>=3.10'
2524

2625
- ${{ if parameters.BuildToPublish }}:
27-
- task: DownloadPipelineArtifact@1
28-
displayName: 'Download artifact from ${{ parameters.BuildToPublish }}: pymanager'
29-
inputs:
30-
artifactName: pymanager
31-
targetPath: $(Build.BinariesDirectory)
32-
buildType: specific
33-
project: $(System.TeamProject)
34-
pipeline: $(Build.DefinitionName)
35-
buildVersionToDownload: specific
36-
buildId: ${{ parameters.BuildToPublish }}
26+
- ${{ each Name in variables.artifacts }}:
27+
- task: DownloadPipelineArtifact@1
28+
displayName: 'Download artifact from ${{ parameters.BuildToPublish}}: pymanager_${{ Name }}'
29+
inputs:
30+
artifactName: pymanager_${{ Name }}
31+
targetPath: $(Pipeline.Workspace)
32+
buildType: specific
33+
project: $(System.TeamProject)
34+
pipeline: $(Build.DefinitionName)
35+
buildVersionToDownload: specific
36+
buildId: ${{ parameters.BuildToPublish }}
3737

3838
- ${{ else }}:
39-
- task: DownloadPipelineArtifact@1
40-
displayName: 'Download artifact: pymanager'
41-
inputs:
42-
artifactName: pymanager
43-
targetPath: $(Build.BinariesDirectory)
44-
45-
# Note that ARM64 MSIs are skipped at build when this option is specified
46-
- powershell: 'gci *embed-arm*.zip | %{ Write-Host "Not publishing: $($_.Name)"; gi $_ } | del'
47-
displayName: 'Prevent publishing ARM64 packages'
48-
workingDirectory: '$(Build.BinariesDirectory)\pymanager'
49-
condition: and(succeeded(), ne(variables['PublishARM64'], 'true'))
39+
- ${{ each Name in variables.artifacts }}:
40+
- download: current
41+
artifact: pymanager_${{ Name }}
42+
displayName: 'Download artifact: pymanager_${{ Name }}'
5043

5144

5245
- task: DownloadSecureFile@1
@@ -56,25 +49,24 @@ jobs:
5649
displayName: 'Download PuTTY key'
5750

5851
- powershell: |
59-
"Uploading following files:"
60-
dir *
52+
"Uploading following packages:"
53+
dir "*\__install__.json"
6154
python merge-and-upload.py
62-
workingDirectory: $(Build.BinariesDirectory)
55+
workingDirectory: $(Pipeline.Workspace)
6356
displayName: 'Upload ZIPs'
6457
env:
65-
UPLOAD_URL_PREFIX: 'https://www.python.org/ftp/'
66-
UPLOAD_PATH_PREFIX: '/srv/www.python.org/ftp/'
67-
INDEX_URL: 'https://www.python.org/ftp/python/__index_windows__.json'
68-
INDEX_PATH: ${{ parameters.FeedPath }}
58+
INDEX_URL: '$(PyDotOrgUrlPrefix)python/__index_windows__.json'
6959
INDEX_FILE: '$(Build.ArtifactStagingDirectory)\index\__index__.json'
60+
UPLOAD_URL_PREFIX: $(PyDotOrgUrlPrefix)
61+
UPLOAD_PATH_PREFIX: $(PyDotOrgUploadPathPrefix)
7062
UPLOAD_HOST: $(PyDotOrgServer)
7163
UPLOAD_HOST_KEY: $(PyDotOrgHostKey)
72-
UPLOAD_KEYFILE: $(sshkey.secureFilePath)
7364
UPLOAD_USER: $(PyDotOrgUsername)
65+
UPLOAD_KEYFILE: $(sshkey.secureFilePath)
7466
7567
- ${{ each alg in parameters.HashAlgorithms }}:
7668
- powershell: |
77-
$files = gci -File "*.zip"
69+
$files = (dir "*\__install__.json").Directory | %{ dir -File "$_\*.zip" }
7870
$hashes = $files | `
7971
Sort-Object Name | `
8072
Format-Table Name, @{
@@ -85,7 +77,7 @@ jobs:
8577
$d = mkdir "$(Build.ArtifactStagingDirectory)\hashes" -Force
8678
$hashes | Out-File "$d\hashes.txt" -Encoding ascii -Append
8779
$hashes
88-
workingDirectory: $(Build.BinariesDirectory)
80+
workingDirectory: $(Pipeline.Workspace)
8981
displayName: 'Generate hashes (${{ alg }})'
9082
9183
- publish: '$(Build.ArtifactStagingDirectory)\index'

0 commit comments

Comments
 (0)