Hello community,

here is the log from the commit of package azure-cli-extension for 
openSUSE:Factory checked in at 2018-05-13 16:02:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/azure-cli-extension (Old)
 and      /work/SRC/openSUSE:Factory/.azure-cli-extension.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "azure-cli-extension"

Sun May 13 16:02:21 2018 rev:3 rq:600050 version:0.0.12

Changes:
--------
--- /work/SRC/openSUSE:Factory/azure-cli-extension/azure-cli-extension.changes  
2018-02-14 09:30:53.229077707 +0100
+++ 
/work/SRC/openSUSE:Factory/.azure-cli-extension.new/azure-cli-extension.changes 
    2018-05-13 16:02:23.900169305 +0200
@@ -1,0 +2,7 @@
+Wed Apr 18 11:59:42 UTC 2018 - [email protected]
+
+- New upstream release
+  + Version 0.0.12
+- Move LICENSE.txt from %doc to %license section
+
+-------------------------------------------------------------------

Old:
----
  azure-cli-extension-0.0.8.tar.gz

New:
----
  azure-cli-extension-0.0.12.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ azure-cli-extension.spec ++++++
--- /var/tmp/diff_new_pack.hSv8EV/_old  2018-05-13 16:02:24.748138368 +0200
+++ /var/tmp/diff_new_pack.hSv8EV/_new  2018-05-13 16:02:24.752138222 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           azure-cli-extension
-Version:        0.0.8
+Version:        0.0.12
 Release:        0
 Summary:        Microsoft Azure CLI 'extension' Command Module
 License:        MIT
@@ -65,7 +65,8 @@
 
 %files
 %defattr(-,root,root,-)
-%doc HISTORY.rst LICENSE.txt README.rst
+%doc HISTORY.rst README.rst
+%license LICENSE.txt
 %{python3_sitelib}/azure/cli/command_modules/extension
 %{python3_sitelib}/azure_cli_extension-*.egg-info
 

++++++ azure-cli-extension-0.0.8.tar.gz -> azure-cli-extension-0.0.12.tar.gz 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/azure-cli-extension-0.0.8/HISTORY.rst 
new/azure-cli-extension-0.0.12/HISTORY.rst
--- old/azure-cli-extension-0.0.8/HISTORY.rst   2018-01-26 17:12:23.000000000 
+0100
+++ new/azure-cli-extension-0.0.12/HISTORY.rst  2018-04-06 19:33:13.000000000 
+0200
@@ -2,6 +2,27 @@
 
 Release History
 ===============
+
+0.0.12
+++++++
+* Linux distro check message should be output to debug instead of warning.
+* `sdist` is now compatible with wheel 0.31.0
+
+0.0.11
+++++++
+* Preview extensions: Show message on `az extension add` if extension is in 
preview
+* BC: `az extension list-available` - The full extension data is now available 
with `--show-details`
+* `az extension list-available` - A simplified view of the extensions 
available is now shown by default
+
+0.0.10
++++++++
+* Added check to warn user if used distro is different then the one stored in 
package source file, as this may lead into errors. 
+
+0.0.9
+++++++
+* Added support for --pip-proxy parameter to az extension add/update commands.
+* Added support for --pip-extra-index-urls argument to az extension add and 
update commands.
+
 0.0.8
 ++++++
 Minor fixes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/azure-cli-extension-0.0.8/PKG-INFO 
new/azure-cli-extension-0.0.12/PKG-INFO
--- old/azure-cli-extension-0.0.8/PKG-INFO      2018-01-26 17:12:38.000000000 
+0100
+++ new/azure-cli-extension-0.0.12/PKG-INFO     2018-04-06 19:33:38.000000000 
+0200
@@ -1,11 +1,12 @@
 Metadata-Version: 1.1
 Name: azure-cli-extension
-Version: 0.0.8
+Version: 0.0.12
 Summary: Microsoft Azure Command-Line Tools Extension Command Module
 Home-page: https://github.com/Azure/azure-cli
 Author: Microsoft Corporation
 Author-email: [email protected]
 License: MIT
+Description-Content-Type: UNKNOWN
 Description: Microsoft Azure CLI 'extension' Command Module
         ==============================================
         
@@ -19,6 +20,27 @@
         
         Release History
         ===============
+        
+        0.0.12
+        ++++++
+        * Linux distro check message should be output to debug instead of 
warning.
+        * `sdist` is now compatible with wheel 0.31.0
+        
+        0.0.11
+        ++++++
+        * Preview extensions: Show message on `az extension add` if extension 
is in preview
+        * BC: `az extension list-available` - The full extension data is now 
available with `--show-details`
+        * `az extension list-available` - A simplified view of the extensions 
available is now shown by default
+        
+        0.0.10
+        +++++++
+        * Added check to warn user if used distro is different then the one 
stored in package source file, as this may lead into errors. 
+        
+        0.0.9
+        ++++++
+        * Added support for --pip-proxy parameter to az extension add/update 
commands.
+        * Added support for --pip-extra-index-urls argument to az extension 
add and update commands.
+        
         0.0.8
         ++++++
         Minor fixes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/azure-cli-extension-0.0.8/azure/cli/command_modules/extension/__init__.py 
new/azure-cli-extension-0.0.12/azure/cli/command_modules/extension/__init__.py
--- 
old/azure-cli-extension-0.0.8/azure/cli/command_modules/extension/__init__.py   
    2018-01-26 17:12:23.000000000 +0100
+++ 
new/azure-cli-extension-0.0.12/azure/cli/command_modules/extension/__init__.py  
    2018-04-06 19:33:13.000000000 +0200
@@ -27,7 +27,10 @@
             return bool(not command_args.get('source') or prompt_y_n('Are you 
sure you want to install this extension?'))
 
         def transform_extension_list_available(results):
-            return [OrderedDict([('Name', r)]) for r in results]
+            if isinstance(results, dict):
+                # For --show-details, transform the table
+                return [OrderedDict([('Name', r)]) for r in results]
+            return results
 
         def validate_extension_add(namespace):
             if (namespace.extension_name and namespace.source) or (not 
namespace.extension_name and not namespace.source):
@@ -55,11 +58,20 @@
             c.argument('extension_name', options_list=['--name', '-n'], 
help='Name of extension', completer=extension_name_completion_list)
             # This is a hidden parameter for now
             c.argument('index_url', options_list=['--index'], 
help=argparse.SUPPRESS)
+            c.argument('pip_proxy', options_list=['--pip-proxy'],
+                       help='Proxy for pip to use for extension dependencies 
in the form of [user:passwd@]proxy.server:port',
+                       arg_group='Experimental Pip')
+
+            c.argument('pip_extra_index_urls', 
options_list=['--pip-extra-index-urls'], nargs='+',
+                       help='Space-separated list of extra URLs of package 
indexes to use. This should point to a repository compliant with PEP 503 (the 
simple repository API) or a local directory laid out in the same format.', 
arg_group='Experimental Pip')
 
         with self.argument_context('extension add') as c:
             c.argument('extension_name', 
completer=extension_name_from_index_completion_list)
             c.argument('source', options_list=['--source', '-s'], 
help='Filepath or URL to an extension', completer=FilesCompleter())
             c.argument('yes', options_list=['--yes', '-y'], 
action='store_true', help='Do not prompt for confirmation.')
 
+        with self.argument_context('extension list-available') as c:
+            c.argument('show_details', options_list=['--show-details', '-d'], 
action='store_true', help='Show the raw data from the extension index.')
+
 
 COMMAND_LOADER_CLS = ExtensionCommandsLoader
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/azure-cli-extension-0.0.8/azure/cli/command_modules/extension/_help.py 
new/azure-cli-extension-0.0.12/azure/cli/command_modules/extension/_help.py
--- old/azure-cli-extension-0.0.8/azure/cli/command_modules/extension/_help.py  
2018-01-26 17:12:23.000000000 +0100
+++ new/azure-cli-extension-0.0.12/azure/cli/command_modules/extension/_help.py 
2018-04-06 19:33:13.000000000 +0200
@@ -20,6 +20,9 @@
       text: az extension add --source 
https://contoso.com/anextension-0.0.1-py2.py3-none-any.whl
     - name: Add extension from local disk
       text: az extension add --source ~/anextension-0.0.1-py2.py3-none-any.whl
+    - name: Add extension from local disk and use pip proxy for dependencies
+      text: az extension add --source ~/anextension-0.0.1-py2.py3-none-any.whl
+            --pip-proxy https://user:[email protected]:8080
 """
 
 helps['extension list'] = """
@@ -50,4 +53,9 @@
 helps['extension update'] = """
     type: command
     short-summary: Update an extension.
+    examples:
+    - name: Update an extension by name
+      text: az extension update --name anextension
+    - name: Update an extension by name and use pip proxy for dependencies
+      text: az extension update --name anextension --pip-proxy 
https://user:[email protected]:8080
 """
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/azure-cli-extension-0.0.8/azure/cli/command_modules/extension/custom.py 
new/azure-cli-extension-0.0.12/azure/cli/command_modules/extension/custom.py
--- old/azure-cli-extension-0.0.8/azure/cli/command_modules/extension/custom.py 
2018-01-26 17:12:23.000000000 +0100
+++ 
new/azure-cli-extension-0.0.12/azure/cli/command_modules/extension/custom.py    
    2018-04-06 19:33:13.000000000 +0200
@@ -10,16 +10,20 @@
 import traceback
 import hashlib
 from subprocess import check_output, STDOUT, CalledProcessError
+from six.moves.urllib.parse import urlparse  # pylint: disable=import-error
+from collections import OrderedDict
+
 import requests
 from wheel.install import WHEEL_INFO_RE
-from six.moves.urllib.parse import urlparse  # pylint: disable=import-error
+from pkg_resources import parse_version
 
 from knack.log import get_logger
 
 from azure.cli.core.util import CLIError
 from azure.cli.core.extension import (extension_exists, get_extension_path, 
get_extensions,
-                                      get_extension, ext_compat_with_cli,
+                                      get_extension, ext_compat_with_cli, 
EXT_METADATA_ISPREVIEW,
                                       WheelExtension, 
ExtensionNotInstalledException)
+from azure.cli.core.telemetry import set_extension_management_detail
 
 from ._homebrew_patch import HomebrewPipPatch
 from ._index import get_index_extensions
@@ -32,6 +36,10 @@
 OUT_KEY_TYPE = 'extensionType'
 OUT_KEY_METADATA = 'metadata'
 
+IS_WINDOWS = sys.platform.lower() in ['windows', 'win32']
+LIST_FILE_PATH = os.path.join(os.sep, 'etc', 'apt', 'sources.list.d', 
'azure-cli.list')
+LSB_RELEASE_FILE = os.path.join(os.sep, 'etc', 'lsb-release')
+
 
 def _run_pip(pip_exec_args):
     cmd = [sys.executable, '-m', 'pip'] + pip_exec_args + ['-vv', 
'--disable-pip-version-check', '--no-cache-dir']
@@ -86,7 +94,7 @@
     _validate_whl_cli_compat(azext_metadata)
 
 
-def _add_whl_ext(source, ext_sha256=None):  # pylint: 
disable=too-many-statements
+def _add_whl_ext(source, ext_sha256=None, pip_extra_index_urls=None, 
pip_proxy=None):  # pylint: disable=too-many-statements
     if not source.endswith('.whl'):
         raise ValueError('Unknown extension type. Only Python wheels are 
supported.')
     url_parse_result = urlparse(source)
@@ -135,9 +143,18 @@
     except CLIError as e:
         raise e
     logger.debug('Validation successful on %s', ext_file)
+    # Check for distro consistency
+    check_distro_consistency()
     # Install with pip
     extension_path = get_extension_path(extension_name)
     pip_args = ['install', '--target', extension_path, ext_file]
+
+    if pip_proxy:
+        pip_args = pip_args + ['--proxy', pip_proxy]
+    if pip_extra_index_urls:
+        for extra_index_url in pip_extra_index_urls:
+            pip_args = pip_args + ['--extra-index-url', extra_index_url]
+
     logger.debug('Executing pip with args: %s', pip_args)
     with HomebrewPipPatch():
         pip_status_code = _run_pip(pip_args)
@@ -160,7 +177,21 @@
     return expected_sum == computed_hash, computed_hash
 
 
-def add_extension(source=None, extension_name=None, index_url=None, yes=None): 
 # pylint: disable=unused-argument
+def _augment_telemetry_with_ext_info(extension_name):
+    # The extension must be available before calling this otherwise we can't 
get the version from metadata
+    if not extension_name:
+        return
+    try:
+        ext = get_extension(extension_name)
+        ext_version = ext.version
+        set_extension_management_detail(extension_name, ext_version)
+    except Exception:  # nopa pylint: disable=broad-except
+        # Don't error on telemetry
+        pass
+
+
+def add_extension(source=None, extension_name=None, index_url=None, yes=None,  
# pylint: disable=unused-argument
+                  pip_extra_index_urls=None, pip_proxy=None):
     ext_sha256 = None
     if extension_name:
         if extension_exists(extension_name):
@@ -170,12 +201,21 @@
         except NoExtensionCandidatesError as err:
             logger.debug(err)
             raise CLIError("No matching extensions for '{}'. Use --debug for 
more information.".format(extension_name))
-    _add_whl_ext(source, ext_sha256=ext_sha256)
+    _add_whl_ext(source, ext_sha256=ext_sha256, 
pip_extra_index_urls=pip_extra_index_urls, pip_proxy=pip_proxy)
+    _augment_telemetry_with_ext_info(extension_name)
+    try:
+        if extension_name and get_extension(extension_name).preview:
+            logger.warning("The installed extension '%s' is in preview.", 
extension_name)
+    except ExtensionNotInstalledException:
+        pass
 
 
 def remove_extension(extension_name):
     try:
+        # Get the extension and it will raise an error if it doesn't exist
         get_extension(extension_name)
+        # We call this just before we remove the extension so we can get the 
metadata before it is gone
+        _augment_telemetry_with_ext_info(extension_name)
         shutil.rmtree(get_extension_path(extension_name))
     except ExtensionNotInstalledException as e:
         raise CLIError(e)
@@ -197,7 +237,7 @@
         raise CLIError(e)
 
 
-def update_extension(extension_name, index_url=None):
+def update_extension(extension_name, index_url=None, 
pip_extra_index_urls=None, pip_proxy=None):
     try:
         ext = get_extension(extension_name)
         cur_version = ext.get_version()
@@ -215,9 +255,12 @@
         shutil.rmtree(extension_path)
         # Install newer version
         try:
-            _add_whl_ext(download_url, ext_sha256=ext_sha256)
+            _add_whl_ext(download_url, ext_sha256=ext_sha256,
+                         pip_extra_index_urls=pip_extra_index_urls, 
pip_proxy=pip_proxy)
             logger.debug('Deleting backup of old extension at %s', backup_dir)
             shutil.rmtree(backup_dir)
+            # This gets the metadata for the extension *after* the update
+            _augment_telemetry_with_ext_info(extension_name)
         except Exception as err:
             logger.error('An error occurred whilst updating.')
             logger.error(err)
@@ -228,5 +271,68 @@
         raise CLIError(e)
 
 
-def list_available_extensions(index_url=None):
-    return get_index_extensions(index_url=index_url)
+def list_available_extensions(index_url=None, show_details=False):
+    index_data = get_index_extensions(index_url=index_url)
+    if show_details:
+        return index_data
+    installed_extensions = get_extensions()
+    installed_extension_names = [e.name for e in installed_extensions]
+    results = []
+    for name, items in OrderedDict(sorted(index_data.items())).items():
+        latest = sorted(items, key=lambda c: 
parse_version(c['metadata']['version']), reverse=True)[0]
+        installed = False
+        if name in installed_extension_names:
+            installed = True
+            ext_version = get_extension(name).version
+            if ext_version and parse_version(latest['metadata']['version']) > 
parse_version(ext_version):
+                installed = str(True) + ' (upgrade available)'
+        results.append({
+            'name': name,
+            'version': latest['metadata']['version'],
+            'summary': latest['metadata']['summary'],
+            'preview': latest['metadata'].get(EXT_METADATA_ISPREVIEW, False),
+            'installed': installed
+        })
+    return results
+
+
+def get_lsb_release():
+    try:
+        with open(LSB_RELEASE_FILE, 'r') as lr:
+            lsb = lr.readlines()
+            desc = lsb[2]
+            desc_split = desc.split('=')
+            rel = desc_split[1]
+            return rel.strip()
+    except Exception:  # pylint: disable=broad-except
+        return None
+
+
+def check_distro_consistency():
+    if IS_WINDOWS:
+        return
+
+    try:
+        logger.debug('Linux distro check: Reading from: %s', LIST_FILE_PATH)
+
+        with open(LIST_FILE_PATH, 'r') as list_file:
+            package_source = list_file.read()
+            stored_linux_dist_name = package_source.split(" ")[3]
+            logger.debug('Linux distro check: Found in list file: %s', 
stored_linux_dist_name)
+            current_linux_dist_name = get_lsb_release()
+            logger.debug('Linux distro check: Reported by API: %s', 
current_linux_dist_name)
+
+    except Exception as err:  # pylint: disable=broad-except
+        current_linux_dist_name = None
+        stored_linux_dist_name = None
+        logger.debug('Linux distro check: An error occurred while checking '
+                     'linux distribution version source list consistency.')
+        logger.debug(err)
+
+    if current_linux_dist_name != stored_linux_dist_name:
+        logger.debug("Linux distro check: Mismatch distribution "
+                     "name in %s file", LIST_FILE_PATH)
+        logger.debug("Linux distro check: If command fails, install the 
appropriate package "
+                     "for your distribution or change the above file 
accordingly.")
+        logger.debug("Linux distro check: %s has '%s', current distro is '%s'",
+                     LIST_FILE_PATH, stored_linux_dist_name, 
current_linux_dist_name)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/azure-cli-extension-0.0.8/azure_cli_extension.egg-info/PKG-INFO 
new/azure-cli-extension-0.0.12/azure_cli_extension.egg-info/PKG-INFO
--- old/azure-cli-extension-0.0.8/azure_cli_extension.egg-info/PKG-INFO 
2018-01-26 17:12:38.000000000 +0100
+++ new/azure-cli-extension-0.0.12/azure_cli_extension.egg-info/PKG-INFO        
2018-04-06 19:33:38.000000000 +0200
@@ -1,11 +1,12 @@
 Metadata-Version: 1.1
 Name: azure-cli-extension
-Version: 0.0.8
+Version: 0.0.12
 Summary: Microsoft Azure Command-Line Tools Extension Command Module
 Home-page: https://github.com/Azure/azure-cli
 Author: Microsoft Corporation
 Author-email: [email protected]
 License: MIT
+Description-Content-Type: UNKNOWN
 Description: Microsoft Azure CLI 'extension' Command Module
         ==============================================
         
@@ -19,6 +20,27 @@
         
         Release History
         ===============
+        
+        0.0.12
+        ++++++
+        * Linux distro check message should be output to debug instead of 
warning.
+        * `sdist` is now compatible with wheel 0.31.0
+        
+        0.0.11
+        ++++++
+        * Preview extensions: Show message on `az extension add` if extension 
is in preview
+        * BC: `az extension list-available` - The full extension data is now 
available with `--show-details`
+        * `az extension list-available` - A simplified view of the extensions 
available is now shown by default
+        
+        0.0.10
+        +++++++
+        * Added check to warn user if used distro is different then the one 
stored in package source file, as this may lead into errors. 
+        
+        0.0.9
+        ++++++
+        * Added support for --pip-proxy parameter to az extension add/update 
commands.
+        * Added support for --pip-extra-index-urls argument to az extension 
add and update commands.
+        
         0.0.8
         ++++++
         Minor fixes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/azure-cli-extension-0.0.8/setup.py 
new/azure-cli-extension-0.0.12/setup.py
--- old/azure-cli-extension-0.0.8/setup.py      2018-01-26 17:12:23.000000000 
+0100
+++ new/azure-cli-extension-0.0.12/setup.py     2018-04-06 19:33:13.000000000 
+0200
@@ -14,7 +14,7 @@
     logger.warn("Wheel is not available, disabling bdist_wheel hook")
     cmdclass = {}
 
-VERSION = "0.0.8"
+VERSION = "0.0.12"
 
 CLASSIFIERS = [
     'Development Status :: 5 - Production/Stable',


Reply via email to