From 0ce6ce60fbc738cff24ecbc70472a9792bafe965 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Wed, 10 May 2023 04:53:20 +0000 Subject: automatic import of python-az-cli --- .gitignore | 1 + python-az-cli.spec | 355 +++++++++++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 357 insertions(+) create mode 100644 python-az-cli.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..fc64311 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/az.cli-0.5.tar.gz diff --git a/python-az-cli.spec b/python-az-cli.spec new file mode 100644 index 0000000..e45ef9b --- /dev/null +++ b/python-az-cli.spec @@ -0,0 +1,355 @@ +%global _empty_manifest_terminate_build 0 +Name: python-az.cli +Version: 0.5 +Release: 1 +Summary: An interface to execute Azure CLI commands using Python +License: MIT License +URL: https://github.com/MarkWarneke/Az.Cli +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/76/1d/e97c30656e55a2fd3ed1522f322a2b4bf4f33a729708817c7a0cc24c194a/az.cli-0.5.tar.gz +BuildArch: noarch + +Requires: python3-azure-cli + +%description +# Az.Cli + +[![PyPi](https://img.shields.io/pypi/pyversions/az.cli)](https://pypi.python.org/pypi/az.cli) +[![Build Status master](https://github.com/MarkWarneke/Az.Cli/workflows/Build/badge.svg?branch=master)](https://github.com/MarkWarneke/Az.Cli/actions?query=workflow%3ABuild) +[![Build Status dev](https://github.com/MarkWarneke/Az.Cli/workflows/Build/badge.svg?branch=dev)](https://github.com/MarkWarneke/Az.Cli/actions?query=workflow%3ABuild) + +Python [azure.cli.core](https://github.com/Azure/azure-cli/blob/dev/src/azure-cli-core/azure/cli/core/__init__.py) interface to execute `az` [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest) commands in python. + +The method returns a named tuple `AzResult = namedtuple('AzResult', ['exit_code', 'result_dict', 'log'])`. The [`error_code`](https://docs.python.org/2/library/sys.html#sys.exit) where 0 == success. A `result_dict` containing successfull return as a python dictionary. On failure (`error_code` > 0) a log message inside `log` as a string. + +## Usage + +Install the package + +```bash +pip install az.cli +``` + +Login using `az login` or [sign in using a service principal](https://docs.microsoft.com/en-us/cli/azure/create-an-azure-service-principal-azure-cli?view=azure-cli-latest#sign-in-using-a-service-principalt). + +Under the hood the package uses the [~/.azure](https://github.com/Azure/azure-cli/blob/dev/src/azure-cli-core/azure/cli/core/_environment.py) folder to persist and retrieve config. + +## Example + +```python +from az.cli import az + +# AzResult = namedtuple('AzResult', ['exit_code', 'result_dict', 'log']) +exit_code, result_dict, logs = az("group show -n test") + +# On 0 (SUCCESS) print result_dict, otherwise get info from `logs` +if exit_code == 0: + print (result_dict) +else: + print(logs) +``` + +## Interactive + +You can run the command interactively to traverse the dictionary. +Navigate to `src` and run `python3`. +Import the library `from az.cli import az` and run any command by executing the method `az("")` to invoke Azure CLI. + +```python +# cd src +# python3 +from az.cli import az +# on Success, the `error_code` is 0 and the result_dict contains the output +az("group list") # list return tuple (exit_code, result_dict, log) +az("group list")[0] # 0 +az("group list")[1] # print result_dict +az("group list")[1][0]['id'] # enumerate the id of the first element in dictionary + +# On Error, the `error_code` will be != 1 and the log is present +az("group show -n does-not-exsist") # list return tuple (exit_code, result_dict, log) +az("group show -n does-not-exsist")[0] # 3 +az("group show -n does-not-exsist")[2] # print the log +``` + +## Build + +### Local Development + +- install [python3](https://www.python.org/downloads/) +- install `REQUIREMENTS.txt` using `make init` + +I recommend to use [Python3 virtual environments](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#installing-virtualenv). + +```bash +# sets up environment +make env +# installs requirements +make init +``` + +### Docker + +To build the image run the following in order. + +```bash +# Runs docker build & create +make create +``` + +#### Run + +After the container is build & created you can run the `az.cli` interactivly. + +```bash +# Run docker run +make run +``` + + + + +%package -n python3-az.cli +Summary: An interface to execute Azure CLI commands using Python +Provides: python-az.cli +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-az.cli +# Az.Cli + +[![PyPi](https://img.shields.io/pypi/pyversions/az.cli)](https://pypi.python.org/pypi/az.cli) +[![Build Status master](https://github.com/MarkWarneke/Az.Cli/workflows/Build/badge.svg?branch=master)](https://github.com/MarkWarneke/Az.Cli/actions?query=workflow%3ABuild) +[![Build Status dev](https://github.com/MarkWarneke/Az.Cli/workflows/Build/badge.svg?branch=dev)](https://github.com/MarkWarneke/Az.Cli/actions?query=workflow%3ABuild) + +Python [azure.cli.core](https://github.com/Azure/azure-cli/blob/dev/src/azure-cli-core/azure/cli/core/__init__.py) interface to execute `az` [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest) commands in python. + +The method returns a named tuple `AzResult = namedtuple('AzResult', ['exit_code', 'result_dict', 'log'])`. The [`error_code`](https://docs.python.org/2/library/sys.html#sys.exit) where 0 == success. A `result_dict` containing successfull return as a python dictionary. On failure (`error_code` > 0) a log message inside `log` as a string. + +## Usage + +Install the package + +```bash +pip install az.cli +``` + +Login using `az login` or [sign in using a service principal](https://docs.microsoft.com/en-us/cli/azure/create-an-azure-service-principal-azure-cli?view=azure-cli-latest#sign-in-using-a-service-principalt). + +Under the hood the package uses the [~/.azure](https://github.com/Azure/azure-cli/blob/dev/src/azure-cli-core/azure/cli/core/_environment.py) folder to persist and retrieve config. + +## Example + +```python +from az.cli import az + +# AzResult = namedtuple('AzResult', ['exit_code', 'result_dict', 'log']) +exit_code, result_dict, logs = az("group show -n test") + +# On 0 (SUCCESS) print result_dict, otherwise get info from `logs` +if exit_code == 0: + print (result_dict) +else: + print(logs) +``` + +## Interactive + +You can run the command interactively to traverse the dictionary. +Navigate to `src` and run `python3`. +Import the library `from az.cli import az` and run any command by executing the method `az("")` to invoke Azure CLI. + +```python +# cd src +# python3 +from az.cli import az +# on Success, the `error_code` is 0 and the result_dict contains the output +az("group list") # list return tuple (exit_code, result_dict, log) +az("group list")[0] # 0 +az("group list")[1] # print result_dict +az("group list")[1][0]['id'] # enumerate the id of the first element in dictionary + +# On Error, the `error_code` will be != 1 and the log is present +az("group show -n does-not-exsist") # list return tuple (exit_code, result_dict, log) +az("group show -n does-not-exsist")[0] # 3 +az("group show -n does-not-exsist")[2] # print the log +``` + +## Build + +### Local Development + +- install [python3](https://www.python.org/downloads/) +- install `REQUIREMENTS.txt` using `make init` + +I recommend to use [Python3 virtual environments](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#installing-virtualenv). + +```bash +# sets up environment +make env +# installs requirements +make init +``` + +### Docker + +To build the image run the following in order. + +```bash +# Runs docker build & create +make create +``` + +#### Run + +After the container is build & created you can run the `az.cli` interactivly. + +```bash +# Run docker run +make run +``` + + + + +%package help +Summary: Development documents and examples for az.cli +Provides: python3-az.cli-doc +%description help +# Az.Cli + +[![PyPi](https://img.shields.io/pypi/pyversions/az.cli)](https://pypi.python.org/pypi/az.cli) +[![Build Status master](https://github.com/MarkWarneke/Az.Cli/workflows/Build/badge.svg?branch=master)](https://github.com/MarkWarneke/Az.Cli/actions?query=workflow%3ABuild) +[![Build Status dev](https://github.com/MarkWarneke/Az.Cli/workflows/Build/badge.svg?branch=dev)](https://github.com/MarkWarneke/Az.Cli/actions?query=workflow%3ABuild) + +Python [azure.cli.core](https://github.com/Azure/azure-cli/blob/dev/src/azure-cli-core/azure/cli/core/__init__.py) interface to execute `az` [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest) commands in python. + +The method returns a named tuple `AzResult = namedtuple('AzResult', ['exit_code', 'result_dict', 'log'])`. The [`error_code`](https://docs.python.org/2/library/sys.html#sys.exit) where 0 == success. A `result_dict` containing successfull return as a python dictionary. On failure (`error_code` > 0) a log message inside `log` as a string. + +## Usage + +Install the package + +```bash +pip install az.cli +``` + +Login using `az login` or [sign in using a service principal](https://docs.microsoft.com/en-us/cli/azure/create-an-azure-service-principal-azure-cli?view=azure-cli-latest#sign-in-using-a-service-principalt). + +Under the hood the package uses the [~/.azure](https://github.com/Azure/azure-cli/blob/dev/src/azure-cli-core/azure/cli/core/_environment.py) folder to persist and retrieve config. + +## Example + +```python +from az.cli import az + +# AzResult = namedtuple('AzResult', ['exit_code', 'result_dict', 'log']) +exit_code, result_dict, logs = az("group show -n test") + +# On 0 (SUCCESS) print result_dict, otherwise get info from `logs` +if exit_code == 0: + print (result_dict) +else: + print(logs) +``` + +## Interactive + +You can run the command interactively to traverse the dictionary. +Navigate to `src` and run `python3`. +Import the library `from az.cli import az` and run any command by executing the method `az("")` to invoke Azure CLI. + +```python +# cd src +# python3 +from az.cli import az +# on Success, the `error_code` is 0 and the result_dict contains the output +az("group list") # list return tuple (exit_code, result_dict, log) +az("group list")[0] # 0 +az("group list")[1] # print result_dict +az("group list")[1][0]['id'] # enumerate the id of the first element in dictionary + +# On Error, the `error_code` will be != 1 and the log is present +az("group show -n does-not-exsist") # list return tuple (exit_code, result_dict, log) +az("group show -n does-not-exsist")[0] # 3 +az("group show -n does-not-exsist")[2] # print the log +``` + +## Build + +### Local Development + +- install [python3](https://www.python.org/downloads/) +- install `REQUIREMENTS.txt` using `make init` + +I recommend to use [Python3 virtual environments](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#installing-virtualenv). + +```bash +# sets up environment +make env +# installs requirements +make init +``` + +### Docker + +To build the image run the following in order. + +```bash +# Runs docker build & create +make create +``` + +#### Run + +After the container is build & created you can run the `az.cli` interactivly. + +```bash +# Run docker run +make run +``` + + + + +%prep +%autosetup -n az.cli-0.5 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-az.cli -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 10 2023 Python_Bot - 0.5-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..069c195 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +e2910424af64e53a8471b79f148d3054 az.cli-0.5.tar.gz -- cgit v1.2.3