--- python2.7-2.7.15.orig/Tools/scripts/h2py.py +++ python2.7-2.7.15/Tools/scripts/h2py.py @@ -78,7 +78,10 @@ sys.stdout.write('# Generated by h2py from stdin\n') process(sys.stdin, sys.stdout) else: - fp = open(filename, 'r') + fp = open_include(filename) + if not fp: + raise IOError("could not find %r on %r" % + (filename, searchdirs)) outfile = os.path.basename(filename) i = outfile.rfind('.') if i > 0: outfile = outfile[:i] @@ -162,13 +165,7 @@ outfp.write('from %s import *\n' % importable[filename]) elif not filedict.has_key(filename): filedict[filename] = None - inclfp = None - for dir in searchdirs: - try: - inclfp = open(dir + '/' + filename) - break - except IOError: - pass + inclfp = open_include(filename) if inclfp: outfp.write( '\n# Included from %s\n' % filename) @@ -177,5 +174,13 @@ sys.stderr.write('Warning - could not find file %s\n' % filename) +def open_include(filename): + for dir in searchdirs: + try: + return open(dir + '/' + filename, 'r') + except IOError: + pass + return None + if __name__ == '__main__': main() --- python2.7-2.7.15.orig/Lib/plat-generic/regen +++ python2.7-2.7.15/Lib/plat-generic/regen @@ -1,3 +1,3 @@ #! /bin/sh set -v -eval $PYTHON_FOR_BUILD ../../Tools/scripts/h2py.py -i "'(u_long)'" /usr/include/netinet/in.h +eval $PYTHON_FOR_BUILD ../../Tools/scripts/h2py.py -i "'(u_long)'" netinet/in.h