Blob Blame History Raw
From 3e93a56f6e45dfb71cd34d5487aa07e1dee02a72 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Tue, 19 Nov 2019 10:00:39 -0500
Subject: [PATCH] Make it build with /usr/bin/python2 and
 /usr/include/python2.7/

Signed-off-by: Peter Jones <pjones@redhat.com>
---
 Makefile    | 4 ++--
 __init__.py | 2 +-
 device.py   | 2 +-
 dm.c        | 3 ++-
 maps.py     | 2 +-
 5 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index ee84389a91a..bb54154a8dc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,10 @@
 
 DESTDIR := 
-SITELIB := $(shell python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)[1:]")
+SITELIB := $(shell python2 -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)[1:]")
 DEBUGSRC := "/usr/src/debug"
 DEBUGLIB := "/usr/lib/debug"
 CC := gcc
-PYVER := $(shell python -c "import sys; print sys.version[0:3]")
+PYVER := $(shell python2 -c "import sys; print sys.version[0:3]")
 CFLAGS := -g -I/usr/include/python$(PYVER) -Wall -Werror -fPIC $(OPTFLAGS) -fno-strict-aliasing
 LDFLAGS := -shared
 
diff --git a/__init__.py b/__init__.py
index a3ea35b89d0..84ad6a63823 100644
--- a/__init__.py
+++ b/__init__.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
 # 
 # Copyright 2005-2007 Red Hat, Inc.
 # 
diff --git a/device.py b/device.py
index ee841daed61..75692a782b3 100644
--- a/device.py
+++ b/device.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
 # 
 # Copyright 2005-2007 Red Hat, Inc.
 # 
diff --git a/dm.c b/dm.c
index 5daa0e5b053..b650f5fcff0 100644
--- a/dm.c
+++ b/dm.c
@@ -27,6 +27,7 @@
 #include <sys/ioctl.h>
 #include <linux/fs.h>
 #include <linux/blkpg.h>
+#include <sys/sysmacros.h>
 
 #include <libdevmapper.h>
 #ifdef USESELINUX
@@ -645,7 +646,7 @@ PydmTable_FromInfo(loff_t start, u_int64_t size, char *type, char *params)
 
 	rc = pydm_init_table((PydmTableObject *)self, start, size,
 			type, params);
-	if (!rc < 0) {
+	if (rc < 0) {
 		Py_DECREF(self);
 		return NULL;
 	}
diff --git a/maps.py b/maps.py
index ccc8ca5f8f8..409ee58640b 100644
--- a/maps.py
+++ b/maps.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
 # 
 # Copyright 2005-2007 Red Hat, Inc.
 # 
-- 
2.23.0