summarylogtreecommitdiffstats
path: root/0001-Fix-distro-check.patch
blob: 23221a7eacabf2354f5035e0356552800bf53e63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From e8052cf7edd6269e31566120653a06d89965fdcd Mon Sep 17 00:00:00 2001
From: peeweep <peeweep@0x0.ee>
Date: Tue, 31 Dec 2019 15:18:10 +0800
Subject: [PATCH] Fix distro check

Function platform.linux_distribution() removed since Python 3.8.

error message:

    Traceback (most recent call last):
      File "setup.py", line 23, in <module>
        if ('Fedora' == platform.linux_distribution()[0] or
    AttributeError: module 'platform' has no attribute 'linux_distribution'
---
 setup.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/setup.py b/setup.py
index 68667c9..e2490ad 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
 # encoding: utf-8
 from distutils.core import setup,Extension
 import sys, glob
-import platform
+import distro
 
 # vectorization is currently broken and experimental ONLY
 vectorize=False
@@ -20,8 +20,7 @@ if sys.platform=='win32':
     # * https://bugs.launchpad.net/panda3d/+bug/919237
         define_macros+=[('EIGEN_DONT_VECTORIZE',None)]
 else:
-    if ('Fedora' == platform.linux_distribution()[0] or
-        'CentOS' in platform.linux_distribution()[0]):
+    if distro.id() in {'fedora','centos','arch'}:
         libraries=['boost_python%s'%('' if sys.version_info[0] == 2 else '3')]
     else:
         libraries=['boost_python-py%d%d'%(sys.version_info[0],sys.version_info[1])]
-- 
2.24.1