Bug#903016: python3-libvirt: import fails with current python interpreter in sid

2018-07-16 Thread Guido Günther
Hi,
On Thu, Jul 05, 2018 at 07:45:30AM +0200, Manuel Traut wrote:
> Package: python3-libvirt
> Version: 4.0.0-1+b1
> Severity: grave
> Tags: patch
> Justification: renders package unusable
> 
> Dear Maintainer,
> 
> the package is broken on sid:
> 
> The following packages were automatically installed and are no longer 
> required:
>   iputils-arping liblogging-stdlog0 libnginx-mod-http-auth-pam 
> libnginx-mod-http-dav-ext libnginx-mod-http-echo libngin
>   libnginx-mod-http-xslt-filter libnginx-mod-mail libnginx-mod-stream 
> libplacebo4 libwireshark10 libwiretap7 libwscodec
> Use 'sudo apt autoremove' to remove them.
> The following packages have been kept back:
>   medcon xmedcon
> 0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
> 1 not fully installed or removed.
> After this operation, 0 B of additional disk space will be used.
> Do you want to continue? [Y/n]
> Setting up python3-libvirt (4.0.0-1+b1) ...
>   File "/usr/lib/python3/dist-packages/libvirtaio.py", line 49
> from asyncio import async as ensure_future
> ^
> SyntaxError: invalid syntax
> 
> dpkg: error processing package python3-libvirt (--configure):
>  installed python3-libvirt package post-installation script subprocess 
> returned error exit status 1
> Errors were encountered while processing:
>  python3-libvirt
> E: Sub-process /usr/bin/dpkg returned an error code (1)
> 
> The problem is fixed upstream with this commit:
> 
> https://github.com/libvirt/libvirt-python/commit/e27528204c887b4099b892a0237766f187959737#diff-cd56dd4108fa77f26cb6c1e6358beba1

Instead of backporting that one I want to update to a new upstream
version but that needs a newer libirt which has some problems I need to
look into first during the week.
Cheers,
 -- Guido



Bug#903016: python3-libvirt: import fails with current python interpreter in sid

2018-07-04 Thread Manuel Traut
Package: python3-libvirt
Version: 4.0.0-1+b1
Severity: grave
Tags: patch
Justification: renders package unusable

Dear Maintainer,

the package is broken on sid:

The following packages were automatically installed and are no longer required:
  iputils-arping liblogging-stdlog0 libnginx-mod-http-auth-pam 
libnginx-mod-http-dav-ext libnginx-mod-http-echo libngin
  libnginx-mod-http-xslt-filter libnginx-mod-mail libnginx-mod-stream 
libplacebo4 libwireshark10 libwiretap7 libwscodec
Use 'sudo apt autoremove' to remove them.
The following packages have been kept back:
  medcon xmedcon
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up python3-libvirt (4.0.0-1+b1) ...
  File "/usr/lib/python3/dist-packages/libvirtaio.py", line 49
from asyncio import async as ensure_future
^
SyntaxError: invalid syntax

dpkg: error processing package python3-libvirt (--configure):
 installed python3-libvirt package post-installation script subprocess returned 
error exit status 1
Errors were encountered while processing:
 python3-libvirt
E: Sub-process /usr/bin/dpkg returned an error code (1)

The problem is fixed upstream with this commit:

https://github.com/libvirt/libvirt-python/commit/e27528204c887b4099b892a0237766f187959737#diff-cd56dd4108fa77f26cb6c1e6358beba1



-- System Information:
Debian Release: buster/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armhf

Kernel: Linux 4.16.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages python3-libvirt depends on:
ii  libc6 2.27-3
ii  libvirt0  4.3.0-1
ii  python3   3.6.6-1

Versions of packages python3-libvirt recommends:
ii  libvirt-daemon  4.3.0-1

python3-libvirt suggests no packages.

-- debconf-show failed
>From e27528204c887b4099b892a0237766f187959737 Mon Sep 17 00:00:00 2001
From: Cole Robinson 
Date: Mon, 25 Jun 2018 14:14:57 -0400
Subject: [PATCH 1/2] libvirtaio: Fix compat with python 3.7

In python 3.7, async is now a keyword, so this throws a syntax error:

  File "/usr/lib64/python3.7/site-packages/libvirtaio.py", line 49
from asyncio import async as ensure_future
^
  SyntaxError: invalid syntax

Switch to getattr trickery to accomplish the same goal

Reviewed-by: Pavel Hrdina 
Reviewed-by: Andrea Bolognani 
Signed-off-by: Cole Robinson 
---
 libvirtaio.py | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libvirtaio.py b/libvirtaio.py
index 1c432dd..328e6f2 100644
--- a/libvirtaio.py
+++ b/libvirtaio.py
@@ -43,10 +43,13 @@ import warnings
 
 import libvirt
 
-try:
-from asyncio import ensure_future
-except ImportError:
-from asyncio import async as ensure_future
+# Python < 3.4.4 doesn't have 'ensure_future', so we have to fall
+# back to 'async'; however, since 'async' is a reserved keyword
+# in Python >= 3.7, we can't perform a straightforward import and
+# we have to resort to getattr() instead
+ensure_future = getattr(asyncio, "ensure_future", None)
+if not ensure_future:
+ensure_future = getattr(asyncio, "async")
 
 
 class Callback(object):
-- 
2.18.0