2
1

004-old-stdlib-cache.patch 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. python3: Fix pyc-only related runtime exceptions
  2. Python3 changes the pyc lookup strategy, ignoring the
  3. __pycache__ directory if the .py file is missing. Change
  4. install location to enable use of .pyc without their parent .py
  5. See http://www.python.org/dev/peps/pep-3147
  6. Signed-off-by: Daniel Nelson <daniel@sigpwr.com>
  7. Index: b/configure.ac
  8. ===================================================================
  9. --- a/configure.ac
  10. +++ b/configure.ac
  11. @@ -352,6 +352,23 @@
  12. AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX)
  13. AC_SUBST(FRAMEWORKINSTALLAPPSPREFIX)
  14. +STDLIB_CACHE_FLAGS=
  15. +AC_MSG_CHECKING(for --enable-old-stdlib-cache)
  16. +AC_ARG_ENABLE(old-stdlib-cache,
  17. + AS_HELP_STRING([--enable-old-stdlib-cache], [enable pre-pep3147 stdlib cache]),
  18. +[
  19. + if test "$enableval" = "yes"
  20. + then
  21. + STDLIB_CACHE_FLAGS="-b"
  22. + else
  23. + STDLIB_CACHE_FLAGS=""
  24. + fi
  25. +],
  26. +[
  27. + STDLIB_CACHE_FLAGS=""
  28. +])
  29. +AC_SUBST(STDLIB_CACHE_FLAGS)
  30. +
  31. ##AC_ARG_WITH(dyld,
  32. ## AS_HELP_STRING([--with-dyld],
  33. ## [Use (OpenStep|Rhapsody) dynamic linker]))
  34. Index: b/Makefile.pre.in
  35. ===================================================================
  36. --- a/Makefile.pre.in
  37. +++ b/Makefile.pre.in
  38. @@ -162,6 +162,9 @@
  39. # Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
  40. OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
  41. +# Option to enable old-style precompiled stdlib
  42. +STDLIB_CACHE_FLAGS=@STDLIB_CACHE_FLAGS@
  43. +
  44. # Environment to run shared python without installed libraries
  45. RUNSHARED= @RUNSHARED@
  46. @@ -1247,21 +1250,21 @@
  47. fi
  48. -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  49. $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
  50. - -d $(LIBDEST) -f \
  51. + -d $(LIBDEST) -f $(STDLIB_CACHE_FLAGS) \
  52. -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
  53. $(DESTDIR)$(LIBDEST)
  54. -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  55. $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
  56. - -d $(LIBDEST) -f \
  57. + -d $(LIBDEST) -f $(STDLIB_CACHE_FLAGS) \
  58. -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
  59. $(DESTDIR)$(LIBDEST)
  60. -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  61. $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
  62. - -d $(LIBDEST)/site-packages -f \
  63. + -d $(LIBDEST)/site-packages -f $(STDLIB_CACHE_FLAGS) \
  64. -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
  65. -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  66. $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
  67. - -d $(LIBDEST)/site-packages -f \
  68. + -d $(LIBDEST)/site-packages -f $(STDLIB_CACHE_FLAGS) \
  69. -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
  70. -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  71. $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt