-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Packaging] Support Windows ZIP package #27911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
452a3dc
181d34b
2125e39
74aa576
fda9040
33b2cf7
79e3c18
ef1f743
d926724
72667ad
deb94ac
7ed5497
63207d3
6fa7aa4
0956882
52552df
3e6f1b5
dd0f8bc
95264cd
ac32b2d
6fb6c8e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| :: | ||
| :: Microsoft Azure CLI - Windows Installer - Author file components script | ||
| :: Copyright (C) Microsoft Corporation. All Rights Reserved. | ||
| :: | ||
|
|
||
| @IF EXIST "%~dp0\..\python.exe" ( | ||
| SET AZ_INSTALLER=ZIP | ||
| "%~dp0\..\python.exe" -IBm azure.cli %* | ||
| ) ELSE ( | ||
| echo Failed to load python executable. | ||
| exit /b 1 | ||
| ) |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -13,10 +13,15 @@ if "%CLI_VERSION%"=="" ( | |||
| echo Please set the CLI_VERSION environment variable, e.g. 2.0.13 | ||||
| goto ERROR | ||||
| ) | ||||
|
|
||||
| @REM ARCH can be x86 or x64 | ||||
| if "%ARCH%"=="" ( | ||||
| set ARCH=x86 | ||||
| ) | ||||
| @REM TARGET can be msi or zip | ||||
| if "%TARGET%"=="" ( | ||||
| set TARGET=msi | ||||
| ) | ||||
|
|
||||
| if "%ARCH%"=="x86" ( | ||||
| set PYTHON_ARCH=win32 | ||||
| ) else if "%ARCH%"=="x64" ( | ||||
|
|
@@ -71,20 +76,22 @@ if exist %REPO_ROOT%\privates ( | |||
| copy %REPO_ROOT%\privates\*.whl %TEMP_SCRATCH_FOLDER% | ||||
| ) | ||||
|
|
||||
| REM ensure wix is available | ||||
| if exist %WIX_DIR% ( | ||||
| echo Using existing Wix at %WIX_DIR% | ||||
| ) | ||||
| if not exist %WIX_DIR% ( | ||||
| mkdir %WIX_DIR% | ||||
| pushd %WIX_DIR% | ||||
| echo Downloading Wix. | ||||
| curl --output wix-archive.zip %WIX_DOWNLOAD_URL% | ||||
| unzip wix-archive.zip | ||||
| if %errorlevel% neq 0 goto ERROR | ||||
| del wix-archive.zip | ||||
| echo Wix downloaded and extracted successfully. | ||||
| popd | ||||
| if "%TARGET%" == "msi" ( | ||||
| REM ensure wix is available | ||||
| if exist %WIX_DIR% ( | ||||
| echo Using existing Wix at %WIX_DIR% | ||||
| ) | ||||
| if not exist %WIX_DIR% ( | ||||
| mkdir %WIX_DIR% | ||||
| pushd %WIX_DIR% | ||||
| echo Downloading Wix. | ||||
| curl --output wix-archive.zip %WIX_DOWNLOAD_URL% | ||||
| unzip wix-archive.zip | ||||
| if %errorlevel% neq 0 goto ERROR | ||||
| del wix-archive.zip | ||||
| echo Wix downloaded and extracted successfully. | ||||
| popd | ||||
| ) | ||||
| ) | ||||
|
|
||||
| REM ensure Python is available | ||||
|
|
@@ -122,7 +129,6 @@ set PYTHON_EXE=%PYTHON_DIR%\python.exe | |||
| robocopy %PYTHON_DIR% %BUILDING_DIR% /s /NFL /NDL | ||||
|
|
||||
| set CLI_SRC=%REPO_ROOT%\src | ||||
| %BUILDING_DIR%\python.exe -m pip install --no-warn-script-location --force-reinstall pycparser==2.18 | ||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also see #27196 (comment) |
||||
| for %%a in (%CLI_SRC%\azure-cli %CLI_SRC%\azure-cli-core %CLI_SRC%\azure-cli-telemetry) do ( | ||||
| pushd %%a | ||||
| %BUILDING_DIR%\python.exe -m pip install --no-warn-script-location --no-cache-dir --no-deps . | ||||
|
|
@@ -137,18 +143,27 @@ if %errorlevel% neq 0 goto ERROR | |||
|
|
||||
| pushd %BUILDING_DIR% | ||||
| %BUILDING_DIR%\python.exe %REPO_ROOT%\scripts\compact_aaz.py | ||||
| if %errorlevel% neq 0 goto ERROR | ||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check the error code of last command. |
||||
| %BUILDING_DIR%\python.exe %~dp0\patch_models_v2.py | ||||
| if %errorlevel% neq 0 goto ERROR | ||||
| %BUILDING_DIR%\python.exe %REPO_ROOT%\scripts\trim_sdk.py | ||||
| if %errorlevel% neq 0 goto ERROR | ||||
| popd | ||||
|
|
||||
| REM Remove pywin32 help file to reduce size. | ||||
| del %BUILDING_DIR%\Lib\site-packages\PyWin32.chm | ||||
|
|
||||
| echo Creating the wbin (Windows binaries) folder that will be added to the path... | ||||
| mkdir %BUILDING_DIR%\wbin | ||||
| copy %REPO_ROOT%\build_scripts\windows\scripts\az.cmd %BUILDING_DIR%\wbin\ | ||||
| copy %REPO_ROOT%\build_scripts\windows\scripts\azps.ps1 %BUILDING_DIR%\wbin\ | ||||
| copy %REPO_ROOT%\build_scripts\windows\scripts\az %BUILDING_DIR%\wbin\ | ||||
| if "%TARGET%"=="msi" ( | ||||
| REM Creating the wbin (Windows binaries) folder that will be added to the path... | ||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I use echo () ok
if 'kk'=='kk' (
echo () ok2
)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you truly need to use echo "Creating the wbin (Windows binaries) folder that will be added to the path..."
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exactly. (Generally, In this instance, since the line functions more as a comment, so I changed it to |
||||
| mkdir %BUILDING_DIR%\wbin | ||||
| copy %REPO_ROOT%\build_scripts\windows\scripts\az_msi.cmd %BUILDING_DIR%\wbin\az.cmd | ||||
| copy %REPO_ROOT%\build_scripts\windows\scripts\azps.ps1 %BUILDING_DIR%\wbin\ | ||||
| copy %REPO_ROOT%\build_scripts\windows\scripts\az %BUILDING_DIR%\wbin\ | ||||
| ) else ( | ||||
| REM Creating the bin folder that will be added to the path... | ||||
| mkdir %BUILDING_DIR%\bin | ||||
| copy %REPO_ROOT%\build_scripts\windows\scripts\az_zip.cmd %BUILDING_DIR%\bin\az.cmd | ||||
| ) | ||||
| if %errorlevel% neq 0 goto ERROR | ||||
| copy %REPO_ROOT%\build_scripts\windows\resources\CLI_LICENSE.rtf %BUILDING_DIR% | ||||
| copy %REPO_ROOT%\build_scripts\windows\resources\ThirdPartyNotices.txt %BUILDING_DIR% | ||||
|
|
@@ -174,6 +189,7 @@ for /f %%f in ('dir /b /s *.pyc') do ( | |||
| REM Delete __init__.pyc | ||||
| del %%~f | ||||
| ) ELSE ( | ||||
| REM pip source code is required when install packages from source code | ||||
| echo --SKIP !PARENT_DIR! under pip | ||||
| ) | ||||
| ) | ||||
|
|
@@ -193,14 +209,18 @@ for /d %%d in ("azure*.dist-info") do ( | |||
| ) | ||||
| popd | ||||
|
|
||||
| if %errorlevel% neq 0 goto ERROR | ||||
|
|
||||
| echo Building MSI... | ||||
| msbuild /t:rebuild /p:Configuration=Release /p:Platform=%ARCH% %REPO_ROOT%\build_scripts\windows\azure-cli.wixproj | ||||
| if "%TARGET%"=="msi" ( | ||||
| echo Building MSI... | ||||
| msbuild /t:rebuild /p:Configuration=Release /p:Platform=%ARCH% %REPO_ROOT%\build_scripts\windows\azure-cli.wixproj | ||||
| ) else ( | ||||
| echo Building ZIP... | ||||
| "%ProgramFiles%\7-Zip\7z.exe" a -tzip "%OUTPUT_DIR%\Microsoft Azure CLI.zip" "%BUILDING_DIR%\*" | ||||
| ) | ||||
|
|
||||
| if %errorlevel% neq 0 goto ERROR | ||||
|
|
||||
| echo %OUTPUT_DIR% | ||||
| echo Output Dir: %OUTPUT_DIR% | ||||
|
|
||||
| goto END | ||||
|
|
||||
|
|
||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
| Set-PSDebug -Trace 1 | ||
|
|
||
| Write-Output "Extracting zip to $env:SYSTEM_ARTIFACTSDIRECTORY\zip\" | ||
| & "C:\Program Files\7-Zip\7z.exe" x -o"$env:SYSTEM_ARTIFACTSDIRECTORY\zip\Azure CLI" "$env:SYSTEM_ARTIFACTSDIRECTORY\zip\Microsoft Azure CLI.zip" | ||
|
|
||
| $az_full_path = "$env:SYSTEM_ARTIFACTSDIRECTORY\zip\Azure CLI\bin\az.cmd" | ||
|
|
||
| & $az_full_path --version | ||
|
|
||
| $installed_version=& $az_full_path version --query '\"azure-cli\"' -o tsv | ||
| Write-Output "Installed version: $installed_version" | ||
|
|
||
| $artifact_version=Get-Content $env:SYSTEM_ARTIFACTSDIRECTORY\metadata\version | ||
| Write-Output "Artifact version: $artifact_version" | ||
|
|
||
| if ($installed_version -ne $artifact_version){ | ||
| Write-Output "The installed version doesn't match the artifact version." | ||
| Exit 1 | ||
| } | ||
|
|
||
| # Test bundled pip with extension installation | ||
| & $az_full_path extension add -n account | ||
| & $az_full_path self-test |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -140,6 +140,10 @@ def upgrade_version(cmd, update_all=None, yes=None, allow_preview=None): # pyli | |
| "or run 'pip install --upgrade azure-cli' in this container") | ||
| elif installer == 'MSI': | ||
| _upgrade_on_windows() | ||
| elif installer == 'ZIP': | ||
| zip_url = 'https://aka.ms/installazurecliwindowszipx64' | ||
| logger.warning("Please download the latest ZIP from %s, delete the old installation folder and extract the " | ||
| "new version to the same location", zip_url) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When extracting a folder with the same name, the default action is to merge, which can lead to unexpected issues. |
||
| else: | ||
| logger.warning(UPGRADE_MSG) | ||
| if exit_code: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree we should only release 64-bit ZIP as 32-bit is on its way to deprecation.