File: 0002-Robust-definition-list-generation.patch

package info (click to toggle)
pylibtiff 0.6.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,132 kB
  • sloc: python: 9,938; ansic: 1,064; makefile: 15
file content (33 lines) | stat: -rw-r--r-- 1,145 bytes parent folder | download | duplicates (3)
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
From: Antonio Valentino <antonio.valentino@tiscali.it>
Date: Mon, 31 Dec 2018 09:07:28 +0000
Subject: Robust definition list generation

Forwarded: not-needed
---
 libtiff/libtiff_ctypes.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/libtiff/libtiff_ctypes.py b/libtiff/libtiff_ctypes.py
index 4928646..5202747 100644
--- a/libtiff/libtiff_ctypes.py
+++ b/libtiff/libtiff_ctypes.py
@@ -148,12 +148,13 @@ if tiff_h is None:
         lst.append('%s = %s' % (name, value))
     f.close()
 
-    fn = os.path.join(os.path.dirname(os.path.abspath(__file__)),
-                      tiff_h_name + '.py')
-    print('Generating %r from %r' % (fn, include_tiff_h))
-    f = open(fn, 'w')
-    f.write('\n'.join(lst) + '\n')
-    f.close()
+    if os.environ.get('PYLIBRIFF_WRITE_DEFINITION_FILE', 'NO') == 'YES':
+        fn = os.path.join(os.path.dirname(os.path.abspath(__file__)),
+                          tiff_h_name + '.py')
+        print('Generating %r from %r' % (fn, include_tiff_h))
+        f = open(fn, 'w')
+        f.write('\n'.join(lst) + '\n')
+        f.close()
 else:
     d = tiff_h.__dict__