Skip to content

Commit d85e6c3

Browse files
authored
Revert "update the package namespaces for all packages in the artifact directory (Azure#37198)" (Azure#37221)
This reverts commit 00f7455.
1 parent 58ac142 commit d85e6c3

File tree

2 files changed

+26
-13
lines changed

2 files changed

+26
-13
lines changed

eng/pipelines/templates/steps/build-extended-artifacts.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ steps:
8484
filePath: $(Build.SourcesDirectory)/eng/scripts/Save-Package-Namespaces-Property.ps1
8585
arguments: >
8686
-ArtifactStagingDirectory "$(Build.ArtifactStagingDirectory)"
87+
-ArtifactsList ('${{ convertToJson(parameters.Artifacts) }}' | ConvertFrom-Json)
8788
pwsh: true
8889
workingDirectory: $(Pipeline.Workspace)
8990
displayName: Update package properties with namespaces

eng/scripts/Save-Package-Namespaces-Property.ps1

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,48 @@ The root directory of the staged artifacts. The PackageInfo files will be in the
1414
PackageInfo subdirectory. The whl files are going to be in the subdirectory which
1515
is the same as the artifact's name but artifact name in the file's name will have
1616
underscores instead of dashes.
17+
18+
.PARAMETER ArtifactsList
19+
The list of artifacts to gather namespaces for, this is only done for libraries that are
20+
producing docs.
21+
-ArtifactsList ('${{ convertToJson(parameters.Artifacts) }}' | ConvertFrom-Json)
1722
#>
1823
[CmdletBinding()]
1924
Param (
2025
[Parameter(Mandatory = $True)]
21-
[string] $ArtifactStagingDirectory
26+
[string] $ArtifactStagingDirectory,
27+
[Parameter(Mandatory=$true)]
28+
[array] $ArtifactsList
2229
)
2330

2431
$ArtifactsList = $ArtifactsList | Where-Object -Not "skipPublishDocMs"
2532

2633
. (Join-Path $PSScriptRoot ".." common scripts common.ps1)
2734

35+
if (-not $ArtifactsList) {
36+
Write-Host "ArtifactsList is empty, nothing to process. This can happen if skipPublishDocMs is set to true for all libraries being built."
37+
exit 0
38+
}
39+
2840
Write-Host "ArtifactStagingDirectory=$ArtifactStagingDirectory"
2941
if (-not (Test-Path -Path $ArtifactStagingDirectory)) {
3042
LogError "ArtifactStagingDirectory '$ArtifactStagingDirectory' does not exist."
3143
exit 1
3244
}
3345

34-
$packageInfoDirectory = Join-Path $ArtifactStagingDirectory "PackageInfo"
35-
$foundError = $false
36-
$artifacts = Get-ChildItem -Path $packageInfoDirectory -File -Filter "*.json"
37-
$artifacts | Format-Table -Property Name | Out-String | Write-Host
46+
Write-Host ""
47+
Write-Host "ArtifactsList:"
48+
$ArtifactsList | Format-Table -Property Name | Out-String | Write-Host
3849

39-
if (-not $artifacts) {
40-
Write-Host "Zero artifacts were discovered, nothing to process. This can happen if skipPublishDocMs is set to true for all libraries being built."
41-
exit 0
42-
}
50+
$packageInfoDirectory = Join-Path $ArtifactStagingDirectory "PackageInfo"
4351

44-
# by this point, the PackageInfo folder will have a json file for each artifact
45-
# we simply need to read each file, get the appropriate metadata, and add the namespaces if necessary
46-
foreach($packageInfoFile in $artifacts) {
52+
$foundError = $false
53+
# At this point the packageInfo files should have been already been created.
54+
# The only thing being done here is adding or updating namespaces for libraries
55+
# that will be producing docs.
56+
foreach($artifact in $ArtifactsList) {
4757
# Get the version from the packageInfo file
58+
$packageInfoFile = Join-Path $packageInfoDirectory "$($artifact.Name).json"
4859
Write-Host "processing $($packageInfoFile.FullName)"
4960
$packageInfo = ConvertFrom-Json (Get-Content $packageInfoFile -Raw)
5061
$version = $packageInfo.Version
@@ -58,7 +69,8 @@ foreach($packageInfoFile in $artifacts) {
5869
$WhlFile = Get-ChildItem -Path $WhlDir -File -Filter "$whlName-$version*.whl"
5970

6071
if (!(Test-Path $WhlFile -PathType Leaf)) {
61-
Write-Host "Whl file for, $($packageInfo.Name), was not found in $WhlDir. Unable to update package namespaces."
72+
LogError "Whl file for, $($packageInfo.Name), was not found in $WhlDir. Please ensure that a .whl file is being produced for the library."
73+
$foundError = $true
6274
continue
6375
}
6476
$namespaces = Get-NamespacesFromWhlFile $packageInfo.Name $version -PythonWhlFile $WhlFile

0 commit comments

Comments
 (0)