Skip to content
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

{Package} Migrate CLI packaging system to PEP 420 Implicit Namespace Packages #14372

Merged
merged 78 commits into from
Aug 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
409a919
init pep420 change
arrownj Jul 13, 2020
2eaa836
fix linter error
arrownj Jul 13, 2020
13fe8e2
fix another linter error
arrownj Jul 13, 2020
8d8b52c
elegant way to handle __main__.py
arrownj Jul 15, 2020
6e23b62
remove nspkg
arrownj Jul 15, 2020
9a97ee4
refactor azure_bdist_wheel to fit wheel 0.34.2
arrownj Jul 16, 2020
b491f97
add namespace package __init__.py to sdist
arrownj Jul 16, 2020
3687e19
fix merge conflict
arrownj Jul 16, 2020
2304e2b
fix generic update problem
arrownj Jul 20, 2020
1a286fd
fix merge conflict
arrownj Jul 20, 2020
dda178c
upgrade telemetry version
arrownj Jul 21, 2020
efd134e
upgrade telemetry version
arrownj Jul 21, 2020
b8f203d
rollback some useless change
arrownj Jul 21, 2020
4d18448
build yum/deb/homebrew etx
arrownj Jul 21, 2020
c5d2930
use template to generate formula
arrownj Jul 22, 2020
c1e76ea
update build.cmd
arrownj Jul 22, 2020
0a1c170
update build scripts
arrownj Jul 22, 2020
d895720
upgrade azure-mutliapi-storage to 0.3.6
arrownj Jul 27, 2020
c8166bc
fix debian build script
arrownj Jul 27, 2020
1602765
fix merge conflict
arrownj Jul 27, 2020
09b7101
init pep420 change
arrownj Jul 13, 2020
1dc87c1
fix linter error
arrownj Jul 13, 2020
6a06121
fix another linter error
arrownj Jul 13, 2020
a16c155
elegant way to handle __main__.py
arrownj Jul 15, 2020
a61214f
remove nspkg
arrownj Jul 15, 2020
e5704c9
refactor azure_bdist_wheel to fit wheel 0.34.2
arrownj Jul 16, 2020
0a0edab
add namespace package __init__.py to sdist
arrownj Jul 16, 2020
99cb087
fix merge conflict
arrownj Jul 16, 2020
d446a63
fix generic update problem
arrownj Jul 20, 2020
7197682
fix merge conflict
arrownj Jul 20, 2020
a43aac5
upgrade telemetry version
arrownj Jul 21, 2020
ed508fa
upgrade telemetry version
arrownj Jul 21, 2020
0b73c30
rollback some useless change
arrownj Jul 21, 2020
944f72f
build yum/deb/homebrew etx
arrownj Jul 21, 2020
c348606
use template to generate formula
arrownj Jul 22, 2020
c5a3468
update build.cmd
arrownj Jul 22, 2020
ac40971
update build scripts
arrownj Jul 22, 2020
48240f0
upgrade azure-mutliapi-storage to 0.3.6
arrownj Jul 27, 2020
6bd5326
fix debian build script
arrownj Jul 27, 2020
2a486a8
fix merge conflict
arrownj Jul 27, 2020
5f65b2e
fix merge conflict
arrownj Jul 29, 2020
d004fcc
Merge branch 'another_pep420' of github.com:arrownj/azure-cli into an…
arrownj Jul 30, 2020
46bd50f
fix generic update test problem
arrownj Jul 30, 2020
2bfc20e
remove extra __init__.py
arrownj Jul 30, 2020
703c683
Merge branch 'dev' into another_pep420
arrownj Jul 30, 2020
4fcf574
remove __init__.pyc file in debian and rpm
arrownj Jul 31, 2020
53569e5
update build wheel stratages
arrownj Aug 3, 2020
36417c4
Merge branch 'dev' into another_pep420
arrownj Aug 3, 2020
4d87e27
update version
arrownj Aug 3, 2020
8206299
update build scripts
arrownj Aug 3, 2020
81fbb36
fix webapp test error
arrownj Aug 3, 2020
7f47f19
add __main__.py in sdist
arrownj Aug 3, 2020
6dbf584
Merge branch 'dev' into another_pep420
arrownj Aug 3, 2020
7cec6fb
add test homebrew package scripts
arrownj Aug 11, 2020
9dda359
Merge branch 'dev' into another_pep420
arrownj Aug 11, 2020
e3087c5
update version value in __main__.py
arrownj Aug 11, 2020
525de65
make test_homebrew_package.sh executable
arrownj Aug 11, 2020
dea113d
fix homebrew permission problem
arrownj Aug 11, 2020
22fef1e
fix error
arrownj Aug 12, 2020
1623787
skip some acr tests
arrownj Aug 13, 2020
acbdbc6
fix style error
arrownj Aug 13, 2020
6b5db1a
skip config tests
arrownj Aug 17, 2020
b254fdb
fix config test MAC error
arrownj Aug 17, 2020
866972d
fix role config test error
arrownj Aug 17, 2020
46883bc
Merge branch 'dev' into another_pep420
arrownj Aug 17, 2020
ded0f26
fix test error
arrownj Aug 17, 2020
7e2fe75
fix test error
arrownj Aug 17, 2020
16f6aff
workaround for vsts bug
arrownj Aug 17, 2020
31e7934
fix test error
arrownj Aug 17, 2020
5c2a43d
fix homebrew test error
arrownj Aug 18, 2020
fec21db
fix configure test error
arrownj Aug 18, 2020
366e22f
Merge remote-tracking branch 'upstream/dev' into another_pep420
arrownj Aug 18, 2020
b35b767
update homebrew package job timeout value
arrownj Aug 18, 2020
5ccc96c
use released azdev
arrownj Aug 19, 2020
225a8c4
Merge branch 'dev' into another_pep420
arrownj Aug 19, 2020
12403e8
rollback pipelines
arrownj Aug 19, 2020
ede06e0
rollback pipelines 2
arrownj Aug 19, 2020
320bd06
refactor config test
arrownj Aug 19, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .azure-pipelines/templates/azdev_setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ steps:
chmod +x env/bin/activate
. env/bin/activate

pip install -q azdev==0.1.24
pip install -q azdev==0.1.25
azdev --version

if [ -z "$CLI_EXT_REPO_PATH" ]; then
Expand Down
2 changes: 1 addition & 1 deletion .snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ parts:
- libssl1.0.0
requirements: requirements.txt
install: |
python_packages="src/azure-cli-core src/azure-cli-nspkg src/azure-cli-command_modules-nspkg src/command_modules/azure-cli*"
python_packages="src/azure-cli-core src/command_modules/azure-cli*"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this for building snap package?

export PYTHONUSERBASE=$SNAPCRAFT_PART_INSTALL
export PYTHONHOME=$SNAPCRAFT_PART_INSTALL/usr
echo $SNAPCRAFT_PART_INSTALL/usr/bin/python3
Expand Down
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ COPY . /azure-cli

# 1. Build packages and store in tmp dir
# 2. Install the cli and the other command modules that weren't included
# 3. Temporary fix - install azure-nspkg to remove import of pkg_resources in azure/__init__.py (to improve performance)
RUN ./scripts/install_full.sh \
&& cat /azure-cli/az.completion > ~/.bashrc \
&& runDeps="$( \
Expand Down
1 change: 0 additions & 1 deletion Dockerfile.nanoserver
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ foreach($m in $modules) \
{ \
& pip install --no-cache-dir $m; \
}\
& pip install --no-cache-dir --force-reinstall --upgrade azure-nspkg azure-mgmt-nspkg; \
Pop-Location; \
Write-Host 'Done';

Expand Down
6 changes: 2 additions & 4 deletions Dockerfile.spot
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,13 @@ COPY . /azure-cli
# jmespath-terminal - we include jpterm as a useful tool
# 1. Build packages and store in tmp dir
# 2. Install the cli and the other command modules that weren't included
# 3. Temporary fix - install azure-nspkg to remove import of pkg_resources in azure/__init__.py (to improve performance)
RUN /bin/bash -c 'TMP_PKG_DIR=$(mktemp -d); \
for d in src/azure-cli src/azure-cli-core src/azure-cli-nspkg src/azure-cli-command_modules-nspkg src/command_modules/azure-cli-*/; \
for d in src/azure-cli src/azure-cli-core src/command_modules/azure-cli-*/; \
do cd $d; echo $d; python setup.py bdist_wheel -d $TMP_PKG_DIR; cd -; \
done; \
[ -d privates ] && cp privates/*.whl $TMP_PKG_DIR; \
all_modules=`find $TMP_PKG_DIR -name "*.whl"`; \
pip install --no-cache-dir $all_modules; \
pip install --no-cache-dir --force-reinstall --upgrade azure-nspkg azure-mgmt-nspkg;' \
pip install --no-cache-dir $all_modules;' \
&& cat /azure-cli/az.completion > ~/.bashrc

WORKDIR /
Expand Down
16 changes: 0 additions & 16 deletions azure-cli.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
<VisualStudioVersion Condition=" '$(VisualStudioVersion)' == '' ">10.0</VisualStudioVersion>
</PropertyGroup>
<ItemGroup>
<Compile Include="azure-cli-command_modules-nspkg\azure\cli\command_modules\__init__.py" />
<Compile Include="azure-cli-command_modules-nspkg\setup.py" />
<Compile Include="azure-cli-core\azure\cli\core\adal_authentication.py" />
<Compile Include="azure-cli-core\azure\cli\core\azlogging.py" />
<Compile Include="azure-cli-core\azure\cli\core\cloud.py" />
Expand Down Expand Up @@ -78,8 +76,6 @@
<Compile Include="azure-cli-core\azure\cli\__init__.py" />
<Compile Include="azure-cli-core\azure\__init__.py" />
<Compile Include="azure-cli-core\setup.py" />
<Compile Include="azure-cli-nspkg\azure\cli\__init__.py" />
<Compile Include="azure-cli-nspkg\setup.py" />
<Compile Include="azure-cli-testsdk\azure\cli\testsdk\base.py" />
<Compile Include="azure-cli-testsdk\azure\cli\testsdk\checkers.py" />
<Compile Include="azure-cli-testsdk\azure\cli\testsdk\decorators.py" />
Expand Down Expand Up @@ -785,10 +781,6 @@
<Compile Include="command_modules\azure-cli-vm\setup.py" />
</ItemGroup>
<ItemGroup>
<Folder Include="azure-cli-command_modules-nspkg\" />
<Folder Include="azure-cli-command_modules-nspkg\azure\" />
<Folder Include="azure-cli-command_modules-nspkg\azure\cli\" />
<Folder Include="azure-cli-command_modules-nspkg\azure\cli\command_modules\" />
<Folder Include="azure-cli-core\" />
<Folder Include="azure-cli-core\azure\" />
<Folder Include="azure-cli-core\azure\cli\" />
Expand All @@ -797,9 +789,6 @@
<Folder Include="azure-cli-core\azure\cli\core\extensions\" />
<Folder Include="azure-cli-core\azure\cli\core\profiles\" />
<Folder Include="azure-cli-core\azure\cli\core\tests\" />
<Folder Include="azure-cli-nspkg\" />
<Folder Include="azure-cli-nspkg\azure\" />
<Folder Include="azure-cli-nspkg\azure\cli\" />
<Folder Include="azure-cli-testsdk\" />
<Folder Include="azure-cli-testsdk\azure\" />
<Folder Include="azure-cli-testsdk\azure\cli\" />
Expand Down Expand Up @@ -1130,13 +1119,8 @@
<Folder Include="command_modules\azure-cli-kusto\" />
</ItemGroup>
<ItemGroup>
<Content Include="azure-cli-command_modules-nspkg\HISTORY.rst" />
<Content Include="azure-cli-command_modules-nspkg\MANIFEST.in" />
<Content Include="azure-cli-command_modules-nspkg\README.rst" />
<Content Include="azure-cli-command_modules-nspkg\setup.cfg" />
<Content Include="azure-cli-core\HISTORY.rst" />
<Content Include="azure-cli-core\setup.cfg" />
<Content Include="azure-cli-nspkg\HISTORY.rst" />
<Content Include="azure-cli-testsdk\HISTORY.rst" />
<Content Include="azure-cli-testsdk\setup.cfg" />
<Content Include="azure-cli\az.completion.sh" />
Expand Down
17 changes: 0 additions & 17 deletions azure-cli2017.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
<VisualStudioVersion Condition=" '$(VisualStudioVersion)' == '' ">10.0</VisualStudioVersion>
</PropertyGroup>
<ItemGroup>
<Compile Include="azure-cli-command_modules-nspkg\azure\cli\command_modules\__init__.py" />
<Compile Include="azure-cli-command_modules-nspkg\setup.py" />
<Compile Include="azure-cli-core\azure\cli\core\adal_authentication.py" />
<Compile Include="azure-cli-core\azure\cli\core\api.py" />
<Compile Include="azure-cli-core\azure\cli\core\azlogging.py" />
Expand Down Expand Up @@ -90,8 +88,6 @@
<Compile Include="azure-cli-core\azure\cli\core\telemetry.py" />
<Compile Include="azure-cli-core\azure\cli\core\__init__.py" />
<Compile Include="azure-cli-core\setup.py" />
<Compile Include="azure-cli-nspkg\azure\cli\__init__.py" />
<Compile Include="azure-cli-nspkg\setup.py" />
<Compile Include="azure-cli-telemetry\azure\cli\telemetry\components\records_collection.py" />
<Compile Include="azure-cli-telemetry\azure\cli\telemetry\components\records_collection.py" />
<Compile Include="azure-cli-telemetry\azure\cli\telemetry\components\telemetry_client.py" />
Expand Down Expand Up @@ -980,10 +976,6 @@
<Compile Include="azure-cli\setup.py" />
</ItemGroup>
<ItemGroup>
<Folder Include="azure-cli-command_modules-nspkg\" />
<Folder Include="azure-cli-command_modules-nspkg\azure\" />
<Folder Include="azure-cli-command_modules-nspkg\azure\cli\" />
<Folder Include="azure-cli-command_modules-nspkg\azure\cli\command_modules\" />
<Folder Include="azure-cli-core\" />
<Folder Include="azure-cli-core\azure\" />
<Folder Include="azure-cli-core\azure\cli\" />
Expand All @@ -997,9 +989,6 @@
<Folder Include="azure-cli-core\azure\cli\core\profiles\" />
<Folder Include="azure-cli-core\azure\cli\core\tests\" />
<Folder Include="azure-cli-core\azure\cli\core\tests\data\" />
<Folder Include="azure-cli-nspkg\" />
<Folder Include="azure-cli-nspkg\azure\" />
<Folder Include="azure-cli-nspkg\azure\cli\" />
<Folder Include="azure-cli-telemetry\" />
<Folder Include="azure-cli-telemetry\azure\" />
<Folder Include="azure-cli-telemetry\azure\" />
Expand Down Expand Up @@ -1217,10 +1206,6 @@
<Folder Include="azure-cli\azure\cli\command_modules\vm\tests\latest\keyvault\" />
</ItemGroup>
<ItemGroup>
<Content Include="azure-cli-command_modules-nspkg\HISTORY.rst" />
<Content Include="azure-cli-command_modules-nspkg\MANIFEST.in" />
<Content Include="azure-cli-command_modules-nspkg\README.rst" />
<Content Include="azure-cli-command_modules-nspkg\setup.cfg" />
<Content Include="azure-cli-core\azure\cli\core\auth_landing_pages\fail.html" />
<Content Include="azure-cli-core\azure\cli\core\auth_landing_pages\fail.html" />
<Content Include="azure-cli-core\azure\cli\core\auth_landing_pages\ok.html" />
Expand All @@ -1234,8 +1219,6 @@
<Content Include="azure-cli-core\azure\cli\core\tests\sp_cert.pem" />
<Content Include="azure-cli-core\HISTORY.rst" />
<Content Include="azure-cli-core\setup.cfg" />
<Content Include="azure-cli-nspkg\HISTORY.rst" />
<Content Include="azure-cli-nspkg\setup.cfg" />
<Content Include="azure-cli-telemetry\azure\cli\telemetry\tests\resources\cache" />
<Content Include="azure-cli-telemetry\azure\cli\telemetry\tests\resources\cache.1" />
<Content Include="azure-cli-telemetry\azure\cli\telemetry\tests\resources\cache.10" />
Expand Down
27 changes: 27 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,33 @@ jobs:

displayName: 'Bash Script'

- job: TestHomebrewPackage
displayName: Test Homebrew Package
timeoutInMinutes: 120
dependsOn: BuildHomebrewFormula
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual'))
pool:
vmImage: 'macOS-10.14'
steps:
- task: DownloadPipelineArtifact@1
displayName: 'Download Metadata'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/metadata'
artifactName: metadata


- task: DownloadPipelineArtifact@1
displayName: 'Download Build Artifacts'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/homebrew'
artifactName: homebrew


- bash: ./scripts/release/homebrew/test_homebrew_package.sh


displayName: 'Test Homebrew Package'

- job: BuildYumPackage
displayName: Build Yum Package

Expand Down
4 changes: 1 addition & 3 deletions build_scripts/windows/scripts/build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ 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
for %%a in (%CLI_SRC%\azure-cli %CLI_SRC%\azure-cli-core %CLI_SRC%\azure-cli-nspkg %CLI_SRC%\azure-cli-telemetry) do (
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 .
popd
Expand All @@ -97,8 +97,6 @@ for %%a in (%CLI_SRC%\azure-cli %CLI_SRC%\azure-cli-core %CLI_SRC%\azure-cli-nsp

if %errorlevel% neq 0 goto ERROR

%BUILDING_DIR%\python.exe -m pip install --no-warn-script-location --force-reinstall --upgrade azure-nspkg azure-mgmt-nspkg

pushd %BUILDING_DIR%
%BUILDING_DIR%\python.exe %~dp0\patch_models_v2.py
popd
Expand Down
4 changes: 0 additions & 4 deletions doc/authoring_command_modules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ Also, you can run `az` and if your command module contributes any commands, they
If your commands aren't showing with `az`, use `az --debug` to help debug. There could have been an exception
thrown whilst attempting to load your module.

**Note for locally installed Azure SDKs:**
If you're receiving Azure import errors, run `pip install -I azure-nspkg==1.0.0` in your virtual environment
after installing your SDK locally.


<a name="heading_author_command_mod"></a>Authoring command modules
------
Expand Down
8 changes: 8 additions & 0 deletions scripts/ci/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ echo "Replace with version: $version"

platform=`uname`

for each in $(find src -name __main__.py); do
if [ "$platform" == "Darwin" ]; then
sed -i "" "s/^__version__ = [\"']\(.*\)[\"']/__version__ = \"\1.dev$version\"/" $each
else
sed -i "s/^__version__ = [\"']\(.*\)[\"']/__version__ = \"\1.dev$version\"/" $each
fi
done

for each in $(find src -name __init__.py); do
if [ "$platform" == "Darwin" ]; then
sed -i "" "s/^__version__ = [\"']\(.*\)[\"']/__version__ = \"\1.dev$version\"/" $each
Expand Down
4 changes: 0 additions & 4 deletions scripts/curl_install_pypi/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,6 @@ def install_cli(install_dir, tmp_dir):
path_to_pip = os.path.join(install_dir, 'bin', 'pip')
cmd = [path_to_pip, 'install', '--cache-dir', tmp_dir, 'azure-cli', '--upgrade']
exec_command(cmd)
# Temporary fix to make sure that we have empty __init__.py files for the azure site-packages folder.
# (including the pkg_resources/declare namespace significantly impacts startup perf for the CLI)
fixupcmd = [path_to_pip, 'install', '--cache-dir', tmp_dir, '--upgrade', '--force-reinstall', 'azure-nspkg', 'azure-mgmt-nspkg']
exec_command(fixupcmd)


def create_executable(exec_dir, install_dir):
Expand Down
6 changes: 0 additions & 6 deletions scripts/dev_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ def pip_command(command):
pip_command('install -e ./tools')

# command modules have dependency on azure-cli-core so install this first
pip_command('install -e src/azure-cli-nspkg')
pip_command('install -e src/azure-cli-telemetry')
pip_command('install -e src/azure-cli-core')
py_command('-m automation.setup.install_modules')
Expand All @@ -75,11 +74,6 @@ def pip_command(command):
pip_command('install -e src/azure-cli')
pip_command('install -e src/azure-cli-testsdk')

# Ensure that the site package's azure/__init__.py has the old style namespace
# package declaration by installing the old namespace package
pip_command('install --force-reinstall azure-nspkg==1.0.0')
pip_command('install --force-reinstall azure-mgmt-nspkg==1.0.0')

print_support_message()
print('Finished dev setup.')

1 change: 0 additions & 1 deletion scripts/release/debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ RUN mkdir -p ./bin/pypi && \
BUILD_STAGINGDIRECTORY=/azure-cli/bin/pypi ./scripts/release/pypi/build.sh && \
if [ -d ./privates ]; then find ./privates -name '*.whl' | xargs pip install; fi && \
find ./bin/pypi -name '*.whl' | xargs pip install && \
pip install --force-reinstall --upgrade azure-nspkg azure-mgmt-nspkg && \
pip install --force-reinstall urllib3==1.24.2

ARG cli_version=0.0.0-dev
Expand Down
2 changes: 1 addition & 1 deletion scripts/release/debian/pipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -exv
: ${DISTRO:?"DISTRO is not set"}
: ${DISTRO_BASE_IMAGE:?"DISTRO_BASE_IMAGE is not set"}

CLI_VERSION=`cat src/azure-cli/azure/cli/__init__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g`
CLI_VERSION=`cat src/azure-cli/azure/cli/__main__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g`

docker run --rm \
-v "$BUILD_SOURCESDIRECTORY":/mnt/repo \
Expand Down
2 changes: 1 addition & 1 deletion scripts/release/docker/pipeline.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
IMAGE_NAME=clibuild$BUILD_BUILDNUMBER
CLI_VERSION=`cat src/azure-cli/azure/cli/__init__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g`
CLI_VERSION=`cat src/azure-cli/azure/cli/__main__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g`

docker build --no-cache \
--build-arg BUILD_DATE="`date -u +"%Y-%m-%dT%H:%M:%SZ"`" \
Expand Down
4 changes: 2 additions & 2 deletions scripts/release/get_version.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Extract the version of the CLI from azure-cli package's __init__.py file.
# Extract the version of the CLI from azure-cli package's __main__.py file.

: "${BUILD_STAGINGDIRECTORY:?BUILD_STAGINGDIRECTORY environment variable not set}"

ver=`cat src/azure-cli/azure/cli/__init__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g`
ver=`cat src/azure-cli/azure/cli/__main__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g`
echo $ver > $BUILD_STAGINGDIRECTORY/version
echo $ver > $BUILD_STAGINGDIRECTORY/azure-cli-${ver}.txt
9 changes: 7 additions & 2 deletions scripts/release/homebrew/docker/formula_template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@ class AzureCli < Formula
url "{{ upstream_url }}"
version "{{ cli_version }}"
sha256 "{{ upstream_sha }}"
license "MIT"
head "https://github.com/Azure/azure-cli.git"

{{ bottle_hash }}

depends_on "[email protected]"
depends_on "[email protected]"

uses_from_macos "libffi"

on_linux do
depends_on "pkg-config" => :build
end

{{ resources }}

def install
Expand All @@ -28,8 +35,6 @@ class AzureCli < Formula
buildpath/"src/azure-cli",
buildpath/"src/azure-cli-telemetry",
buildpath/"src/azure-cli-core",
buildpath/"src/azure-cli-nspkg",
buildpath/"src/azure-cli-command_modules-nspkg",
]

# Install CLI
Expand Down
2 changes: 1 addition & 1 deletion scripts/release/homebrew/docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ pip install -r /mnt/src/azure-cli/requirements.py3.Darwin.txt

pip list

python $root/formula_generate.py
python $root/formula_generate.py -b use_template
34 changes: 34 additions & 0 deletions scripts/release/homebrew/test_homebrew_package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# --------------------------------------------------------------------------------------------
# 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

if len(sys.argv) < 2:
print('AZ_BASE or PYTHON_VERSION are not specified')
sys.exit(-1)

az_base = sys.argv[1]
python_version = sys.argv[2]

root_dir = '{}/lib/{}/site-packages/azure/cli/command_modules'.format(az_base, python_version)
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={}/lib/{}/site-packages python -m pytest -x -v --boxed -p no:warnings --log-level=WARN'.format(az_base, python_version)
pytest_parallel_cmd = '{} -n auto'.format(pytest_base_cmd)

for mod_name in mod_list:
if mod_name in ['botservice', 'network', 'configure']:
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 == 5:
print('No tests found for {}'.format(mod_name))
elif exit_code != 0:
sys.exit(exit_code)

exit_code = subprocess.call(['{} --junit-xml ./azure_cli_test_result/azure-cli-core.xml --pyargs azure.cli.core'.format(pytest_base_cmd)], shell=True)
sys.exit(exit_code)
Loading