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

Snapcraft yaml for Azure CLI #5904

Merged
merged 2 commits into from
Mar 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
42 changes: 42 additions & 0 deletions .snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: azure-cli
summary: Microsoft Azure CLI 2.0
description: |
A great cloud needs great tools; we're excited to introduce Azure CLI 2.0, our
next generation multi-platform command line experience for Azure.
version: "release"
version-script: |
grep VERSION src/azure-cli/setup.py | head -n 1 | cut -d'"' -f2
confinement: classic
grade: stable
apps:
az:
command: usr/bin/python -m azure.cli
completer: az.completion
parts:
azure-cli:
plugin: python
source: .
python-version: python3
build-packages:
- build-essential
- python3-dev
- python3-wheel
- libffi-dev
- libssl-dev
stage-packages:
- libffi6
- 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*"
export PYTHONUSERBASE=$SNAPCRAFT_PART_INSTALL
export PYTHONHOME=$SNAPCRAFT_PART_INSTALL/usr
echo $SNAPCRAFT_PART_INSTALL/usr/bin/python3
$SNAPCRAFT_PART_INSTALL/usr/bin/python3 -c 'import site; print("PYTHONUSERBASE set to {!r}".format(site.getuserbase()))'
$SNAPCRAFT_PART_INSTALL/usr/bin/python3 -m pip install --user $python_packages
$SNAPCRAFT_PART_INSTALL/usr/bin/python3 -m pip install --no-index --user src/azure-cli
install build_scripts/snap/az.snap.completion $SNAPCRAFT_PART_INSTALL/az.completion
# PEP 394 says you should use python3, but the client uses python.
ln -s python3 $SNAPCRAFT_PART_INSTALL/usr/bin/python
prime:
- -lib/python3.5/site-packages/tabulate-0.7.7.dist-info/.PKG-INFO.swp
21 changes: 21 additions & 0 deletions build_scripts/snap/az.snap.completion
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
_python_argcomplete() {
local IFS=$'\013'
local SUPPRESS_SPACE=0
if compopt +o nospace 2> /dev/null; then
SUPPRESS_SPACE=1
fi
COMPREPLY=( $(IFS="$IFS" \
COMP_LINE="$COMP_LINE" \
COMP_POINT="$COMP_POINT" \
COMP_TYPE="$COMP_TYPE" \
_ARGCOMPLETE_COMP_WORDBREAKS="$COMP_WORDBREAKS" \
_ARGCOMPLETE=1 \
_ARGCOMPLETE_SUPPRESS_SPACE=$SUPPRESS_SPACE \
"$SNAP/usr/bin/python" -m azure.cli 8>&1 9>&2 1>/dev/null 2>/dev/null) )
if [[ $? != 0 ]]; then
unset COMPREPLY
elif [[ $SUPPRESS_SPACE == 1 ]] && [[ "$COMPREPLY" =~ [=/:]$ ]]; then
compopt -o nospace
fi
}
complete -o nospace -F _python_argcomplete azure-cli.az
Copy link
Member Author

Choose a reason for hiding this comment

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

This separate tab completion file is needed due to azure-cli.az in snapcraft instead of az