summaryrefslogtreecommitdiff
path: root/libraries/stfl/python-support.patch
blob: 514d93af25de400ca14e7e2845740c19d8cc541d (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
diff -Nur stfl-0.24/Makefile stfl-0.24-py3/Makefile
--- stfl-0.24/Makefile	2015-02-12 05:14:33.000000000 -0800
+++ stfl-0.24-py3/Makefile	2018-03-18 20:44:29.103012040 -0700
@@ -48,6 +48,8 @@
 	rm -f perl5/stfl_wrap.c perl5/stfl.pm perl5/build_ok
 	rm -f python/stfl.py python/stfl.pyc python/_stfl.so 
 	rm -f python/stfl_wrap.c python/stfl_wrap.o
+	rm -f python3/stfl.py python3/stfl.pyc python3/_stfl.so 
+	rm -f python3/stfl_wrap.c python3/stfl_wrap.o
 	rm -f ruby/Makefile ruby/stfl_wrap.c ruby/stfl_wrap.o
 	rm -f ruby/stfl.so ruby/build_ok Makefile.deps_new
 	rm -f stfl.pc libstfl.so libstfl.so.*
@@ -81,6 +83,10 @@
 include python/Makefile.snippet
 endif
 
+ifeq ($(FOUND_SWIG)$(FOUND_PYTHON3),11)
+include python3/Makefile.snippet
+endif
+
 ifeq ($(FOUND_SWIG)$(FOUND_RUBY),11)
 include ruby/Makefile.snippet
 endif
diff -Nur stfl-0.24/Makefile.cfg stfl-0.24-py3/Makefile.cfg
--- stfl-0.24/Makefile.cfg	2009-05-31 11:20:39.000000000 -0700
+++ stfl-0.24-py3/Makefile.cfg	2018-03-18 20:59:24.365022626 -0700
@@ -46,6 +46,12 @@
 FOUND_PYTHON = 0
 endif
 
+ifneq ($(shell python3 -c 'print(1)' 2>/dev/null),)
+FOUND_PYTHON3 = 1
+else
+FOUND_PYTHON3 = 0
+endif
+
 ifneq ($(shell ruby -e 'puts 1' 2>/dev/null),)
 FOUND_RUBY = 1
 else
diff -Nur stfl-0.24/python/Makefile.snippet stfl-0.24-py3/python/Makefile.snippet
--- stfl-0.24/python/Makefile.snippet	2009-06-18 01:27:16.000000000 -0700
+++ stfl-0.24-py3/python/Makefile.snippet	2018-03-18 21:04:57.805026569 -0700
@@ -33,8 +33,7 @@
 
 install_python: python/_stfl.so python/stfl.py python/stfl.pyc
 	mkdir -p $(DESTDIR)$(PYTHON_SITEARCH)/
-	mkdir -p $(DESTDIR)$(PYTHON_SITEARCH)/lib-dynload/
-	cp python/_stfl.so $(DESTDIR)$(PYTHON_SITEARCH)/lib-dynload/
+	cp python/_stfl.so $(DESTDIR)$(PYTHON_SITEARCH)/
 	cp python/stfl.pyc $(DESTDIR)$(PYTHON_SITEARCH)/
 	cp python/stfl.py $(DESTDIR)$(PYTHON_SITEARCH)/
 
diff -Nur stfl-0.24/python3/Makefile.snippet stfl-0.24-py3/python3/Makefile.snippet
--- stfl-0.24/python3/Makefile.snippet	2018-03-18 21:02:25.523024769 -0700
+++ stfl-0.24-py3/python3/Makefile.snippet	2018-03-18 20:56:37.624020655 -0700
@@ -18,23 +18,22 @@
 #  MA 02110-1301 USA
 #
 
-PYTHON_VERSION = $(shell python -V 2>&1 | cut -f2 -d' ' | cut -f1-2 -d'.')
-PYTHON_SITEARCH = $(shell python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")
+PYTHON3_VERSION = $(shell python3 -V 2>&1 | cut -f2 -d' ' | cut -f1-2 -d'.')
+PYTHON3_SITEARCH = $(shell python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
 
-all: python/_stfl.so python/stfl.py python/stfl.pyc
+all: python3/_stfl.so python3/stfl.py python3/stfl.pyc
 
-install: install_python
+install: install_python3
 
-python/_stfl.so python/stfl.py python/stfl.pyc: libstfl.a stfl.h python/stfl.i swig/*.i
-	cd python && swig -python -threads stfl.i
-	gcc -shared -pthread -fPIC python/stfl_wrap.c -I/usr/include/python$(PYTHON_VERSION) \
-		-I. libstfl.a -lncursesw -o python/_stfl.so
-	cd python && python -c 'import stfl'
-
-install_python: python/_stfl.so python/stfl.py python/stfl.pyc
-	mkdir -p $(DESTDIR)$(PYTHON_SITEARCH)/
-	mkdir -p $(DESTDIR)$(PYTHON_SITEARCH)/lib-dynload/
-	cp python/_stfl.so $(DESTDIR)$(PYTHON_SITEARCH)/lib-dynload/
-	cp python/stfl.pyc $(DESTDIR)$(PYTHON_SITEARCH)/
-	cp python/stfl.py $(DESTDIR)$(PYTHON_SITEARCH)/
+python3/_stfl.so python3/stfl.py python3/stfl.pyc: libstfl.a stfl.h python3/stfl.i swig/*.i
+	cd python3 && swig -python -threads stfl.i
+	gcc -shared -pthread -fPIC python3/stfl_wrap.c -I/usr/include/python$(PYTHON3_VERSION)m \
+		-I. libstfl.a -lncursesw -o python3/_stfl.so
+	cd python3 && python3 -c 'import stfl'
+
+install_python3: python3/_stfl.so python3/stfl.py python3/stfl.pyc
+	mkdir -p $(DESTDIR)$(PYTHON3_SITEARCH)/
+	cp python3/_stfl.so $(DESTDIR)$(PYTHON3_SITEARCH)/
+	cp -r python3/__pycache__ $(DESTDIR)$(PYTHON3_SITEARCH)/
+	cp python3/stfl.py $(DESTDIR)$(PYTHON3_SITEARCH)/
 
diff -Nur stfl-0.24/python3/example.py stfl-0.24-py3/python3/example.py
--- stfl-0.24/python3/example.py	2018-03-18 21:02:25.523024769 -0700
+++ stfl-0.24-py3/python3/example.py	2018-03-18 20:38:11.053007569 -0700
@@ -52,7 +52,7 @@
 
 if __name__=="__main__":
 	if len(sys.argv) not in [2,3]:
-		print "Usage: %s file.csv [delimiter]"%sys.argv[0]
+		print("Usage: %s file.csv [delimiter]"%sys.argv[0])
 		sys.exit(1)
 	
 	c=CSV(sys.argv[1], len(sys.argv)==3 and sys.argv[2] or ",")