8000 Improved flexibility for PyManager package builds (#239) · python/release-tools@c652cd3 · GitHub
[go: up one dir, main page]

Skip t 8000 o content

Commit c652cd3

Browse files
authored
Improved flexibility for PyManager package builds (#239)
1 parent b68a2d3 commit c652cd3

File tree

5 files changed

+30
-4
lines changed

5 files changed

+30
-4
lines changed

windows-release/merge-and-upload.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ def purge(url):
155155
if not UPLOAD_HOST or NO_UPLOAD:
156156
print("Skipping purge of", url, "because UPLOAD_HOST is missing")
157157
return
158+
print("Purging", url)
158159
with urlopen(Request(url, method="PURGE", headers={"Fastly-Soft-Purge": 1})) as r:
159160
r.read()
160161

@@ -302,7 +303,15 @@ def install_sortkey(install):
302303
upload_ssh(MANIFEST_FILE, MANIFEST_PATH)
303304

304305
print("Purging", len(UPLOADS), "uploaded files")
306+
parents = set()
305307
for i, *_ in UPLOADS:
306308
purge(i["url"])
309+
parents.add(i["url"].rpartition("/")[0] + "/")
310+
for i in parents:
311+
purge(i)
307312
if INDEX_URL:
308313
purge(INDEX_URL)
314+
purge(INDEX_URL.rpartition("/")[0] + "/")
315+
if MANIFEST_URL:
316+
purge(MANIFEST_URL)
317+
purge(MANIFEST_URL.rpartition("/")[0] + "/")

windows-release/msi-steps.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,15 @@ steps:
131131
"--cpython-source-dir=$(Build.SourcesDirectory)"
132132
$(gci -r "$(Build.ArtifactStagingDirectory)\msi\**\python-*.exe")
133133
workingDirectory: $(Build.BinariesDirectory)
134+
condition: and(succeeded(), not(variables['SkipSBOM']))
134135
displayName: 'Create SBOMs for binaries'
135136
env:
136137
PYTHON: $(Build.BinariesDirectory)\win32\python.exe
137138
PYTHONHOME: $(Build.SourcesDirectory)
138139
139140
- task: CopyFiles@2
140141
displayName: 'Layout Artifact: sbom'
142+
condition: and(succeeded(), not(variables['SkipSBOM']))
141143
inputs:
142144
sourceFolder: $(Build.ArtifactStagingDirectory)\msi
143145
targetFolder: $(Build.ArtifactStagingDirectory)\sbom
@@ -152,6 +154,7 @@ steps:
152154

153155
- task: PublishBuildArtifacts@1
154156
displayName: 'Publish Artifact: sbom'
157+
condition: and(succeeded(), not(variables['SkipSBOM']))
155158
inputs:
156159
PathtoPublish: '$(Build.ArtifactStagingDirectory)\sbom'
157160
ArtifactName: sbom

windows-release/stage-layout-embed.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ jobs:
7272
"--cpython-source-dir=$(Build.SourcesDirectory)"
7373
"$(Build.ArtifactStagingDirectory)\embed\python-$(VersionText)-embed-$(Name).zip"
7474
workingDirectory: $(Build.BinariesDirectory)
75+
condition: and(succeeded(), not(variables['SkipSBOM']))
7576
displayName: 'Create SBOMs for binaries'
7677
7778
- task: CopyFiles@2

windows-release/stage-layout-pymanager.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ jobs:
215215
"--cpython-source-dir=$(Build.SourcesDirectory)\cpython"
216216
$(gci "zip\*.zip")
217217
workingDirectory: $(Build.ArtifactStagingDirectory)
218+
condition: and(succeeded(), not(variables['SkipSBOM']))
218219
displayName: 'Create SBOMs for package'
219220
220221
- publish: '$(Build.ArtifactStagingDirectory)\layout'

windows-release/stage-publish-pymanager.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ jobs:
7272
workingDirectory: $(Pipeline.Workspace)
7373
displayName: 'Download PuTTY binaries'
7474
75+
- powershell: |
76+
if ($env:FILENAME) {
77+
"##vso[task.setvariable variable=_PyManagerIndexFilename]${env:FILENAME}"
78+
"Updating index named '${env:FILENAME}'"
79+
} else {
80+
"##vso[task.setvariable variable=_PyManagerIndexFilename]index-windows.json"
81+
"Updating index named 'index-windows.json'"
82+
}
83+
env:
84+
FILENAME: $(PyManagerIndexFilename)
85+
displayName: 'Infer index filename'
86+
7587
- powershell: |
7688
"Uploading following packages:"
7789
(dir "__install__.*.json").FullName
@@ -82,8 +94,8 @@ jobs:
8294
displayName: 'Produce uploadable ZIPs'
8395
env:
8496
NO_UPLOAD: 1
85-
INDEX_URL: '$(PyDotOrgUrlPrefix)python/index-windows.json'
86-
INDEX_FILE: '$(Build.ArtifactStagingDirectory)\index\index-windows.json'
97+
INDEX_URL: '$(PyDotOrgUrlPrefix)python/$(_PyManagerIndexFilename)'
98+
INDEX_FILE: '$(Build.ArtifactStagingDirectory)\index\$(_PyManagerIndexFilename)'
8799
MANIFEST_FILE: '$(Build.ArtifactStagingDirectory)\index\windows.json'
88100
89101
- powershell: |
@@ -95,8 +107,8 @@ jobs:
95107
condition: and(succeeded(), eq(variables['IsRealSigned'], 'true'))
96108
displayName: 'Upload ZIPs'
97109
env:
98-
INDEX_URL: '$(PyDotOrgUrlPrefix)python/index-windows.json'
99-
INDEX_FILE: '$(Build.ArtifactStagingDirectory)\index\index-windows.json'
110+
INDEX_URL: '$(PyDotOrgUrlPrefix)python/$(_PyManagerIndexFilename)'
111+
INDEX_FILE: '$(Build.ArtifactStagingDirectory)\index\$(_PyManagerIndexFilename)'
100112
MANIFEST_FILE: '$(Build.ArtifactStagingDirectory)\index\windows.json'
101113
UPLOAD_URL_PREFIX: $(PyDotOrgUrlPrefix)
102114
UPLOAD_PATH_PREFIX: $(PyDotOrgUploadPathPrefix)

0 commit comments

Comments
 (0)
0