Add patch to fix python3.8 compat
https://bugzilla.redhat.com/show_bug.cgi?id=1708643
This commit is contained in:
parent
0b2db4436c
commit
f3fe3754ec
2 changed files with 56 additions and 0 deletions
|
|
@ -0,0 +1,54 @@
|
|||
From 8185dc37e0c03b62268c025e7b59bb4e8644f6a1 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Sat, 13 Jul 2019 00:36:49 +0200
|
||||
Subject: [PATCH] Read os-release instead of using
|
||||
platform.linux_distribution()
|
||||
|
||||
The function was removed in https://bugs.python.org/issue1322
|
||||
and cannot be used in python3.8.
|
||||
|
||||
There are replacements outside of the stdlib, but it doesn't seem
|
||||
worth it it add a dependency on another module. Instead, a simple
|
||||
parser for os-release is implemented. os-release is present on all
|
||||
distros from the last few years and PRETTY_NAME gives a reliable
|
||||
display name of the distro without any heuristics.
|
||||
---
|
||||
blosc/toplevel.py | 18 +++++++++++++++++-
|
||||
1 file changed, 17 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/blosc/toplevel.py b/blosc/toplevel.py
|
||||
index 04ad9f0217..94cf4af910 100644
|
||||
--- a/blosc/toplevel.py
|
||||
+++ b/blosc/toplevel.py
|
||||
@@ -800,6 +800,20 @@ def load_tests(loader, tests, pattern):
|
||||
tests.addTests(doctest.DocTestSuite())
|
||||
return tests
|
||||
|
||||
+def os_release_pretty_name():
|
||||
+ for p in ('/etc/os-release', '/usr/lib/os-release'):
|
||||
+ try:
|
||||
+ f = open(p, 'rt')
|
||||
+ for line in f:
|
||||
+ name, _, value = line.rstrip().partition('=')
|
||||
+ if name == 'PRETTY_NAME':
|
||||
+ if len(value) >= 2 and value[0] in '"\'' and value[0] == value[-1]:
|
||||
+ value = value[1:-1]
|
||||
+ return value
|
||||
+ except IOError:
|
||||
+ pass
|
||||
+ else:
|
||||
+ return None
|
||||
|
||||
def print_versions():
|
||||
"""Print all the versions of software that python-blosc relies on."""
|
||||
@@ -815,7 +829,9 @@ def print_versions():
|
||||
(sysname, nodename, release, version, machine, processor) = platform.uname()
|
||||
print("Platform: %s-%s-%s (%s)" % (sysname, release, machine, version))
|
||||
if sysname == "Linux":
|
||||
- print("Linux dist: %s" % " ".join(platform.linux_distribution()[:-1]))
|
||||
+ distro = os_release_pretty_name()
|
||||
+ if distro:
|
||||
+ print("Linux dist:", distro)
|
||||
if not processor:
|
||||
processor = "not recognized"
|
||||
print("Processor: %s" % processor)
|
||||
|
|
@ -10,6 +10,8 @@ Source0: https://github.com/Blosc/python-blosc/archive/v%{version}/blosc-
|
|||
Patch1: 0001-blosc_extenion-constify-char-pointers-for-Py_BuildVa.patch
|
||||
Patch2: 0002-setup.py-unbreak-build-on-architectures-which-don-t-.patch
|
||||
Patch3: 0003-setup.py-catch-import-error-for-cpuinfo.patch
|
||||
# https://github.com/Blosc/python-blosc/pull/202
|
||||
Patch4: 0004-Read-os-release-instead-of-using-platform.linux_dist.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: blosc-devel >= 1.16.0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue