Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1705219 - WALinuxAgent FTBFS with Python 3.8
Summary: WALinuxAgent FTBFS with Python 3.8
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: WALinuxAgent
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Vitaly Kuznetsov
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON38
TreeView+ depends on / blocked
 
Reported: 2019-05-01 18:56 UTC by Miro Hrončok
Modified: 2019-06-03 16:38 UTC (History)
2 users (show)

Fixed In Version: WALinuxAgent-2.2.40-1.fc31
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-06-03 16:38:57 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Full log from Copr (89.81 KB, text/plain)
2019-05-01 18:56 UTC, Miro Hrončok
no flags Details

Description Miro Hrončok 2019-05-01 18:56:01 UTC
Created attachment 1561036 [details]
Full log from Copr

Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.2odnAu
+ umask 022
+ cd /builddir/build/BUILD
+ cd WALinuxAgent-2.2.38
+ CFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection'
+ LDFLAGS='-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld'
+ /usr/bin/python3 setup.py build '--executable=/usr/bin/python3 -s'
/builddir/build/BUILD/WALinuxAgent-2.2.38/azurelinuxagent/common/version.py:36: SyntaxWarning: invalid escape sequence \d
  f5_version = re.compile("^Version: (\d+\.\d+\.\d+)")
/builddir/build/BUILD/WALinuxAgent-2.2.38/azurelinuxagent/common/version.py:37: SyntaxWarning: invalid escape sequence \w
  f5_product = re.compile("^Product: ([\w-]+)")
/builddir/build/BUILD/WALinuxAgent-2.2.38/azurelinuxagent/common/version.py:86: SyntaxWarning: invalid escape sequence \-
  release = re.sub('\-.*\Z', '', ustr(platform.release()))
/builddir/build/BUILD/WALinuxAgent-2.2.38/azurelinuxagent/common/version.py:81: SyntaxWarning: invalid escape sequence \-
  release = re.sub('\-.*\Z', '', ustr(platform.release()))
/builddir/build/BUILD/WALinuxAgent-2.2.38/azurelinuxagent/common/version.py:78: SyntaxWarning: invalid escape sequence \-
  release = re.sub('\-.*\Z', '', ustr(platform.release()))
/builddir/build/BUILD/WALinuxAgent-2.2.38/azurelinuxagent/common/version.py:135: SyntaxWarning: invalid escape sequence \.
  AGENT_PKG_PATTERN = re.compile(AGENT_PATTERN+"\.zip")
/builddir/build/BUILD/WALinuxAgent-2.2.38/azurelinuxagent/common/version.py:138: SyntaxWarning: invalid escape sequence \d
  EXT_HANDLER_PATTERN = b".*/WALinuxAgent-(\d+.\d+.\d+[.\d+]*).*-run-exthandlers"
/builddir/build/BUILD/WALinuxAgent-2.2.38/azurelinuxagent/common/exception.py:46: SyntaxWarning: invalid escape sequence \.
  """
/builddir/build/BUILD/WALinuxAgent-2.2.38/azurelinuxagent/common/utils/flexible_version.py:178: SyntaxWarning: invalid escape sequence \d
  release_re = '(?:{prerel_sep}(?P<{tn}>{tags})(?P<{nn}>\d*))?'.format(
Traceback (most recent call last):
  File "/builddir/build/BUILD/WALinuxAgent-2.2.38/azurelinuxagent/common/future.py", line 43, in get_linux_distribution
    supported = platform._supported_dists + (supported_dists,)
AttributeError: module 'platform' has no attribute '_supported_dists'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "setup.py", line 21, in <module>
    from azurelinuxagent.common.version import AGENT_NAME, AGENT_VERSION, \
  File "/builddir/build/BUILD/WALinuxAgent-2.2.38/azurelinuxagent/common/version.py", line 141, in <module>
    __distro__ = get_distro()
  File "/builddir/build/BUILD/WALinuxAgent-2.2.38/azurelinuxagent/common/version.py", line 84, in get_distro
    osinfo = get_linux_distribution(0, 'alpine')
  File "/builddir/build/BUILD/WALinuxAgent-2.2.38/azurelinuxagent/common/future.py", line 61, in get_linux_distribution
    return get_linux_distribution_from_distro(get_full_name)
  File "/builddir/build/BUILD/WALinuxAgent-2.2.38/azurelinuxagent/common/future.py", line 72, in get_linux_distribution_from_distro
    distro.linux_distribution(
NameError: name 'distro' is not defined
error: Bad exit status from /var/tmp/rpm-tmp.2odnAu (%build)


This is WALinuxAgent-2.2.38-2.fc31.

Full log attached.

Possibly related: platform.dist was deprecated since 3.5 and removed in 3.8:

https://docs.python.org/3.7/library/platform.html#platform.dist


$ python3.7 -c 'import platform; print(platform._supported_dists)'
('SuSE', 'debian', 'fedora', 'redhat', 'centos', 'mandrake', 'mandriva', 'rocks', 'slackware', 'yellowdog', 'gentoo', 'UnitedLinux', 'turbolinux', 'arch', 'mageia')

$ python3.8 -c 'import platform; print(platform._supported_dists)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'platform' has no attribute '_supported_dists'

Comment 1 Vitaly Kuznetsov 2019-06-03 13:41:21 UTC
I'll take this, I think it was already fixed upstream.

Comment 2 Vitaly Kuznetsov 2019-06-03 15:39:38 UTC
The issue arises when python3-distro is not present in buildroot and it wasn't among build dependencies. The code in the package is

try:
    import distro
except Exception:
    pass

and then we do (simplified):

try:
    supported = platform._supported_dists + (supported_dists,)
except AttributeError:
    return distro.linux_distribution()...

The package gets this dependency when build:

# rpm -q --requires WALinuxAgent | grep distro
python3.7dist(distro)

So the bottom line is: I believe that adding 
BuildRequires:  python3-distro

will fix the issue. I, however, have no idea how to check before Python3.8 lands. I checked locally with python38 package
and distro.py thrown into /usr/lib/python3.8/site-packages/ and 'python3.8 setup.py build' succeeds. I'm going to push this to rawhide.

Comment 3 Miro Hrončok 2019-06-03 15:45:24 UTC
You can check in mock: https://copr.fedorainfracloud.org/coprs/g/python/python3.8/

Comment 4 Vitaly Kuznetsov 2019-06-03 16:27:20 UTC
(In reply to Miro Hrončok from comment #3)
> You can check in mock:
> https://copr.fedorainfracloud.org/coprs/g/python/python3.8/

This worked, thanks. And apparently I was right about the fix as mockbuild succeeds.

Comment 5 Miro Hrončok 2019-06-03 16:38:57 UTC
Thank you, built in our copr.


Note You need to log in before you can comment on or make changes to this bug.