libselinux/Fix-import-error-in-python2-package.patch
wei dong e4bf6839af Fix import error in python2-selinux
(cherry picked from commit e964d6af6520351beb6393d0f632a9bd3b9761e8)
2021-05-28 09:35:10 +08:00

30 lines
1.3 KiB
Diff

From 2712100eaed081a454f5eff88dc6fae74ecb1aef Mon Sep 17 00:00:00 2001
From: wei dong <weidong@uniontech.com>
Date: Thu, 13 May 2021 16:43:20 +0800
Subject: [PATCH] Fix import error in python2 package
---
src/Makefile | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/Makefile b/src/Makefile
index 190016e..5e7baa9 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -15,7 +15,11 @@ INCLUDEDIR ?= $(PREFIX)/include
PYINC ?= $(shell $(PKG_CONFIG) --cflags $(PYPREFIX))
PYLIBS ?= $(shell $(PKG_CONFIG) --libs $(PYPREFIX))
PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(plat_specific=1, prefix='$(PREFIX)'))")
-PYCEXT ?= $(shell $(PYTHON) -c 'import importlib.machinery;print(importlib.machinery.EXTENSION_SUFFIXES[0])')
+ifeq ($(shell $(PYTHON) -c 'import sys;print(sys.version_info[0])'), 3)
+ PYCEXT ?= $(shell $(PYTHON) -c 'import importlib.machinery;print(importlib.machinery.EXTENSION_SUFFIXES[0])')
+else
+ PYCEXT ?= .so
+endif
RUBYINC ?= $(shell $(RUBY) -e 'puts "-I" + RbConfig::CONFIG["rubyarchhdrdir"] + " -I" + RbConfig::CONFIG["rubyhdrdir"]')
RUBYLIBS ?= $(shell $(RUBY) -e 'puts "-L" + RbConfig::CONFIG["libdir"] + " -L" + RbConfig::CONFIG["archlibdir"] + " " + RbConfig::CONFIG["LIBRUBYARG_SHARED"]')
RUBYINSTALL ?= $(shell $(RUBY) -e 'puts RbConfig::CONFIG["vendorarchdir"]')
--
2.27.0