-
Notifications
You must be signed in to change notification settings - Fork 3.4k
{Packaging/RPM} Remove unused *.pyo and *.pyc in RPM #14288
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 13 commits
e6032a2
7328085
79858ec
507274a
f4bf0fd
92419d0
3b621af
1179438
da68d09
ac35f36
0f06480
85e13c0
b076c27
1bee368
363bd8f
ee39b7d
55bd44a
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,21 @@ | ||
| # Prerequisites: | ||
| # 1. Install the MSI built with current branch | ||
| # 2. Run bash azure-cli\scripts\ci\build.sh with Git Bash first to generate artifacts under azure-cli\artifacts\build so we can use the testsdk and fulltest wheels. | ||
|
|
||
| # Elevate to Admin | ||
| If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) | ||
| { | ||
| $arguments = "& '" + $myinvocation.mycommand.definition + "'" | ||
| Start-Process powershell -Verb runAs -ArgumentList $arguments | ||
| } | ||
|
|
||
| & 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe' -m pip install pytest | ||
| & 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe' -m pip install pytest-xdist | ||
|
|
||
| $testsdk = Get-ChildItem -Path $PSScriptRoot\..\..\..\artifacts\build\azure_cli_testsdk*.whl | Select-Object Name | ||
| & 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe' -m pip install $testsdk.Name | ||
|
|
||
| $fulltest = Get-ChildItem -Path $PSScriptRoot\..\..\..\artifacts\build\azure_cli_fulltest*.whl | Select-Object Name | ||
| & 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe' -m pip install $fulltest.Name | ||
|
|
||
| & 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe' $PSScriptRoot\test_msi_package.py |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| # Invoke this script in Powershell with: | ||
| # & 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe' test_msi_package.py | ||
|
|
||
| import os | ||
| import sys | ||
| import subprocess | ||
|
|
||
| root_dir = 'C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\CLI2\\Lib\\site-packages\\azure\\cli\\command_modules' | ||
|
|
||
| mod_list = [mod for mod in sorted(os.listdir(root_dir)) if os.path.isdir(os.path.join(root_dir, mod)) and mod != '__pycache__'] | ||
|
|
||
| for mod_name in mod_list: | ||
| exit_code = subprocess.call(['python', '-m', 'pytest', '-x', '-v', '-p', 'no:warnings', '--log-level', 'WARN', | ||
| '--junit-xml', '{}\\azure_cli_test_result\\{}.xml'.format(os.path.expanduser('~'), mod_name), '-n', 'auto', '--pyargs', 'azure.cli.command_modules.{}'.format(mod_name)]) | ||
| if exit_code != 0 and exit_code != 5: # exit code is 5 when there is no tests collected in the module | ||
| sys.exit(exit_code) | ||
|
|
||
| exit_code = subprocess.call(['python', '-m', 'pytest', '-x', '-v', '-p', 'no:warnings', '--log-level', 'WARN', | ||
| '--junit-xml', '{}\\azure_cli_test_result\\azure-cli-core.xml'.format(os.path.expanduser('~')), '-n', 'auto', '--pyargs', 'azure.cli.core', '--import-mode=append']) | ||
| sys.exit(exit_code) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,10 @@ | ||
| # RPM spec file for Azure CLI | ||
| # Definition of macros used - https://fedoraproject.org/wiki/Packaging:RPMMacros?rd=Packaging/RPMMacros | ||
|
|
||
| %global __python %{__python3} | ||
| # Turn off python byte compilation | ||
|
fengzhou-msft marked this conversation as resolved.
|
||
| %global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') | ||
|
Member
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. Based on the instruction from the Fedora Packaging Guideline. |
||
|
|
||
| # .el7.centos -> .el7 | ||
| %if 0%{?rhel} | ||
| %define dist .el%{?rhel} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # This script should be run in a centos8 docker. | ||
| set -exv | ||
|
|
||
| yum --nogpgcheck localinstall /mnt/yum/$YUM_NAME -y | ||
|
|
||
| yum install git -y | ||
|
|
||
| ln -s /usr/bin/python3 /usr/bin/python | ||
| ln -s /usr/bin/pip3 /usr/bin/pip | ||
| time az self-test | ||
| time az --version | ||
|
|
||
| cd /azure-cli/ | ||
| pip3 install wheel | ||
| ./scripts/ci/build.sh | ||
| pip3 install pytest --prefix /usr/lib64/az | ||
| pip3 install pytest-xdist --prefix /usr/lib64/az | ||
|
|
||
| find /azure-cli/artifacts/build -name "azure_cli_testsdk*" | xargs pip3 install --prefix /usr/lib64/az --upgrade --ignore-installed | ||
|
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. is it necessary to pin version also?
Member
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.
|
||
| find /azure-cli/artifacts/build -name "azure_cli_fulltest*" | xargs pip3 install --prefix /usr/lib64/az --upgrade --ignore-installed --no-deps | ||
|
|
||
| python3 /azure-cli/scripts/release/rpm/test_rpm_package.py | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| import os | ||
| import sys | ||
| import subprocess | ||
|
|
||
| root_dir = '/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules' | ||
| mod_list = [mod for mod in sorted(os.listdir(root_dir)) if os.path.isdir(os.path.join(root_dir, mod)) and mod != '__pycache__'] | ||
|
|
||
| pytest_base_cmd = 'PYTHONPATH=/usr/lib64/az/lib/python3.6/site-packages python3 -m pytest -x -v --boxed -p no:warnings --log-level=WARN' | ||
| pytest_parallel_cmd = '{} -n auto'.format(pytest_base_cmd) | ||
|
|
||
| for mod_name in mod_list: | ||
| if mod_name in ['botservice', 'network']: | ||
| exit_code = subprocess.call(['{} --junit-xml /azure_cli_test_result/{}.xml --pyargs azure.cli.command_modules.{}'.format(pytest_base_cmd, mod_name, mod_name)], shell=True) | ||
| else: | ||
| exit_code = subprocess.call(['{} --junit-xml /azure_cli_test_result/{}.xml --pyargs azure.cli.command_modules.{}'.format(pytest_parallel_cmd, mod_name, mod_name)], shell=True) | ||
| if exit_code != 0 and exit_code != 5: # exit code is 5 when there is no tests collected in the module | ||
|
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. when no tests found, it's better to at least stdout some message
Member
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. The extension module do not have tests. Extension tests are under azure-cli-core.
Member
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. Added message. |
||
| sys.exit(exit_code) | ||
|
|
||
| exit_code = subprocess.call(['{} --junit-xml /azure_cli_test_result/azure-cli-core.xml --pyargs azure.cli.core'.format(pytest_parallel_cmd)], shell=True) | ||
| sys.exit(exit_code) | ||
Uh oh!
There was an error while loading. Please reload this page.