summaryrefslogtreecommitdiffstats
path: root/patches/Python-3.0rc2
diff options
context:
space:
mode:
authorRobert Schwebel <r.schwebel@pengutronix.de>2008-11-16 21:07:38 +0000
committerRobert Schwebel <r.schwebel@pengutronix.de>2008-11-16 21:07:38 +0000
commita478802573e1cda0c158d6efd14581146bed21d6 (patch)
treea2985dbe2bafdf97a8ee0527220b5693afb7c5ca /patches/Python-3.0rc2
parente8d7e951ef0b1ca4118317a1e8d3d724181573ce (diff)
downloadptxdist-a478802573e1cda0c158d6efd14581146bed21d6.tar.gz
ptxdist-a478802573e1cda0c158d6efd14581146bed21d6.tar.xz
* python 3.0: added initial support
git-svn-id: https://svn.pengutronix.de/svn/ptxdist/trunks/ptxdist-trunk@9120 33e552b5-05e3-0310-8538-816dae2090ed
Diffstat (limited to 'patches/Python-3.0rc2')
-rw-r--r--patches/Python-3.0rc2/generic/Python-3.0rc2-chflags.diff47
-rw-r--r--patches/Python-3.0rc2/generic/Python-3.0rc2-cross-setup-py.diff60
-rw-r--r--patches/Python-3.0rc2/generic/Python-3.0rc2-hostpython.diff169
-rw-r--r--patches/Python-3.0rc2/generic/Python-3.0rc2-lchflags.diff47
-rw-r--r--patches/Python-3.0rc2/generic/Python-3.0rc2-printf_zd.diff44
-rw-r--r--patches/Python-3.0rc2/generic/fixme197
-rw-r--r--patches/Python-3.0rc2/generic/series6
7 files changed, 570 insertions, 0 deletions
diff --git a/patches/Python-3.0rc2/generic/Python-3.0rc2-chflags.diff b/patches/Python-3.0rc2/generic/Python-3.0rc2-chflags.diff
new file mode 100644
index 000000000..974b1e7d9
--- /dev/null
+++ b/patches/Python-3.0rc2/generic/Python-3.0rc2-chflags.diff
@@ -0,0 +1,47 @@
+---
+ configure.in | 23 ++++++++++++++++++++---
+ 1 file changed, 20 insertions(+), 3 deletions(-)
+
+Index: Python-3.0rc2/configure.in
+===================================================================
+--- Python-3.0rc2.orig/configure.in
++++ Python-3.0rc2/configure.in
+@@ -2473,7 +2473,7 @@ AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_
+ # On Tru64, chflags seems to be present, but calling it will
+ # exit Python
+ AC_MSG_CHECKING(for chflags)
+-AC_TRY_RUN([
++AC_RUN_IFELSE([
+ #include <sys/stat.h>
+ #include <unistd.h>
+ int main(int argc, char*argv[])
+@@ -2482,10 +2482,27 @@ int main(int argc, char*argv[])
+ return 1;
+ return 0;
+ }
+-],AC_DEFINE(HAVE_CHFLAGS, 1, Define to 1 if you have the `chflags' function.)
+- AC_MSG_RESULT(yes),
++],[
++ AC_CACHE_VAL(ac_cv_have_chflags, ac_cv_have_chflags=yes)
++ AC_MSG_RESULT(yes)
++],[
++ AC_CACHE_VAL(ac_cv_have_chflags, ac_cv_have_chflags=no)
+ AC_MSG_RESULT(no)
++],[
++ AC_CACHE_VAL(ac_cv_have_chflags, ac_cv_have_chflags=undef)
++ AC_MSG_RESULT([crosscompiling, ac_cv_have_chflags=$ac_cv_have_chflags])
++]
+ )
++case $ac_cv_have_chflags in
++yes)
++ AC_DEFINE(HAVE_CHFLAGS, 1, Define to 1 if you have the 'chflags' function.)
++ ;;
++no)
++ ;;
++*)
++ AC_MSG_ERROR([please specify ac_cv_have_chflags=yes|no])
++ ;;
++esac
+
+ AC_MSG_CHECKING(for lchflags)
+ AC_TRY_RUN([
diff --git a/patches/Python-3.0rc2/generic/Python-3.0rc2-cross-setup-py.diff b/patches/Python-3.0rc2/generic/Python-3.0rc2-cross-setup-py.diff
new file mode 100644
index 000000000..206817035
--- /dev/null
+++ b/patches/Python-3.0rc2/generic/Python-3.0rc2-cross-setup-py.diff
@@ -0,0 +1,60 @@
+---
+ setup.py | 45 ++++++++++++++++++++++++---------------------
+ 1 file changed, 24 insertions(+), 21 deletions(-)
+
+Index: Python-3.0rc2/setup.py
+===================================================================
+--- Python-3.0rc2.orig/setup.py
++++ Python-3.0rc2/setup.py
+@@ -272,27 +272,30 @@ class PyBuildExt(build_ext):
+ try:
+ imp.load_dynamic(ext.name, ext_filename)
+ except ImportError as why:
+- self.failed.append(ext.name)
+- self.announce('*** WARNING: renaming "%s" since importing it'
+- ' failed: %s' % (ext.name, why), level=3)
+- assert not self.inplace
+- basename, tail = os.path.splitext(ext_filename)
+- newname = basename + "_failed" + tail
+- if os.path.exists(newname):
+- os.remove(newname)
+- os.rename(ext_filename, newname)
+-
+- # XXX -- This relies on a Vile HACK in
+- # distutils.command.build_ext.build_extension(). The
+- # _built_objects attribute is stored there strictly for
+- # use here.
+- # If there is a failure, _built_objects may not be there,
+- # so catch the AttributeError and move on.
+- try:
+- for filename in self._built_objects:
+- os.remove(filename)
+- except AttributeError:
+- self.announce('unable to remove files (ignored)')
++ if os.environ.get('CROSS_COMPILE') != "yes":
++ self.failed.append(ext.name)
++ self.announce('*** WARNING: renaming "%s" since importing it'
++ ' failed: %s' % (ext.name, why), level=3)
++ assert not self.inplace
++ basename, tail = os.path.splitext(ext_filename)
++ newname = basename + "_failed" + tail
++ if os.path.exists(newname):
++ os.remove(newname)
++ os.rename(ext_filename, newname)
++
++ # XXX -- This relies on a Vile HACK in
++ # distutils.command.build_ext.build_extension(). The
++ # _built_objects attribute is stored there strictly for
++ # use here.
++ # If there is a failure, _built_objects may not be there,
++ # so catch the AttributeError and move on.
++ try:
++ for filename in self._built_objects:
++ os.remove(filename)
++ except AttributeError:
++ self.announce('unable to remove files (ignored)')
++ else:
++ self.announce('stuff and things')
+ except:
+ exc_type, why, tb = sys.exc_info()
+ self.announce('*** WARNING: importing extension "%s" '
diff --git a/patches/Python-3.0rc2/generic/Python-3.0rc2-hostpython.diff b/patches/Python-3.0rc2/generic/Python-3.0rc2-hostpython.diff
new file mode 100644
index 000000000..0a7380c85
--- /dev/null
+++ b/patches/Python-3.0rc2/generic/Python-3.0rc2-hostpython.diff
@@ -0,0 +1,169 @@
+From: Robert Schwebel <r.schwebel@pengutronix.de>
+Subject: [PATCH] introduce host tools
+
+
+
+#
+# thanks to David R Bacon for this patch
+#
+# http://biscuit.user.cis.ksu.edu/~dbacon/python23-xcompile.patch.bz2
+#
+# it's based on Klaus Reimer patch
+# http://www.ailis.de/~k/patches/
+#
+# 2005-09-29: ported to python 2.4.2 by Robert Schwebel
+#
+
+
+---
+ Makefile.pre.in | 36 +++++++++++++++++++-----------------
+ 1 file changed, 19 insertions(+), 17 deletions(-)
+
+Index: Python-3.0rc2/Makefile.pre.in
+===================================================================
+--- Python-3.0rc2.orig/Makefile.pre.in
++++ Python-3.0rc2/Makefile.pre.in
+@@ -174,6 +174,7 @@ LIBOBJS= @LIBOBJS@
+
+ PYTHON= python$(EXE)
+ BUILDPYTHON= python$(BUILDEXE)
++HOSTPYTHON= ./$(BUILDPYTHON)
+
+ # The task to run while instrument when building the profile-opt target
+ PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
+@@ -204,6 +205,7 @@ GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
+ ##########################################################################
+ # Parser
+ PGEN= Parser/pgen$(EXE)
++HOSTPGEN= $(PGEN)
+
+ POBJS= \
+ Parser/acceler.o \
+@@ -368,7 +370,7 @@ build_all_generate_profile:
+ $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
+
+ run_profile_task:
+- ./$(BUILDPYTHON) $(PROFILE_TASK)
++ $(HOSTPYTHON) $(PROFILE_TASK)
+
+ build_all_use_profile:
+ $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use"
+@@ -386,14 +388,14 @@ $(BUILDPYTHON): Modules/python.o $(LIBRA
+ $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
+
+ platform: $(BUILDPYTHON)
+- $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print(get_platform()+"-"+sys.version[0:3])' >platform
++ $(RUNSHARED) $(HOSTPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print(get_platform()+"-"+sys.version[0:3])' >platform
+
+
+ # Build the shared modules
+ sharedmods: $(BUILDPYTHON)
+ @case $$MAKEFLAGS in \
+- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
+- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
++ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
++ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
+ esac
+
+ # Build static library
+@@ -511,7 +513,7 @@ Modules/python.o: $(srcdir)/Modules/pyth
+
+ $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
+ -@$(INSTALL) -d Include
+- -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
++ -$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
+
+ $(PGEN): $(PGENOBJS)
+ $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
+@@ -665,7 +667,7 @@ $(LIBRARY_OBJS) $(MODOBJS) Modules/pytho
+
+ TESTOPTS= -l $(EXTRATESTOPTS)
+ TESTPROG= $(srcdir)/Lib/test/regrtest.py
+-TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -E -bb
++TESTPYTHON= $(RUNSHARED) $(HOSTPYTHON) -E -bb
+ test: all platform
+ -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
+ -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
+@@ -688,7 +690,7 @@ testuniversal: all platform
+ -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
+ -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
+ $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
+- $(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E $(TESTPROG) $(TESTOPTS) -uall
++ $(RUNSHARED) /usr/libexec/oah/translate $(HOSTPYTHON) -E $(TESTPROG) $(TESTOPTS) -uall
+
+
+ # Like testall, but with a single pass only
+@@ -874,23 +876,23 @@ libinstall: build_all $(srcdir)/Lib/$(PL
+ done
+ $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+- ./$(BUILDPYTHON) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
++ $(HOSTPYTHON) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
+ -d $(LIBDEST) -f \
+ -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+- ./$(BUILDPYTHON) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
++ $(HOSTPYTHON) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
+ -d $(LIBDEST) -f \
+ -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+- ./$(BUILDPYTHON) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
++ $(HOSTPYTHON) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
+ -d $(LIBDEST)/site-packages -f \
+ -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+- ./$(BUILDPYTHON) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
++ $(HOSTPYTHON) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
+ -d $(LIBDEST)/site-packages -f \
+ -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+- ./$(BUILDPYTHON) -Wi -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
++ $(HOSTPYTHON) -Wi -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
+
+ # Create the PLATDIR source directory, if one wasn't distributed..
+ $(srcdir)/Lib/$(PLATDIR):
+@@ -977,7 +979,7 @@ libainstall: all
+ # Install the dynamically loadable modules
+ # This goes into $(exec_prefix)
+ sharedinstall:
+- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
++ $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \
+ --prefix=$(prefix) \
+ --install-scripts=$(BINDIR) \
+ --install-platlib=$(DESTSHARED) \
+@@ -1015,7 +1017,7 @@ frameworkinstallstructure: $(LDLIBRARY)
+ fi; \
+ done
+ $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
+- sed 's/%VERSION%/'"`$(RUNSHARED) ./$(BUILDPYTHON) -c 'import platform; print(platform.python_version())'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(prefix)/Resources/Info.plist
++ sed 's/%VERSION%/'"`$(RUNSHARED) $(HOSTPYTHON) -c 'import platform; print(platform.python_version())'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(prefix)/Resources/Info.plist
+ $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
+ $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/$(PYTHONFRAMEWORK)
+ $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
+@@ -1056,7 +1058,7 @@ frameworkinstallextras:
+ # This installs a few of the useful scripts in Tools/scripts
+ scriptsinstall:
+ SRCDIR=$(srcdir) $(RUNSHARED) \
+- ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
++ $(HOSTPYTHON) $(srcdir)/Tools/scripts/setup.py install \
+ --prefix=$(prefix) \
+ --install-scripts=$(BINDIR) \
+ --root=/$(DESTDIR)
+@@ -1078,7 +1080,7 @@ config.status: $(srcdir)/configure
+
+ # Run reindent on the library
+ reindent:
+- ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
++ $(HOSTPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
+
+ # Rerun configure with the same options as it was run last time,
+ # provided the config.status script exists
+@@ -1192,7 +1194,7 @@ funny:
+
+ # Perform some verification checks on any modified files.
+ patchcheck:
+- $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
++ $(RUNSHARED) $(HOSTPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
+
+ # Dependencies
+
diff --git a/patches/Python-3.0rc2/generic/Python-3.0rc2-lchflags.diff b/patches/Python-3.0rc2/generic/Python-3.0rc2-lchflags.diff
new file mode 100644
index 000000000..a1c286e45
--- /dev/null
+++ b/patches/Python-3.0rc2/generic/Python-3.0rc2-lchflags.diff
@@ -0,0 +1,47 @@
+---
+ configure.in | 23 ++++++++++++++++++++---
+ 1 file changed, 20 insertions(+), 3 deletions(-)
+
+Index: Python-3.0rc2/configure.in
+===================================================================
+--- Python-3.0rc2.orig/configure.in
++++ Python-3.0rc2/configure.in
+@@ -2505,7 +2505,7 @@ no)
+ esac
+
+ AC_MSG_CHECKING(for lchflags)
+-AC_TRY_RUN([
++AC_RUN_IFELSE([
+ #include <sys/stat.h>
+ #include <unistd.h>
+ int main(int argc, char*argv[])
+@@ -2514,10 +2514,27 @@ int main(int argc, char*argv[])
+ return 1;
+ return 0;
+ }
+-],AC_DEFINE(HAVE_LCHFLAGS, 1, Define to 1 if you have the `lchflags' function.)
+- AC_MSG_RESULT(yes),
++],[
++ AC_CACHE_VAL(ac_cv_have_lchflags, ac_cv_have_lchflags=yes)
++ AC_MSG_RESULT(yes)
++],[
++ AC_CACHE_VAL(ac_cv_have_lchflags, ac_cv_have_lchflags=no)
+ AC_MSG_RESULT(no)
++],[
++ AC_CACHE_VAL(ac_cv_have_lchflags, ac_cv_have_lchflags=undef)
++ AC_MSG_RESULT([crosscompiling, ac_cv_have_lchflags=$ac_cv_have_lchflags])
++]
+ )
++case $ac_cv_have_lchflags in
++yes)
++ AC_DEFINE(HAVE_LCHFLAGS, 1, Define to 1 if you have the 'lchflags' function.)
++ ;;
++no)
++ ;;
++*)
++ AC_MSG_ERROR([please specify ac_cv_have_lchflags=yes|no])
++ ;;
++esac
+
+ dnl Check if system zlib has *Copy() functions
+ dnl
diff --git a/patches/Python-3.0rc2/generic/Python-3.0rc2-printf_zd.diff b/patches/Python-3.0rc2/generic/Python-3.0rc2-printf_zd.diff
new file mode 100644
index 000000000..089210d02
--- /dev/null
+++ b/patches/Python-3.0rc2/generic/Python-3.0rc2-printf_zd.diff
@@ -0,0 +1,44 @@
+---
+ configure.in | 22 +++++++++++++++++-----
+ 1 file changed, 17 insertions(+), 5 deletions(-)
+
+Index: Python-3.0rc2/configure.in
+===================================================================
+--- Python-3.0rc2.orig/configure.in
++++ Python-3.0rc2/configure.in
+@@ -3580,7 +3580,7 @@ else
+ fi
+
+ AC_MSG_CHECKING(for %zd printf() format support)
+-AC_TRY_RUN([#include <stdio.h>
++AC_RUN_IFELSE([#include <stdio.h>
+ #include <stddef.h>
+ #include <string.h>
+
+@@ -3613,10 +3613,22 @@ int main()
+ return 1;
+
+ return 0;
+-}],
+-[AC_MSG_RESULT(yes)
+- AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])],
+- AC_MSG_RESULT(no))
++}
++],[
++ AC_CACHE_VAL(ac_cv_py_format_size_t, ac_cv_py_format_size_t="z")
++ AC_MSG_RESULT(yes)
++],[
++ AC_CACHE_VAL(ac_cv_py_format_size_t, ac_cv_py_format_size_t="")
++ AC_MSG_RESULT(no)
++],[
++ AC_CACHE_VAL(ac_cv_py_format_size_t, ac_cv_py_format_size_t=undef)
++ AC_MSG_RESULT([crosscompiling, ac_cv_py_format_size_t=$ac_cv_py_format_size_t])
++]
++)
++if test "$ac_cv_py_format_size_t" = "undef"; then
++ AC_MSG_ERROR([please specify ac_cv_py_format_size_t])
++fi
++AC_DEFINE_UNQUOTED(PY_FORMAT_SIZE_T, "$ac_cv_py_format_size_t", [Define to printf format modifier for Py_ssize_t])
+
+ AC_CHECK_TYPE(socklen_t,,
+ AC_DEFINE(socklen_t,int,
diff --git a/patches/Python-3.0rc2/generic/fixme b/patches/Python-3.0rc2/generic/fixme
new file mode 100644
index 000000000..d23575900
--- /dev/null
+++ b/patches/Python-3.0rc2/generic/fixme
@@ -0,0 +1,197 @@
+---
+ Makefile.pre.in | 2 -
+ setup.py | 82 ++++++++++++++++++++++++++++----------------------------
+ 2 files changed, 42 insertions(+), 42 deletions(-)
+
+Index: Python-3.0rc2/Makefile.pre.in
+===================================================================
+--- Python-3.0rc2.orig/Makefile.pre.in
++++ Python-3.0rc2/Makefile.pre.in
+@@ -393,7 +393,7 @@ platform: $(BUILDPYTHON)
+
+ # Build the shared modules
+ sharedmods: $(BUILDPYTHON)
+- @case $$MAKEFLAGS in \
++ case $$MAKEFLAGS in \
+ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
+ esac
+Index: Python-3.0rc2/setup.py
+===================================================================
+--- Python-3.0rc2.orig/setup.py
++++ Python-3.0rc2/setup.py
+@@ -312,8 +312,8 @@ class PyBuildExt(build_ext):
+
+ def detect_modules(self):
+ # Ensure that /usr/local is always used
+- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
+- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
++ add_dir_to_list(self.compiler.library_dirs, os.environ.get('DESTDIR','') + '/usr/local/lib')
++ add_dir_to_list(self.compiler.include_dirs, os.environ.get('DESTDIR','') + '/usr/local/include')
+
+ # Add paths specified in the environment variables LDFLAGS and
+ # CPPFLAGS for header and library files.
+@@ -349,7 +349,7 @@ class PyBuildExt(build_ext):
+ for directory in reversed(options.dirs):
+ add_dir_to_list(dir_list, directory)
+
+- if os.path.normpath(sys.prefix) != '/usr':
++ if os.path.normpath(sys.prefix) != os.environ.get('DESTDIR','') + '/usr':
+ add_dir_to_list(self.compiler.library_dirs,
+ sysconfig.get_config_var("LIBDIR"))
+ add_dir_to_list(self.compiler.include_dirs,
+@@ -359,10 +359,10 @@ class PyBuildExt(build_ext):
+ # if a file is found in one of those directories, it can
+ # be assumed that no additional -I,-L directives are needed.
+ lib_dirs = self.compiler.library_dirs + [
+- '/lib64', '/usr/lib64',
+- '/lib', '/usr/lib',
++ os.environ.get('DESTDIR','') + '/lib64', os.environ.get('DESTDIR','') + '/usr/lib64',
++ os.environ.get('DESTDIR','') + '/lib', os.environ.get('DESTDIR','') + '/usr/lib',
+ ]
+- inc_dirs = self.compiler.include_dirs + ['/usr/include']
++ inc_dirs = self.compiler.include_dirs + [os.environ.get('DESTDIR','') + '/usr/include']
+ exts = []
+ missing = []
+
+@@ -381,7 +381,7 @@ class PyBuildExt(build_ext):
+
+ # OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb)
+ if platform in ['osf1', 'unixware7', 'openunix8']:
+- lib_dirs += ['/usr/ccs/lib']
++ lib_dirs += [os.environ.get('DESTDIR','') + '/usr/ccs/lib']
+
+ if platform == 'darwin':
+ # This should work on any unixy platform ;-)
+@@ -556,11 +556,11 @@ class PyBuildExt(build_ext):
+ elif self.compiler.find_library_file(lib_dirs, 'curses'):
+ readline_libs.append('curses')
+ elif self.compiler.find_library_file(lib_dirs +
+- ['/usr/lib/termcap'],
++ [os.environ.get('DESTDIR','') + '/usr/lib/termcap'],
+ 'termcap'):
+ readline_libs.append('termcap')
+ exts.append( Extension('readline', ['readline.c'],
+- library_dirs=['/usr/lib/termcap'],
++ library_dirs=[os.environ.get('DESTDIR','') + '/usr/lib/termcap'],
+ extra_link_args=readline_extra_link_args,
+ libraries=readline_libs) )
+ else:
+@@ -585,20 +585,20 @@ class PyBuildExt(build_ext):
+ depends = ['socketmodule.h']) )
+ # Detect SSL support for the socket module (via _ssl)
+ search_for_ssl_incs_in = [
+- '/usr/local/ssl/include',
+- '/usr/contrib/ssl/include/'
++ os.environ.get('DESTDIR','') + '/usr/local/ssl/include',
++ os.environ.get('DESTDIR','') + '/usr/contrib/ssl/include/'
+ ]
+ ssl_incs = find_file('openssl/ssl.h', inc_dirs,
+ search_for_ssl_incs_in
+ )
+ if ssl_incs is not None:
+ krb5_h = find_file('krb5.h', inc_dirs,
+- ['/usr/kerberos/include'])
++ [os.environ.get('DESTDIR','') + '/usr/kerberos/include'])
+ if krb5_h:
+ ssl_incs += krb5_h
+ ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
+- ['/usr/local/ssl/lib',
+- '/usr/contrib/ssl/lib/'
++ [os.environ.get('DESTDIR','') + '/usr/local/ssl/lib',
++ os.environ.get('DESTDIR','') + '/usr/contrib/ssl/lib/'
+ ] )
+
+ if (ssl_incs is not None and
+@@ -667,15 +667,15 @@ class PyBuildExt(build_ext):
+ # similar functionality (but slower of course) implemented in Python.
+
+ db_inc_paths = [
+- '/usr/include/db4',
+- '/usr/local/include/db4',
+- '/opt/sfw/include/db4',
+- '/usr/include/db3',
+- '/usr/local/include/db3',
+- '/opt/sfw/include/db3',
++ os.environ.get('DESTDIR','') + '/usr/include/db4',
++ os.environ.get('DESTDIR','') + '/usr/local/include/db4',
++ os.environ.get('DESTDIR','') + '/opt/sfw/include/db4',
++ os.environ.get('DESTDIR','') + '/usr/include/db3',
++ os.environ.get('DESTDIR','') + '/usr/local/include/db3',
++ os.environ.get('DESTDIR','') + '/opt/sfw/include/db3',
+ # Fink defaults (http://fink.sourceforge.net/)
+- '/sw/include/db4',
+- '/sw/include/db3',
++ os.environ.get('DESTDIR','') + '/sw/include/db4',
++ os.environ.get('DESTDIR','') + '/sw/include/db3',
+ ]
+
+ db_incs = None
+@@ -686,12 +686,12 @@ class PyBuildExt(build_ext):
+ # We hunt for #define SQLITE_VERSION "n.n.n"
+ # We need to find >= sqlite version 3.0.8
+ sqlite_incdir = sqlite_libdir = None
+- sqlite_inc_paths = [ '/usr/include',
+- '/usr/include/sqlite',
+- '/usr/include/sqlite3',
+- '/usr/local/include',
+- '/usr/local/include/sqlite',
+- '/usr/local/include/sqlite3',
++ sqlite_inc_paths = [ os.environ.get('DESTDIR','') + '/usr/include',
++ os.environ.get('DESTDIR','') + '/usr/include/sqlite',
++ os.environ.get('DESTDIR','') + '/usr/include/sqlite3',
++ os.environ.get('DESTDIR','') + '/usr/local/include',
++ os.environ.get('DESTDIR','') + '/usr/local/include/sqlite',
++ os.environ.get('DESTDIR','') + '/usr/local/include/sqlite3',
+ ]
+ MIN_SQLITE_VERSION_NUMBER = (3, 0, 8)
+ MIN_SQLITE_VERSION = ".".join([str(x)
+@@ -1124,7 +1124,7 @@ class PyBuildExt(build_ext):
+ # For 8.4a2, the X11 headers are not included. Rather than include a
+ # complicated search, this is a hard-coded path. It could bail out
+ # if X11 libs are not found...
+- include_dirs.append('/usr/X11R6/include')
++ include_dirs.append(os.environ.get('DESTDIR','') + '/usr/X11R6/include')
+ frameworks = ['-framework', 'Tcl', '-framework', 'Tk']
+
+ # All existing framework builds of Tcl/Tk don't support 64-bit
+@@ -1211,19 +1211,19 @@ class PyBuildExt(build_ext):
+
+ # Check for various platform-specific directories
+ if platform == 'sunos5':
+- include_dirs.append('/usr/openwin/include')
+- added_lib_dirs.append('/usr/openwin/lib')
+- elif os.path.exists('/usr/X11R6/include'):
+- include_dirs.append('/usr/X11R6/include')
+- added_lib_dirs.append('/usr/X11R6/lib64')
+- added_lib_dirs.append('/usr/X11R6/lib')
+- elif os.path.exists('/usr/X11R5/include'):
+- include_dirs.append('/usr/X11R5/include')
+- added_lib_dirs.append('/usr/X11R5/lib')
++ include_dirs.append(os.environ.get('DESTDIR','') + '/usr/openwin/include')
++ added_lib_dirs.append(os.environ.get('DESTDIR','') + '/usr/openwin/lib')
++ elif os.path.exists(os.environ.get('DESTDIR','') + '/usr/X11R6/include'):
++ include_dirs.append(os.environ.get('DESTDIR','') + '/usr/X11R6/include')
++ added_lib_dirs.append(os.environ.get('DESTDIR','') + '/usr/X11R6/lib64')
++ added_lib_dirs.append(os.environ.get('DESTDIR','') + '/usr/X11R6/lib')
++ elif os.path.exists(os.environ.get('DESTDIR','') + '/usr/X11R5/include'):
++ include_dirs.append(os.environ.get('DESTDIR','') + '/usr/X11R5/include')
++ added_lib_dirs.append(os.environ.get('DESTDIR','') + '/usr/X11R5/lib')
+ else:
+ # Assume default location for X11
+- include_dirs.append('/usr/X11/include')
+- added_lib_dirs.append('/usr/X11/lib')
++ include_dirs.append(os.environ.get('DESTDIR','') + '/usr/X11/include')
++ added_lib_dirs.append(os.environ.get('DESTDIR','') + '/usr/X11/lib')
+
+ # If Cygwin, then verify that X is installed before proceeding
+ if platform == 'cygwin':
+@@ -1403,7 +1403,7 @@ class PyBuildExt(build_ext):
+ if sys.platform == 'darwin':
+ # OS X 10.5 comes with libffi.dylib; the include files are
+ # in /usr/include/ffi
+- inc_dirs.append('/usr/include/ffi')
++ inc_dirs.append(os.environ.get('DESTDIR','') + '/usr/include/ffi')
+
+ ffi_inc = find_file('ffi.h', [], inc_dirs)
+ if ffi_inc is not None:
diff --git a/patches/Python-3.0rc2/generic/series b/patches/Python-3.0rc2/generic/series
new file mode 100644
index 000000000..e6f35a43d
--- /dev/null
+++ b/patches/Python-3.0rc2/generic/series
@@ -0,0 +1,6 @@
+Python-3.0rc2-chflags.diff
+Python-3.0rc2-lchflags.diff
+Python-3.0rc2-printf_zd.diff
+Python-3.0rc2-hostpython.diff
+Python-3.0rc2-cross-setup-py.diff
+fixme