python-2.7-040-bytecode-generation-fix.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. The compileall script is used to compile to python bytecode all the modules.
  2. However, it relies on the struct package that is not built for the host
  3. python, thus crashing at execution when compiling the target python.
  4. When compiling, the removed code block is never executed, so we can safely
  5. remove it, removing in the same time the dependency on struct.
  6. Patch by Maxime Ripard <ripard@archos.com>
  7. Index: Python-2.7/Lib/compileall.py
  8. ===================================================================
  9. --- Python-2.7.orig/Lib/compileall.py (révision 84276)
  10. +++ Python-2.7/Lib/compileall.py (copie de travail)
  11. @@ -14,7 +14,6 @@
  12. import os
  13. import sys
  14. import py_compile
  15. -import struct
  16. import imp
  17. __all__ = ["compile_dir","compile_file","compile_path"]
  18. @@ -83,17 +82,6 @@
  19. if os.path.isfile(fullname):
  20. head, tail = name[:-3], name[-3:]
  21. if tail == '.py':
  22. - if not force:
  23. - try:
  24. - mtime = int(os.stat(fullname).st_mtime)
  25. - expect = struct.pack('<4sl', imp.get_magic(), mtime)
  26. - cfile = fullname + (__debug__ and 'c' or 'o')
  27. - with open(cfile, 'rb') as chandle:
  28. - actual = chandle.read(8)
  29. - if expect == actual:
  30. - return success
  31. - except IOError:
  32. - pass
  33. if not quiet:
  34. print 'Compiling', fullname, '...'
  35. try: