Add fixes for python 3.6
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
016cdad351
commit
75eb5cc677
54
0001-Fix-running-of-nosetests-on-python-3.patch
Normal file
54
0001-Fix-running-of-nosetests-on-python-3.patch
Normal file
@ -0,0 +1,54 @@
|
||||
From a99e9fe20ebce4fa208cc0f0599830facf1cc06c Mon Sep 17 00:00:00 2001
|
||||
From: "Daniel P. Berrange" <berrange@redhat.com>
|
||||
Date: Wed, 14 Dec 2016 10:58:52 +0000
|
||||
Subject: [PATCH] Fix running of nosetests on python 3
|
||||
|
||||
Previously the way Fedora installed /usr/bin/nosetests allowed it
|
||||
to be invoked with either python 2 or 3. Since Fedora 25 though,
|
||||
it contains a module name that only exists on python 2. So we need
|
||||
to be more intelligent and pick a different nosetests binary per
|
||||
version.
|
||||
|
||||
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
---
|
||||
setup.py | 17 ++++++++++++++++-
|
||||
1 file changed, 16 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/setup.py b/setup.py
|
||||
index bbcfe87..0d65763 100755
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -277,6 +277,20 @@ class my_test(Command):
|
||||
self.build_platlib = os.path.join(self.build_base,
|
||||
'lib' + plat_specifier)
|
||||
|
||||
+ def find_nosetests_path(self):
|
||||
+ paths = [
|
||||
+ "/usr/bin/nosetests-%d.%d" % (sys.version_info[0],
|
||||
+ sys.version_info[1]),
|
||||
+ "/usr/bin/nosetests-%d" % (sys.version_info[0]),
|
||||
+ "/usr/bin/nosetests",
|
||||
+ ]
|
||||
+
|
||||
+ for path in paths:
|
||||
+ if os.path.exists(path):
|
||||
+ return path
|
||||
+
|
||||
+ raise Exception("Cannot find any nosetests binary")
|
||||
+
|
||||
def run(self):
|
||||
"""
|
||||
Run test suite
|
||||
@@ -289,7 +303,8 @@ class my_test(Command):
|
||||
else:
|
||||
os.environ["PYTHONPATH"] = self.build_platlib
|
||||
self.spawn([sys.executable, "sanitytest.py", self.build_platlib, apis[0]])
|
||||
- self.spawn([sys.executable, "/usr/bin/nosetests"])
|
||||
+ nose = self.find_nosetests_path()
|
||||
+ self.spawn([sys.executable, nose])
|
||||
|
||||
|
||||
class my_clean(clean):
|
||||
--
|
||||
2.9.3
|
||||
|
30
0001-Remove-bogus-o-escape-in-regex.patch
Normal file
30
0001-Remove-bogus-o-escape-in-regex.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From f5edaf1ba5bc2db38ae0c7f595e17aff9d89dcfa Mon Sep 17 00:00:00 2001
|
||||
From: "Daniel P. Berrange" <berrange@redhat.com>
|
||||
Date: Wed, 21 Dec 2016 10:35:17 +0000
|
||||
Subject: [PATCH] Remove bogus \o escape in regex
|
||||
|
||||
One of the regexes has a bogus \o instead of plain 'o'. Somehow
|
||||
this magically worked on all versions of python, until 3.6 came
|
||||
along and complained
|
||||
|
||||
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
---
|
||||
generator.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/generator.py b/generator.py
|
||||
index 730e456..2c3b667 100755
|
||||
--- a/generator.py
|
||||
+++ b/generator.py
|
||||
@@ -1091,7 +1091,7 @@ def is_integral_type (name):
|
||||
return not re.search ("^(unsigned)? ?(int|long)$", name) is None
|
||||
|
||||
def is_optional_arg(info):
|
||||
- return re.search("^\(?\optional\)?", info) is not None
|
||||
+ return re.search("^\(?optional\)?", info) is not None
|
||||
# Functions returning lists which need special rules to check for errors
|
||||
# and raise exceptions.
|
||||
functions_list_exception_test = {
|
||||
--
|
||||
2.9.3
|
||||
|
@ -9,6 +9,8 @@ Name: libvirt-python
|
||||
Version: 2.5.0
|
||||
Release: 2%{?dist}%{?extra_release}
|
||||
Source0: http://libvirt.org/sources/python/%{name}-%{version}.tar.gz
|
||||
Patch1: 0001-Remove-bogus-o-escape-in-regex.patch
|
||||
Patch2: 0001-Fix-running-of-nosetests-on-python-3.patch
|
||||
Url: http://libvirt.org
|
||||
License: LGPLv2+
|
||||
Group: Development/Libraries
|
||||
@ -48,6 +50,8 @@ of recent versions of Linux (and other OSes).
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
|
||||
# Unset execute bit for example scripts; it can introduce spurious
|
||||
# RPM dependencies, like /usr/bin/python which can pull in python2
|
||||
|
Loading…
Reference in New Issue
Block a user