Hello community,

here is the log from the commit of package python-azure-agent for 
openSUSE:Factory checked in at 2018-03-08 10:57:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-azure-agent (Old)
 and      /work/SRC/openSUSE:Factory/.python-azure-agent.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-azure-agent"

Thu Mar  8 10:57:56 2018 rev:8 rq:583706 version:2.2.18

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-azure-agent/python-azure-agent.changes    
2018-02-16 21:44:24.199669734 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-azure-agent.new/python-azure-agent.changes   
    2018-03-08 10:57:57.984323071 +0100
@@ -1,0 +2,12 @@
+Tue Feb 27 20:36:45 UTC 2018 - [email protected]
+
+- Add paa_force_py3_sle15.patch
+  + Force use of Python 3 for SLE 15 and later
+
+-------------------------------------------------------------------
+Wed Feb 21 14:21:21 UTC 2018 - [email protected]
+
+- Modify 0001-Obtain-platform-information-in-Python-version-depend.patch to
+  reflect agreed upon solution with upstream
+
+-------------------------------------------------------------------

New:
----
  paa_force_py3_sle15.patch

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

Other differences:
------------------
++++++ python-azure-agent.spec ++++++
--- /var/tmp/diff_new_pack.9sxGzg/_old  2018-03-08 10:57:58.604300661 +0100
+++ /var/tmp/diff_new_pack.9sxGzg/_new  2018-03-08 10:57:58.604300661 +0100
@@ -28,6 +28,7 @@
 Patch3:         paa_fix_driver_install_detect.patch
 Patch4:         paa_rdma_install_proper_driver.patch
 Patch5:         0001-Obtain-platform-information-in-Python-version-depend.patch
+Patch6:         paa_force_py3_sle15.patch
 BuildRequires:  dos2unix
 
 BuildRequires:  distribution-release
@@ -120,6 +121,9 @@
 %patch3
 %patch4
 %patch5 -p1
+%if 0%{?suse_version} && 0%{?suse_version} > 1315
+%patch6
+%endif
 
 %build
 %if 0%{?suse_version} && 0%{?suse_version} > 1315

++++++ 0001-Obtain-platform-information-in-Python-version-depend.patch ++++++
--- /var/tmp/diff_new_pack.9sxGzg/_old  2018-03-08 10:57:58.624299939 +0100
+++ /var/tmp/diff_new_pack.9sxGzg/_new  2018-03-08 10:57:58.628299793 +0100
@@ -1,9 +1,9 @@
-From 58ee33f1651d09f00a441ff4317cb1151e554ea5 Mon Sep 17 00:00:00 2001
+From 6cd0bfc51c58958dcc16e55e296e26c5a5c6464d Mon Sep 17 00:00:00 2001
 From: Robert Schweikert <[email protected]>
 Date: Thu, 8 Feb 2018 13:11:21 -0500
-Subject: [PATCH] - Obtain platform information in Python version dependent way
-   + The platform module has deprecated functionality in Python 3.5 and    
- the functionality will be removed in 3.7. For Python versions 3.5     and
+Subject: [PATCH 1/4] - Obtain platform information in Python version dependent
+ way   + The platform module has deprecated functionality in Python 3.5 and   
+  the functionality will be removed in 3.7. For Python versions 3.5     and
  greater depend on the distro module to obtain linux distribution    
  information
 
@@ -13,10 +13,10 @@
  2 files changed, 28 insertions(+), 7 deletions(-)
 
 diff --git a/azurelinuxagent/common/version.py 
b/azurelinuxagent/common/version.py
-index f743f11..713d82e 100644
+index f743f115..713d82ed 100644
 --- a/azurelinuxagent/common/version.py
 +++ b/azurelinuxagent/common/version.py
-@@ -20,6 +20,9 @@ import re
+@@ -20,6 +20,9 @@
  import platform
  import sys
  
@@ -61,10 +61,10 @@
      # The platform.py lib has issue with detecting oracle linux distribution.
      # Merge the following patch provided by oracle as a temporary fix.
 diff --git a/setup.py b/setup.py
-index f59f829..4663169 100755
+index f59f8292..ae6983cc 100755
 --- a/setup.py
 +++ b/setup.py
-@@ -26,6 +26,7 @@ from azurelinuxagent.common.osutil import get_osutil
+@@ -26,6 +26,7 @@
  import setuptools
  from setuptools import find_packages
  from setuptools.command.install import install as  _install
@@ -81,7 +81,7 @@
          set_bin_files(data_files)
          set_conf_files(data_files, src=["config/suse/waagent.conf"])
          set_logrotate_files(data_files)
-@@ -198,6 +199,9 @@ class install(_install):
+@@ -198,6 +199,9 @@ def run(self):
              osutil.stop_agent_service()
              osutil.start_agent_service()
  
@@ -91,7 +91,7 @@
  
  setuptools.setup(
      name=AGENT_NAME,
-@@ -209,6 +213,7 @@ setuptools.setup(
+@@ -209,6 +213,7 @@ def run(self):
      url='https://github.com/Azure/WALinuxAgent',
      license='Apache License Version 2.0',
      packages=find_packages(exclude=["tests"]),
@@ -99,6 +99,290 @@
      py_modules=["__main__"],
      cmdclass={
          'install': install
--- 
-2.13.6
 
+From 9b40832981aaf52950d0d1ab2efe8a748b92a0cf Mon Sep 17 00:00:00 2001
+From: Robert Schweikert <[email protected]>
+Date: Sat, 10 Feb 2018 16:38:23 -0500
+Subject: [PATCH 2/4] - Refactor to move logic for distro information
+ generation into   future module
+
+---
+ azurelinuxagent/common/future.py  | 25 +++++++++++++++++++++++++
+ azurelinuxagent/common/version.py | 20 ++------------------
+ 2 files changed, 27 insertions(+), 18 deletions(-)
+
+diff --git a/azurelinuxagent/common/future.py 
b/azurelinuxagent/common/future.py
+index 8389cd32..f400ce02 100644
+--- a/azurelinuxagent/common/future.py
++++ b/azurelinuxagent/common/future.py
+@@ -1,5 +1,9 @@
++import platform
+ import sys
+ 
++if float(sys.version[:3]) >= 3.5:
++    import distro
++    
+ """
+ Add alias for python2 and python3 libs and functions.
+ """
+@@ -24,3 +28,24 @@
+ 
+ else:
+     raise ImportError("Unknown python version: {0}".format(sys.version_info))
++
++
++def get_linux_distribution(get_full_name, supported_dists):
++    """Abstract platform.linux_distribution() call which is deprecated as of
++       Python 3.5"""
++    if float(sys.version[:3]) >= 3.5:
++        platform_module = distro
++        osinfo = list(distro.linux_distribution(
++            full_distribution_name=get_full_name
++        ))
++    else:
++        platform_module = platform
++        supported = platform._supported_dists + (supported_dists,)
++        osinfo = list(platform.linux_distribution(
++            full_distribution_name=get_full_name,
++            supported_dists=supported
++        ))
++    full_name = platform_module.linux_distribution()[0].strip()
++    osinfo.append(full_name)
++
++    return osinfo
+diff --git a/azurelinuxagent/common/version.py 
b/azurelinuxagent/common/version.py
+index 713d82ed..98e7c8e4 100644
+--- a/azurelinuxagent/common/version.py
++++ b/azurelinuxagent/common/version.py
+@@ -20,13 +20,10 @@
+ import platform
+ import sys
+ 
+-if float(sys.version[:3]) >= 3.5:
+-    import distro
+-
+ import azurelinuxagent.common.conf as conf
+ import azurelinuxagent.common.utils.fileutil as fileutil
+ from azurelinuxagent.common.utils.flexible_version import FlexibleVersion
+-from azurelinuxagent.common.future import ustr
++from azurelinuxagent.common.future import ustr, get_linux_distribution
+ 
+ 
+ def get_f5_platform():
+@@ -84,20 +81,7 @@ def get_distro():
+         release = re.sub('\-.*\Z', '', ustr(platform.release()))
+         osinfo = ['openbsd', release, '', 'openbsd']
+     elif 'Linux' in platform.system():
+-        # platform.linux_distribution and platform.dist deprecated in
+-        # Python 3.5 and removed in Python 3.7
+-        if float(sys.version[:3]) >= 3.5:
+-            platform_module = distro
+-            osinfo = list(distro.linux_distribution(full_distribution_name=0))
+-        else:
+-            platform_module = platform
+-            supported = platform._supported_dists + ('alpine',)
+-            osinfo = list(platform.linux_distribution(
+-                full_distribution_name=0,
+-                supported_dists=supported
+-            ))
+-        full_name = platform_module.linux_distribution()[0].strip()
+-        osinfo.append(full_name)
++        osinfo = get_linux_distribution(0, 'alpine')
+     else:
+         try:
+             # dist() removed in Python 3.7
+
+From d0a21f6bee9f216b64f1a3a0a401b72287139ade Mon Sep 17 00:00:00 2001
+From: Robert Schweikert <[email protected]>
+Date: Tue, 13 Feb 2018 09:02:57 -0500
+Subject: [PATCH 3/4] - Do not check the Python version to determine
+ implementation to use   for the collection of distribution information. Rely
+ on behavior.   + Dependency management is a bit more tricky and requires more
+ user     knowledge
+
+---
+ azurelinuxagent/common/future.py | 53 ++++++++++++++++++++++++++++------------
+ setup.py                         | 12 ++++++---
+ 2 files changed, 46 insertions(+), 19 deletions(-)
+
+diff --git a/azurelinuxagent/common/future.py 
b/azurelinuxagent/common/future.py
+index f400ce02..940874d1 100644
+--- a/azurelinuxagent/common/future.py
++++ b/azurelinuxagent/common/future.py
+@@ -1,8 +1,12 @@
+ import platform
+ import sys
+ 
+-if float(sys.version[:3]) >= 3.5:
++# Note broken dependency handling to avoid potential backward
++# compantibility issues
++try:
+     import distro
++except Exception:
++    pass
+     
+ """
+ Add alias for python2 and python3 libs and functions.
+@@ -32,20 +36,39 @@
+ 
+ def get_linux_distribution(get_full_name, supported_dists):
+     """Abstract platform.linux_distribution() call which is deprecated as of
+-       Python 3.5"""
+-    if float(sys.version[:3]) >= 3.5:
+-        platform_module = distro
+-        osinfo = list(distro.linux_distribution(
+-            full_distribution_name=get_full_name
+-        ))
+-    else:
+-        platform_module = platform
++       Python 3.5 and removed in Python 3.7"""
++    try:
+         supported = platform._supported_dists + (supported_dists,)
+-        osinfo = list(platform.linux_distribution(
+-            full_distribution_name=get_full_name,
+-            supported_dists=supported
+-        ))
+-    full_name = platform_module.linux_distribution()[0].strip()
+-    osinfo.append(full_name)
++        osinfo = list(
++            platform.linux_distribution(
++                full_distribution_name=get_full_name,
++                supported_dists=supported
++            )
++        )
++        if not osinfo or osinfo == ['','','']:
++            return get_linux_ditribution_from_distro(get_full_name)
++        full_name = platform_module.linux_distribution()[0].strip()
++        osinfo.append(full_name)
++    except Exception:
++        return get_linux_ditribution_from_distro(get_full_name)
++
++    return osinfo
+ 
++def get_linux_ditribution_from_distro(get_full_name):
++    """Get the distribution information from the distro Python module."""
++    # If we get here we have to have the distro module, thus we do
++    # not wrap the call in a try-except block as it would mask the problem
++    # and result in a broken agent installation
++    osinfo = list(
++        distro.linux_distribution(
++            full_distribution_name=get_full_name
++        )
++    )
++    full_name = distro.linux_distribution()[0].strip()
++    osinfo.append(full_name)
+     return osinfo
++
++
++
++
++    
+diff --git a/setup.py b/setup.py
+index ae6983cc..f5b30343 100755
+--- a/setup.py
++++ b/setup.py
+@@ -199,9 +199,14 @@ def run(self):
+             osutil.stop_agent_service()
+             osutil.start_agent_service()
+ 
+-requires = []
+-if float(sys.version[:3]) >= 3.5:
+-    requires = ['distro']
++# Note to packagers and users fromn source.
++# In version 3.5 of Python distribution information handling in the platform
++# module was deprecated. Depending on the Linux distribution the
++# implementation may be broken prior to Python 3.7 thus you may or may not
++# need to install the distro Python package. Due to concerns of breakage
++# the code cannot handle this automagically
++#if float(sys.version[:3]) >= 3.5:
++#    requires = ['distro']
+ 
+ setuptools.setup(
+     name=AGENT_NAME,
+@@ -213,7 +218,6 @@ def run(self):
+     url='https://github.com/Azure/WALinuxAgent',
+     license='Apache License Version 2.0',
+     packages=find_packages(exclude=["tests"]),
+-    install_requires=requires,
+     py_modules=["__main__"],
+     cmdclass={
+         'install': install
+
+From e87266c774e2dd584dd839c58c0ff6ce32e2865a Mon Sep 17 00:00:00 2001
+From: Robert Schweikert <[email protected]>
+Date: Thu, 15 Feb 2018 09:38:59 -0500
+Subject: [PATCH 4/4] - Require distro module for Python 3.7 and greater - Fix
+ typos
+
+---
+ azurelinuxagent/common/future.py | 12 ++++++------
+ setup.py                         | 13 +++++++------
+ 2 files changed, 13 insertions(+), 12 deletions(-)
+
+diff --git a/azurelinuxagent/common/future.py 
b/azurelinuxagent/common/future.py
+index 940874d1..e630f26d 100644
+--- a/azurelinuxagent/common/future.py
++++ b/azurelinuxagent/common/future.py
+@@ -2,7 +2,7 @@
+ import sys
+ 
+ # Note broken dependency handling to avoid potential backward
+-# compantibility issues
++# compatibility issues on different distributions
+ try:
+     import distro
+ except Exception:
+@@ -46,15 +46,15 @@ def get_linux_distribution(get_full_name, supported_dists):
+             )
+         )
+         if not osinfo or osinfo == ['','','']:
+-            return get_linux_ditribution_from_distro(get_full_name)
+-        full_name = platform_module.linux_distribution()[0].strip()
++            return get_linux_distribution_from_distro(get_full_name)
++        full_name = platform.linux_distribution()[0].strip()
+         osinfo.append(full_name)
+-    except Exception:
+-        return get_linux_ditribution_from_distro(get_full_name)
++    except AttributeError:
++        return get_linux_distribution_from_distro(get_full_name)
+ 
+     return osinfo
+ 
+-def get_linux_ditribution_from_distro(get_full_name):
++def get_linux_distribution_from_distro(get_full_name):
+     """Get the distribution information from the distro Python module."""
+     # If we get here we have to have the distro module, thus we do
+     # not wrap the call in a try-except block as it would mask the problem
+diff --git a/setup.py b/setup.py
+index f5b30343..5be2c42b 100755
+--- a/setup.py
++++ b/setup.py
+@@ -199,14 +199,14 @@ def run(self):
+             osutil.stop_agent_service()
+             osutil.start_agent_service()
+ 
+-# Note to packagers and users fromn source.
++# Note to packagers and users from source.
+ # In version 3.5 of Python distribution information handling in the platform
+ # module was deprecated. Depending on the Linux distribution the
+-# implementation may be broken prior to Python 3.7 thus you may or may not
+-# need to install the distro Python package. Due to concerns of breakage
+-# the code cannot handle this automagically
+-#if float(sys.version[:3]) >= 3.5:
+-#    requires = ['distro']
++# implementation may be broken prior to Python 3.7 wher the functionality
++# will be removed from Python 3
++requires = []
++if float(sys.version[:3]) >= 3.7:
++    requires = ['distro']
+ 
+ setuptools.setup(
+     name=AGENT_NAME,
+@@ -219,6 +219,7 @@ def run(self):
+     license='Apache License Version 2.0',
+     packages=find_packages(exclude=["tests"]),
+     py_modules=["__main__"],
++    install_requires=requires,
+     cmdclass={
+         'install': install
+     }

++++++ paa_force_py3_sle15.patch ++++++
--- bin/waagent.orig
+++ bin/waagent
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 #
 # Azure Linux Agent
 #

Reply via email to