summaryrefslogtreecommitdiff
path: root/textproc/py-libxml2/patches/patch-ab
blob: ef8f655b0b891cbb44ce0476ded990f84fdee82c (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
$NetBSD: patch-ab,v 1.2 2013/10/03 07:52:32 prlw1 Exp $

- Fix build under Mac OS X (reorder os.path.join(ROOT,'include') )
- White space changes for python 3 indentation (commit 4b61cf61)

--- setup.py.orig	2013-10-02 21:20:43.000000000 +0000
+++ setup.py
@@ -6,14 +6,14 @@ import sys, os
 from distutils.core import setup, Extension
 
 # Below ROOT, we expect to find include, include/libxml2, lib and bin.
-# On *nix, it is not needed (but should not harm), 
+# On *nix, it is not needed (but should not harm),
 # on Windows, it is set by configure.js.
-ROOT = r'/usr' 
+ROOT = r'/usr'
 
 # Thread-enabled libxml2
 with_threads = 1
 
-# If this flag is set (windows only), 
+# If this flag is set (windows only),
 # a private copy of the dlls are included in the package.
 # If this flag is not set, the libxml2 and libxslt
 # dlls must be found somewhere in the PATH at runtime.
@@ -51,15 +51,15 @@ else:
     libraryPrefix = ''
     platformLibs = ["m","z"]
 
-# those are examined to find 
+# those are examined to find
 # - libxml2/libxml/tree.h
-# - iconv.h 
+# - iconv.h
 # - libxslt/xsltconfig.h
 includes_dir = [
+os.path.join(ROOT,'include'),
 "/usr/include",
 "/usr/local/include",
 "/opt/include",
-os.path.join(ROOT,'include'),
 HOME
 ];
 
@@ -67,7 +67,7 @@ xml_includes=""
 for dir in includes_dir:
     if not missing(dir + "/libxml2/libxml/tree.h"):
         xml_includes=dir + "/libxml2"
-	break;
+        break;
 
 if xml_includes == "":
     print("failed to find headers for libxml2: update includes_dir")
@@ -77,7 +77,7 @@ iconv_includes=""
 for dir in includes_dir:
     if not missing(dir + "/iconv.h"):
         iconv_includes=dir
-	break;
+        break;
 
 if iconv_includes == "":
     print("failed to find headers for libiconv: update includes_dir")
@@ -90,22 +90,22 @@ os.path.join(ROOT,'lib'),
 
 xml_files = ["libxml2-api.xml", "libxml2-python-api.xml",
              "libxml.c", "libxml.py", "libxml_wrap.h", "types.c",
-	     "xmlgenerator.py", "README", "TODO", "drv_libxml2.py"]
+             "xmlgenerator.py", "README", "TODO", "drv_libxml2.py"]
 
 xslt_files = ["libxslt-api.xml", "libxslt-python-api.xml",
              "libxslt.c", "libxsl.py", "libxslt_wrap.h",
-	     "xsltgenerator.py"]
+             "xsltgenerator.py"]
 
 if missing("libxml2-py.c") or missing("libxml2.py"):
     try:
-	try:
-	    import xmlgenerator
-	except:
-	    import generator
+        try:
+            import xmlgenerator
+        except:
+            import generator
     except:
-	print("failed to find and generate stubs for libxml2, aborting ...")
-	print(sys.exc_info()[0], sys.exc_info()[1])
-	sys.exit(1)
+        print("failed to find and generate stubs for libxml2, aborting ...")
+        print(sys.exc_info()[0], sys.exc_info()[1])
+        sys.exit(1)
 
     head = open("libxml.py", "r")
     generated = open("libxml2class.py", "r")
@@ -116,7 +116,7 @@ if missing("libxml2-py.c") or missing("l
         else:
             result.write(line)
     for line in generated.readlines():
-	result.write(line)
+        result.write(line)
     head.close()
     generated.close()
     result.close()
@@ -126,39 +126,39 @@ if missing("libxslt-py.c") or missing("l
     if missing("xsltgenerator.py") or missing("libxslt-api.xml"):
         print("libxslt stub generator not found, libxslt not built")
     else:
-	try:
-	    import xsltgenerator
-	except:
-	    print("failed to generate stubs for libxslt, aborting ...")
-	    print(sys.exc_info()[0], sys.exc_info()[1])
-	else:
-	    head = open("libxsl.py", "r")
-	    generated = open("libxsltclass.py", "r")
-	    result = open("libxslt.py", "w")
-	    for line in head.readlines():
+        try:
+            import xsltgenerator
+        except:
+            print("failed to generate stubs for libxslt, aborting ...")
+            print(sys.exc_info()[0], sys.exc_info()[1])
+        else:
+            head = open("libxsl.py", "r")
+            generated = open("libxsltclass.py", "r")
+            result = open("libxslt.py", "w")
+            for line in head.readlines():
                 if WITHDLLS:
                     result.write(altImport(line))
                 else:
                     result.write(line)
-	    for line in generated.readlines():
-		result.write(line)
-	    head.close()
-	    generated.close()
-	    result.close()
-	    with_xslt=1
+            for line in generated.readlines():
+                result.write(line)
+            head.close()
+            generated.close()
+            result.close()
+            with_xslt=1
 else:
     with_xslt=1
 
 if with_xslt == 1:
     xslt_includes=""
     for dir in includes_dir:
-	if not missing(dir + "/libxslt/xsltconfig.h"):
-	    xslt_includes=dir + "/libxslt"
-	    break;
+        if not missing(dir + "/libxslt/xsltconfig.h"):
+            xslt_includes=dir + "/libxslt"
+            break;
 
     if xslt_includes == "":
-	print("failed to find headers for libxslt: update includes_dir")
-	with_xslt = 0
+        print("failed to find headers for libxslt: update includes_dir")
+        with_xslt = 0
 
 
 descr = "libxml2 package"
@@ -194,11 +194,11 @@ if with_xslt == 1:
 
 
 extens=[Extension('libxml2mod', c_files, include_dirs=includes,
-                  library_dirs=libdirs, 
-                  libraries=libs, define_macros=macros)] 
+                  library_dirs=libdirs,
+                  libraries=libs, define_macros=macros)]
 if with_xslt == 1:
     extens.append(Extension('libxsltmod', xslt_c_files, include_dirs=includes,
-			    library_dirs=libdirs, 
+                            library_dirs=libdirs,
                             libraries=libs, define_macros=macros))
 
 if missing("MANIFEST"):
@@ -208,8 +208,8 @@ if missing("MANIFEST"):
     for file in xml_files:
         manifest.write(file + "\n")
     if with_xslt == 1:
-	for file in xslt_files:
-	    manifest.write(file + "\n")
+        for file in xslt_files:
+            manifest.write(file + "\n")
     manifest.close()
 
 if WITHDLLS: