From a52d4977dab4b32e9f667b70b192265c407af834 Mon Sep 17 00:00:00 2001 From: robmoss2k <15984835+robmoss2k@users.noreply.github.com> Date: Tue, 10 Dec 2024 16:29:59 +0000 Subject: [PATCH 1/3] Fix copyright reading logic and zip URL generation in python3-streams --- automatic/python3-streams/update.ps1 | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/automatic/python3-streams/update.ps1 b/automatic/python3-streams/update.ps1 index 715ae807394..e368f4999cf 100644 --- a/automatic/python3-streams/update.ps1 +++ b/automatic/python3-streams/update.ps1 @@ -54,7 +54,7 @@ function SetCopyright { (1..5) | ForEach-Object {$reader.ReadLine()} # skip header $copyright = '' $reading_copyright = $false - while (($line = $reader.ReadLine()) -ne $null) { + while ($null -ne ($line = $reader.ReadLine())) { if (!$line) { $copyright += "`n" $reading_copyright = $false @@ -140,12 +140,8 @@ function GetStreams() { $version = Get-Version $latest_version $urls = $all_versions[$latest_version] - $zip_name = "python-$latest_version-docs-text" - if ($version.Prerelease -eq "" -or $version.Prerelease.StartsWith("rc")) { - $zip_url = "https://www.python.org/ftp/python/doc/$latest_version/$zip_name.zip" - } else { - $zip_url = "https://docs.python.org/$versionTwoPart/archives/$zip_name.zip" - } + $zip_name = "python-$versionTwoPart-docs-text" + $zip_url = "https://docs.python.org/$versionTwoPart/archives/$zip_name.zip" $license_url = "https://docs.python.org/$versionTwoPart/license.html" $streams[$versionTwoPart] = @{ URL32 = $urls['86'] From b25db7fce80afdd6774d344502889eb7a53a0086 Mon Sep 17 00:00:00 2001 From: robmoss2k <15984835+robmoss2k@users.noreply.github.com> Date: Tue, 10 Dec 2024 17:03:29 +0000 Subject: [PATCH 2/3] Older cases must be handled differently --- automatic/python3-streams/update.ps1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/automatic/python3-streams/update.ps1 b/automatic/python3-streams/update.ps1 index e368f4999cf..cd0c2ad4ba1 100644 --- a/automatic/python3-streams/update.ps1 +++ b/automatic/python3-streams/update.ps1 @@ -37,6 +37,7 @@ function global:au_SearchReplace { function SetCopyright { # download Python documentation archive + Add-Content -Path ".\log.txt" -Value "Downloading $($Latest.ZipUrl)" $webrequest = [System.Net.HttpWebRequest]::Create($Latest.ZipUrl) $response_stream = $webrequest.GetResponse().GetResponseStream() $zip = [IO.Compression.ZipArchive]::new($response_stream) @@ -140,7 +141,11 @@ function GetStreams() { $version = Get-Version $latest_version $urls = $all_versions[$latest_version] - $zip_name = "python-$versionTwoPart-docs-text" + if ($minor_version -le '12') { + $zip_name = "python-$latest_version-docs-text" + } else { + $zip_name = "python-$versionTwoPart-docs-text" + } $zip_url = "https://docs.python.org/$versionTwoPart/archives/$zip_name.zip" $license_url = "https://docs.python.org/$versionTwoPart/license.html" $streams[$versionTwoPart] = @{ From 8b7cb75730129b02e2c1c57d3c78052b7f4c0e4a Mon Sep 17 00:00:00 2001 From: robmoss2k <15984835+robmoss2k@users.noreply.github.com> Date: Mon, 16 Dec 2024 08:11:50 +0000 Subject: [PATCH 3/3] Update Python documentation download logic and adjust version check for minor version --- automatic/python3-streams/update.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/automatic/python3-streams/update.ps1 b/automatic/python3-streams/update.ps1 index cd0c2ad4ba1..3f43341dca5 100644 --- a/automatic/python3-streams/update.ps1 +++ b/automatic/python3-streams/update.ps1 @@ -37,7 +37,6 @@ function global:au_SearchReplace { function SetCopyright { # download Python documentation archive - Add-Content -Path ".\log.txt" -Value "Downloading $($Latest.ZipUrl)" $webrequest = [System.Net.HttpWebRequest]::Create($Latest.ZipUrl) $response_stream = $webrequest.GetResponse().GetResponseStream() $zip = [IO.Compression.ZipArchive]::new($response_stream) @@ -141,7 +140,7 @@ function GetStreams() { $version = Get-Version $latest_version $urls = $all_versions[$latest_version] - if ($minor_version -le '12') { + if ($minor_version -le '11') { $zip_name = "python-$latest_version-docs-text" } else { $zip_name = "python-$versionTwoPart-docs-text"