Created
August 8, 2013 20:46
-
-
Save celoyd/6188546 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if tiff_h is None: | |
include_tiff_h = os.path.join(os.path.split(lib)[0], '..', 'include', 'tiff.h') | |
if not os.path.isfile(include_tiff_h): | |
# fix me for windows: | |
include_tiff_h = os.path.join('/usr','include','tiff.h') | |
if not os.path.isfile(include_tiff_h): | |
raise ValueError('Failed to find TIFF header file (may be need to run: sudo apt-get install libtiff4-dev)') | |
# Read TIFFTAG_* constants for the header file: | |
f = open (include_tiff_h, 'r') | |
l = [] | |
d = {} | |
for line in f.readlines(): | |
if not line.startswith('#define'): continue | |
words = line[7:].lstrip().split()[:2] | |
if len (words)!=2: continue | |
name, value = words | |
i = value.find('/*') | |
if i!=-1: value = value[:i] | |
if value in d: | |
value = d[value] | |
else: | |
print value | |
value = eval(value) | |
d[name] = value | |
l.append('%s = %s' % (name, value)) | |
f.close() |
Author
celoyd
commented
Aug 8, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment