Skip to content

Commit

Permalink
Snapcraft yaml for Azure CLI (Azure#5904)
Browse files Browse the repository at this point in the history
* snapcraft.yaml

* add version
  • Loading branch information
derekbekoe authored Mar 26, 2018
1 parent 27df455 commit 5ddfad0
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
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

0 comments on commit 5ddfad0

Please sign in to comment.