From 063d5d2972a72111e44c54ee17603c0818daa2cd Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Sun, 4 Aug 2013 17:57:50 -0400 Subject: [PATCH] bump(dev-lang/python): Update to python 2.7, ebuilds from chromiumos. They have some patches to fix cross-compiling in this build environment. Start off simply by adding 2.7 as a new parallel install target, will switch to 2.7 as the primary version in a later step. --- .../coreos-overlay/dev-lang/python/Manifest | 2 + .../files/python-2.7.3-cross-distutils.patch | 93 ++++ .../files/python-2.7.3-cross-h2py.patch | 36 ++ .../python-2.7.3-cross-install-compile.patch | 35 ++ .../python-2.7.3-cross-setup-sysroot.patch | 159 +++++++ .../python/files/python-2.7.3-gcc-4_8.patch | 58 +++ .../dev-lang/python/metadata.xml | 10 + .../dev-lang/python/python-2.7.3-r5.ebuild | 420 ++++++++++++++++++ .../profiles/base/make.defaults | 4 +- 9 files changed, 814 insertions(+), 3 deletions(-) create mode 100644 sdk_container/src/third_party/coreos-overlay/dev-lang/python/files/python-2.7.3-cross-distutils.patch create mode 100644 sdk_container/src/third_party/coreos-overlay/dev-lang/python/files/python-2.7.3-cross-h2py.patch create mode 100644 sdk_container/src/third_party/coreos-overlay/dev-lang/python/files/python-2.7.3-cross-install-compile.patch create mode 100644 sdk_container/src/third_party/coreos-overlay/dev-lang/python/files/python-2.7.3-cross-setup-sysroot.patch create mode 100644 sdk_container/src/third_party/coreos-overlay/dev-lang/python/files/python-2.7.3-gcc-4_8.patch create mode 100644 sdk_container/src/third_party/coreos-overlay/dev-lang/python/metadata.xml create mode 100644 sdk_container/src/third_party/coreos-overlay/dev-lang/python/python-2.7.3-r5.ebuild diff --git a/sdk_container/src/third_party/coreos-overlay/dev-lang/python/Manifest b/sdk_container/src/third_party/coreos-overlay/dev-lang/python/Manifest index c3f9005e31..b0d4c9f4ef 100644 --- a/sdk_container/src/third_party/coreos-overlay/dev-lang/python/Manifest +++ b/sdk_container/src/third_party/coreos-overlay/dev-lang/python/Manifest @@ -1,2 +1,4 @@ DIST Python-2.6.8.tar.bz2 11127915 SHA256 c34036718ee1f091736677f543bc7960861cf9fcbea77d49572b59f7f1ab3c3f SHA512 91aa96574328d7165b7ff799cc4f33e021c18865bb0b08a4bc2d1361633c3290964cc54beb817fe42ab0a569b57652c990e2c6aa6d4d8aefe0063fcefcff7642 WHIRLPOOL 03403bcd7fd47fd670d3176e12e6778519487da168cf08c46ce663c89caa65f1f792f1b1611516d0b099c4746f17a1a595ad22caa550fefa658e8b982efb6ea2 +DIST Python-2.7.3.tar.bz2 11793433 SHA256 726457e11cb153adc3f428aaf1901fc561a374c30e5e7da6742c0742a338663c DIST python-gentoo-patches-2.6.8-0.tar.bz2 17608 SHA256 277dbeb19107d3244e58aee98f130ce98d03775e7d4074ff9e1577125c999c06 SHA512 2a988a81db888ce56e07d4591ab37b641e51f73f85c087ac0505dc2b703b1dd450ed36b2533e5e562935d2f5e17d581fbbcfd0b0dc4bee69c882f3442da29632 WHIRLPOOL 8ae0f01e1218ed758b9dfca9b4de6a9115c09db665a2831f9af7b8e3f9aa178c10d129104273b551b8a26e9ba575e3f8d3256d7622506a69d496935ce9d87685 +DIST python-gentoo-patches-2.7.3-1.tar.bz2 13858 SHA256 51f6981ba02064998dfb020725c33233641b3743c4f5cf04091657313a49b8fd diff --git a/sdk_container/src/third_party/coreos-overlay/dev-lang/python/files/python-2.7.3-cross-distutils.patch b/sdk_container/src/third_party/coreos-overlay/dev-lang/python/files/python-2.7.3-cross-distutils.patch new file mode 100644 index 0000000000..1644cb6016 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/dev-lang/python/files/python-2.7.3-cross-distutils.patch @@ -0,0 +1,93 @@ +Extensions should be installed to the targets libdir. This is important if e.g. host +has a 64bit /usr/lib64, but the target is 32bit and has $ROOT/usr/lib. Make sure we +respect the target's lib structure by getting the libdir name from Makefile. + +--- a/Lib/distutils/command/install.py ++++ b/Lib/distutils/command/install.py +@@ -38,8 +38,8 @@ + + INSTALL_SCHEMES = { + 'unix_prefix': { +- 'purelib': '$base/@@GENTOO_LIBDIR@@/python$py_version_short/site-packages', +- 'platlib': '$platbase/@@GENTOO_LIBDIR@@/python$py_version_short/site-packages', ++ 'purelib': '$base/$libdirname/python$py_version_short/site-packages', ++ 'platlib': '$platbase/$libdirname/python$py_version_short/site-packages', + 'headers': '$base/include/python$py_version_short/$dist_name', + 'scripts': '$base/bin', + 'data' : '$base', +@@ -289,6 +289,7 @@ + # everything else. + self.config_vars['base'] = self.install_base + self.config_vars['platbase'] = self.install_platbase ++ self.config_vars['libdirname'] = self.install_libdirname + + if DEBUG: + from pprint import pprint +@@ -394,6 +395,10 @@ + + self.install_base = self.prefix + self.install_platbase = self.exec_prefix ++ self.install_libdirname = os.path.basename(get_config_vars('LIBDIR')[0]) ++ if self.install_libdirname is None: ++ self.install_libdirname = '@@GENTOO_LIBDIR@@' ++ + self.select_scheme("unix_prefix") + + # finalize_unix () +--- a/Lib/distutils/command/build_ext.py ++++ b/Lib/distutils/command/build_ext.py +@@ -201,7 +201,8 @@ + and sysconfig.get_config_var('Py_ENABLE_SHARED'): + if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")): + # building third party extensions +- self.library_dirs.append(sysconfig.get_config_var('LIBDIR')) ++ sysroot = os.getenv('SYSROOT', '') ++ self.library_dirs.append(sysroot + sysconfig.get_config_var('LIBDIR')) + else: + # building python standard extensions + self.library_dirs.append('.') +--- a/Lib/distutils/sysconfig.py ++++ b/Lib/distutils/sysconfig.py +@@ -19,9 +19,16 @@ + from distutils.errors import DistutilsPlatformError + + # These are needed in a couple of spots, so just compute them once. ++SYSROOT = os.getenv('SYSROOT', '') + PREFIX = os.path.normpath(sys.prefix) + EXEC_PREFIX = os.path.normpath(sys.exec_prefix) + ++# Make sure we respect the user specified SYSROOT environment variable. ++# This is the first step to get distutils to crosscompile stuff. ++if SYSROOT: ++ PREFIX = os.path.normpath(SYSROOT + os.path.sep + PREFIX) ++ EXEC_PREFIX = os.path.normpath(SYSROOT + os.path.sep + EXEC_PREFIX) ++ + # Path to the base directory of the project. On Windows the binary may + # live in project/PCBuild9. If we're dealing with an x64 Windows build, + # it'll live in project/PCbuild/amd64. +@@ -110,6 +117,12 @@ + + If 'prefix' is supplied, use it instead of sys.prefix or + sys.exec_prefix -- i.e., ignore 'plat_specific'. ++ ++ For the posix system we can not always assume the host's notion of the ++ libdir is the same for the target. e.g. compiling on an x86_64 system ++ will use 'lib64' but an arm 32bit target will use 'lib'. So encode all ++ the known lists of dirs and search them all (starting with the host one ++ so that native builds work just fine). + """ + if prefix is None: + prefix = plat_specific and EXEC_PREFIX or PREFIX +@@ -119,8 +119,10 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): + prefix = plat_specific and EXEC_PREFIX or PREFIX + + if os.name == "posix": +- libpython = os.path.join(prefix, +- "@@GENTOO_LIBDIR@@", "python" + get_python_version()) ++ for libdir in ['@@GENTOO_LIBDIR@@', 'lib64', 'lib32', 'libx32', 'lib']: ++ libpython = os.path.join(prefix, libdir, "python" + get_python_version()) ++ if os.path.exists(libpython): ++ break + if standard_lib: + return libpython + else: diff --git a/sdk_container/src/third_party/coreos-overlay/dev-lang/python/files/python-2.7.3-cross-h2py.patch b/sdk_container/src/third_party/coreos-overlay/dev-lang/python/files/python-2.7.3-cross-h2py.patch new file mode 100644 index 0000000000..8801fa87c0 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/dev-lang/python/files/python-2.7.3-cross-h2py.patch @@ -0,0 +1,36 @@ +use the host python when running the h2py code, and have that search sysroot + +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -431,10 +431,10 @@ + $(srcdir)/Lib/$(PLATDIR): + mkdir $(srcdir)/Lib/$(PLATDIR) + cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen +- export PATH; PATH="`pwd`:$$PATH"; \ ++ export INCLUDE="$(SYSROOT)$(INCLUDEDIR)"; \ + export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \ + export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \ +- export EXE; EXE="$(BUILDEXE)"; \ ++ export HOSTPYTHON="`realpath $(HOSTPYTHON)`"; \ + cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen + + python-config: $(srcdir)/Misc/python-config.in +--- a/Tools/scripts/h2py.py ++++ b/Tools/scripts/h2py.py +@@ -60,6 +60,7 @@ except KeyError: + searchdirs=['/usr/include'] + + def main(): ++ sysroot = os.getenv('SYSROOT', '') + global filedict + opts, args = getopt.getopt(sys.argv[1:], 'i:') + for o, a in opts: +@@ -72,7 +73,7 @@ def main(): + sys.stdout.write('# Generated by h2py from stdin\n') + process(sys.stdin, sys.stdout) + else: +- fp = open(filename, 'r') ++ fp = open(sysroot + filename, 'r') + outfile = os.path.basename(filename) + i = outfile.rfind('.') + if i > 0: outfile = outfile[:i] diff --git a/sdk_container/src/third_party/coreos-overlay/dev-lang/python/files/python-2.7.3-cross-install-compile.patch b/sdk_container/src/third_party/coreos-overlay/dev-lang/python/files/python-2.7.3-cross-install-compile.patch new file mode 100644 index 0000000000..93bac05210 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/dev-lang/python/files/python-2.7.3-cross-install-compile.patch @@ -0,0 +1,35 @@ +some of the modules that we compile need more modules on the host to make work + +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -952,25 +952,25 @@ libinstall: + $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \ + $(DESTDIR)$(LIBDEST)/distutils/tests ; \ + fi +- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ++ PYTHONPATH=$(HOSTPYTHONPATH):$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ + ./$(HOSTPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST) -f \ + -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ + $(DESTDIR)$(LIBDEST) +- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ++ PYTHONPATH=$(HOSTPYTHONPATH):$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ + ./$(HOSTPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST) -f \ + -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ + $(DESTDIR)$(LIBDEST) +- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ++ -PYTHONPATH=$(HOSTPYTHONPATH):$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ + ./$(HOSTPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST)/site-packages -f \ + -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages +- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ++ -PYTHONPATH=$(HOSTPYTHONPATH):$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ + ./$(HOSTPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST)/site-packages -f \ + -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages +- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ++ -PYTHONPATH=$(HOSTPYTHONPATH):$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ + ./$(HOSTPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()" + + # Create the PLATDIR source directory, if one wasn't distributed.. diff --git a/sdk_container/src/third_party/coreos-overlay/dev-lang/python/files/python-2.7.3-cross-setup-sysroot.patch b/sdk_container/src/third_party/coreos-overlay/dev-lang/python/files/python-2.7.3-cross-setup-sysroot.patch new file mode 100644 index 0000000000..e7ce4b1104 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/dev-lang/python/files/python-2.7.3-cross-setup-sysroot.patch @@ -0,0 +1,159 @@ +Change setup.py to respect the SYSROOT environment variable + +--- a/setup.py ++++ b/setup.py +@@ -337,9 +337,13 @@ + + def detect_modules(self): + global disable_ssl ++ ++ # We must respect the user specified sysroot! ++ sysroot = os.getenv('SYSROOT', '') ++ + # 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, sysroot + '/usr/local/lib') ++ add_dir_to_list(self.compiler.include_dirs, sysroot + '/usr/local/include') + self.add_multiarch_paths() + + # Add paths specified in the environment variables LDFLAGS and +@@ -375,10 +379,16 @@ + # building a framework with different architectures than + # the one that is currently installed (issue #7473) + add_dir_to_list(self.compiler.library_dirs, +- sysconfig.get_config_var("LIBDIR")) ++ sysroot + sysconfig.get_config_var("LIBDIR")) + add_dir_to_list(self.compiler.include_dirs, +- sysconfig.get_config_var("INCLUDEDIR")) ++ sysroot + sysconfig.get_config_var("INCLUDEDIR")) + ++ # We should always look into sysroot/usr/include and consider ++ # also the lib dirs there for searching for files ++ add_dir_to_list(self.compiler.include_dirs, sysroot + '/usr/include') ++ add_dir_to_list(self.compiler.library_dirs, sysroot + '/@@GENTOO_LIBDIR@@') ++ add_dir_to_list(self.compiler.library_dirs, sysroot + '/usr/@@GENTOO_LIBDIR@@') ++ + try: + have_unicode = unicode + except NameError: +@@ -389,6 +399,9 @@ + '/lib', '/usr/lib', + ] + inc_dirs = self.compiler.include_dirs + ['/usr/include'] ++ # Ignore previous settings. ++ lib_dirs = self.compiler.library_dirs ++ inc_dirs = self.compiler.include_dirs + exts = [] + missing = [] + +@@ -613,11 +626,11 @@ + elif curses_library: + readline_libs.append(curses_library) + elif self.compiler.find_library_file(lib_dirs + +- ['/usr/@@GENTOO_LIBDIR@@/termcap'], ++ [sysroot + '/usr/@@GENTOO_LIBDIR@@/termcap'], + 'termcap'): + readline_libs.append('termcap') + exts.append( Extension('readline', ['readline.c'], +- library_dirs=['/usr/@@GENTOO_LIBDIR@@/termcap'], ++ library_dirs=[sysroot + '/usr/@@GENTOO_LIBDIR@@/termcap'], + extra_link_args=readline_extra_link_args, + libraries=readline_libs) ) + else: +@@ -642,20 +655,20 @@ + 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/' ++ sysroot + '/usr/local/ssl/include', ++ sysroot + '/usr/contrib/ssl/include/' + ] + ssl_incs = find_file('openssl/ssl.h', inc_dirs, + search_for_ssl_incs_in + ) + if ssl_incs is not None and not disable_ssl: + krb5_h = find_file('krb5.h', inc_dirs, +- ['/usr/kerberos/include']) ++ [sysroot + '/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/' ++ [sysroot + '/usr/local/ssl/lib', ++ sysroot + '/usr/contrib/ssl/lib/' + ] ) + + if (ssl_incs is not None and +@@ -773,6 +786,7 @@ + db_inc_paths.append('/usr/local/include/db3%d' % x) + db_inc_paths.append('/pkg/db-3.%d/include' % x) + db_inc_paths.append('/opt/db-3.%d/include' % x) ++ db_inc_paths = [sysroot + x for x in db_inc_paths] + + # Add some common subdirectories for Sleepycat DB to the list, + # based on the standard include directories. This way DB3/4 gets +@@ -921,5 +935,6 @@ + '/usr/local/include/sqlite', + '/usr/local/include/sqlite3', + ] ++ sqlite_inc_paths = [sysroot + x for x in sqlite_inc_paths] + MIN_SQLITE_VERSION_NUMBER = (3, 0, 8) + MIN_SQLITE_VERSION = ".".join([str(x) +@@ -1021,7 +1036,7 @@ + # we do not build this one. Otherwise this build will pick up + # the more recent berkeleydb's db.h file first in the include path + # when attempting to compile and it will fail. +- f = "/usr/include/db.h" ++ f = sysroot + "/usr/include/db.h" + + if sys.platform == 'darwin': + if is_macosx_sdk_path(f): +@@ -1546,7 +1561,7 @@ + # 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(sysroot + '/usr/X11R6/include') + frameworks = ['-framework', 'Tcl', '-framework', 'Tk'] + + # All existing framework builds of Tcl/Tk don't support 64-bit +@@ -1579,6 +1594,9 @@ + def detect_tkinter(self, inc_dirs, lib_dirs): + # The _tkinter module. + ++ # We must respect the user specified sysroot! ++ sysroot = os.getenv('SYSROOT', '') ++ + # Rather than complicate the code below, detecting and building + # AquaTk is a separate method. Only one Tkinter will be built on + # Darwin - either AquaTk, if it is found, or X11 based Tk. +@@ -1633,17 +1651,17 @@ + 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') ++ elif os.path.exists(sysroot + '/usr/X11R6/include'): ++ include_dirs.append(sysroot + '/usr/X11R6/include') ++ added_lib_dirs.append(sysroot + '/usr/X11R6/lib64') ++ added_lib_dirs.append(sysroot + '/usr/X11R6/lib') ++ elif os.path.exists(sysroot + '/usr/X11R5/include'): ++ include_dirs.append(sysroot + '/usr/X11R5/include') ++ added_lib_dirs.append(sysroot + '/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(sysroot + '/usr/X11/include') ++ added_lib_dirs.append(sysroot + '/usr/X11/lib') + + # If Cygwin, then verify that X is installed before proceeding + if platform == 'cygwin': diff --git a/sdk_container/src/third_party/coreos-overlay/dev-lang/python/files/python-2.7.3-gcc-4_8.patch b/sdk_container/src/third_party/coreos-overlay/dev-lang/python/files/python-2.7.3-gcc-4_8.patch new file mode 100644 index 0000000000..4147b7e7b4 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/dev-lang/python/files/python-2.7.3-gcc-4_8.patch @@ -0,0 +1,58 @@ +Fix gcc 4.8 build broken for python 2.7. +The error was reported while building chromeos-chrome - "error: +'PyArg_ParseTuple' is an unrecognized format function type". The issue is that +'-Wformat' is no longer included by default in gcc 4.8. The solution is to add +'-Wformat' explictly to configure. For GCC 4.7, since '-Wformat' is enabled by +default, the modification has no impact to current gcc. Below shows the +difference between gcc 4.7 and gcc 4.8. + + void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2))); + int + main () + { + + ; + return 0; + } + + With gcc 4.7: + $ gcc -Werror /tmp/foo.c + /tmp/foo.c:1:1: error: ‘PyArg_ParseTuple’ is an unrecognized format function type [-Werror=format] + cc1: all warnings being treated as errors + $ echo $? + 1 + + With gcc 4.8: + $ ~/coding/gcc-python/gcc-svn-trunk/install/bin/gcc -Werror /tmp/foo.c + $ echo $? + 0 + + but on adding -Wall: + $ ~/coding/gcc-python/gcc-svn-trunk/install/bin/gcc -Werror -Wall /tmp/foo.c + /tmp/foo.c:1:1: error: ‘PyArg_ParseTuple’ is an unrecognized format function type [-Werror=format=] + void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2))); + ^ + cc1: all warnings being treated as errors + $ echo $? + 1 + + or indeed just -Wformat: + + $ ~/coding/gcc-python/gcc-svn-trunk/install/bin/gcc -Werror -Wformat /tmp/foo.c + /tmp/foo.c:1:1: error: ‘PyArg_ParseTuple’ is an unrecognized format function type [-Werror=format=] + void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2))); + ^ + cc1: all warnings being treated as errors + $ echo $? + 1 +--- configure.in.orig 2013-04-09 11:13:52.568435225 -0700 ++++ configure.in 2013-04-09 11:14:06.998565440 -0700 +@@ -1192,7 +1192,7 @@ if test "$GCC" = "yes" + then + AC_MSG_CHECKING(whether gcc supports ParseTuple __format__) + save_CFLAGS=$CFLAGS +- CFLAGS="$CFLAGS -Werror" ++ CFLAGS="$CFLAGS -Werror -Wformat" + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));]], [[]]) + ],[ diff --git a/sdk_container/src/third_party/coreos-overlay/dev-lang/python/metadata.xml b/sdk_container/src/third_party/coreos-overlay/dev-lang/python/metadata.xml new file mode 100644 index 0000000000..51a9e80800 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/dev-lang/python/metadata.xml @@ -0,0 +1,10 @@ + + + +python + + Enable threading support. (DON'T DISABLE THIS UNLESS YOU KNOW WHAT YOU'RE DOING) + Enable wide Unicode implementation which uses 4-byte Unicode characters. Switching of this USE flag changes ABI of Python and requires reinstallation of many Python modules. (DON'T DISABLE THIS UNLESS YOU KNOW WHAT YOU'RE DOING) + Install Windows executables required to create an executable installer for MS Windows. + + diff --git a/sdk_container/src/third_party/coreos-overlay/dev-lang/python/python-2.7.3-r5.ebuild b/sdk_container/src/third_party/coreos-overlay/dev-lang/python/python-2.7.3-r5.ebuild new file mode 100644 index 0000000000..f16026aa6d --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/dev-lang/python/python-2.7.3-r5.ebuild @@ -0,0 +1,420 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.7.3-r3.ebuild,v 1.5 2012/12/19 18:03:41 floppym Exp $ + +EAPI="2" +WANT_AUTOMAKE="none" +WANT_LIBTOOL="none" + +inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs multiprocessing + +MY_P="Python-${PV}" +PATCHSET_REVISION="1" + +DESCRIPTION="An interpreted, interactive, object-oriented programming language" +HOMEPAGE="http://www.python.org/" +SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.bz2 + mirror://gentoo/python-gentoo-patches-${PV}-${PATCHSET_REVISION}.tar.bz2" + +LICENSE="PSF-2" +SLOT="2.7" +KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" +IUSE="-berkdb build doc elibc_uclibc examples gdbm hardened ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml" + +# Do not add a dependency on dev-lang/python to this ebuild. +# If you need to apply a patch which requires python for bootstrapping, please +# run the bootstrap code on your dev box and include the results in the +# patchset. See bug 447752. + +RDEPEND="app-arch/bzip2 + >=sys-libs/zlib-1.1.3 + virtual/libffi + virtual/libintl + !build? ( + berkdb? ( || ( + sys-libs/db:4.8 + sys-libs/db:4.7 + sys-libs/db:4.6 + sys-libs/db:4.5 + sys-libs/db:4.4 + sys-libs/db:4.3 + sys-libs/db:4.2 + ) ) + gdbm? ( sys-libs/gdbm ) + ncurses? ( + >=sys-libs/ncurses-5.2 + readline? ( >=sys-libs/readline-4.1 ) + ) + sqlite? ( >=dev-db/sqlite-3.3.8:3[extensions] ) + ssl? ( dev-libs/openssl ) + tk? ( + >=dev-lang/tk-8.0 + dev-tcltk/blt + ) + xml? ( >=dev-libs/expat-2.1 ) + ) + !!/dev/null + OPT="-O1" CFLAGS="" CPPFLAGS="" LDFLAGS="" CC="" \ + "${S}"/configure \ + --{build,host}=${CBUILD} \ + || die "cross-configure failed" + ) & + multijob_post_fork + + # The configure script assumes it's buggy when cross-compiling. + export ac_cv_buggy_getaddrinfo=no + export ac_cv_have_long_long_format=yes + fi + + # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile. + tc-export CXX + # The configure script fails to use pkg-config correctly. + # http://bugs.python.org/issue15506 + export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG) + + # Set LDFLAGS so we link modules with -lpython2.7 correctly. + # Needed on FreeBSD unless Python 2.7 is already installed. + # Please query BSD team before removing this! + append-ldflags "-L." + + local dbmliborder + if use gdbm; then + dbmliborder+="${dbmliborder:+:}gdbm" + fi + if use berkdb; then + dbmliborder+="${dbmliborder:+:}bdb" + fi + + cd "${WORKDIR}"/${CHOST} + ECONF_SOURCE=${S} OPT="" \ + econf \ + --with-fpectl \ + --enable-shared \ + $(use_enable ipv6) \ + $(use_with threads) \ + $(use wide-unicode && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") \ + --infodir='${prefix}/share/info' \ + --mandir='${prefix}/share/man' \ + --with-dbmliborder="${dbmliborder}" \ + --with-libc="" \ + --enable-loadable-sqlite-extensions \ + --with-system-expat \ + --with-system-ffi + + if tc-is-cross-compiler; then + # Modify the Makefile.pre so we don't regen for the host/ one. + # We need to link the host python programs into $PWD and run + # them from here because the distutils sysconfig module will + # parse Makefile/etc... from argv[0], and we need it to pick + # up the target settings, not the host ones. + sed -i \ + -e '1iHOSTPYTHONPATH = ./hostpythonpath:' \ + -e '/^HOSTPYTHON/s:=.*:= ./hostpython:' \ + -e '/^HOSTPGEN/s:=.*:= ./Parser/hostpgen:' \ + Makefile{.pre,} || die "sed failed" + fi + + multijob_finish +} + +src_compile() { + if tc-is-cross-compiler; then + cd "${WORKDIR}"/${CBUILD} + # Disable as many modules as possible -- but we need a few to install. + PYTHON_DISABLE_MODULES=$( + sed -n "/Extension('/{s:^.*Extension('::;s:'.*::;p}" "${S}"/setup.py | \ + egrep -v '(unicodedata|time|cStringIO|_struct|binascii)' + ) \ + PTHON_DISABLE_SSL="1" \ + SYSROOT= \ + emake || die "cross-make failed" + [[ -e build/lib.linux-x86_64-${SLOT}/unicodedata.so ]] || die + # See comment in src_configure about these. + ln python ../${CHOST}/hostpython || die + ln Parser/pgen ../${CHOST}/Parser/hostpgen || die + ln -s ../${CBUILD}/build/lib.*/ ../${CHOST}/hostpythonpath || die + fi + + cd "${WORKDIR}"/${CHOST} + default + + # Work around bug 329499. See also bug 413751. + pax-mark m python +} + +src_test() { + # Tests will not work when cross compiling. + if tc-is-cross-compiler; then + elog "Disabling tests due to crosscompiling." + return + fi + + cd "${WORKDIR}"/${CHOST} + + # Skip failing tests. + local skipped_tests="distutils gdb" + + for test in ${skipped_tests}; do + mv "${S}"/Lib/test/test_${test}.py "${T}" + done + + # Rerun failed tests in verbose mode (regrtest -w). + emake test EXTRATESTOPTS="-w" < /dev/tty + local result="$?" + + for test in ${skipped_tests}; do + mv "${T}/test_${test}.py" "${S}"/Lib/test + done + + elog "The following tests have been skipped:" + for test in ${skipped_tests}; do + elog "test_${test}.py" + done + + elog "If you would like to run them, you may:" + elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'" + elog "and run the tests separately." + + python_disable_pyc + + if [[ "${result}" -ne 0 ]]; then + die "emake test failed" + fi +} + +src_install() { + [[ -z "${ED}" ]] && ED="${D%/}${EPREFIX}/" + + local libdir=${ED}/usr/$(get_libdir)/python${SLOT} + + cd "${WORKDIR}"/${CHOST} + emake DESTDIR="${D}" altinstall maninstall || die "emake altinstall maninstall failed" + + sed -e "s/\(LDFLAGS=\).*/\1/" -i "${libdir}/config/Makefile" || die "sed failed" + + # Backwards compat with Gentoo divergence. + dosym python${SLOT}-config /usr/bin/python-config-${SLOT} || die + + # Fix collisions between different slots of Python. + mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}" + mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}" + mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}" + rm -f "${ED}usr/bin/smtpd.py" + + if use build; then + rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{bsddb,dbhash.py,idlelib,lib-tk,sqlite3,test} + else + use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test} + use berkdb || rm -fr "${libdir}/"{bsddb,dbhash.py,test/test_bsddb*} + use sqlite || rm -fr "${libdir}/"{sqlite3,test/test_sqlite*} + use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,lib-tk} + fi + + use threads || rm -fr "${libdir}/multiprocessing" + use wininst || rm -f "${libdir})/distutils/command/"wininst-*.exe + + dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS} || die "dodoc failed" + + if use examples; then + insinto /usr/share/doc/${PF}/examples + doins -r "${S}"/Tools || die "doins failed" + fi + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 + local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \ + emake --no-print-directory -s -f - 2>/dev/null) + newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py + + newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed" + newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed" + sed \ + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \ + -e "s:@PYDOC@:pydoc${SLOT}:" \ + -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed" + + # for python-exec + python_export python${SLOT} EPYTHON PYTHON PYTHON_SITEDIR + + # if not using a cross-compiler, use the fresh binary + if ! tc-is-cross-compiler; then + local PYTHON=./python \ + LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}. + export LD_LIBRARY_PATH + fi + + echo "EPYTHON='${EPYTHON}'" > epython.py + python_domodule epython.py + + # The sysconfig module will actually read the pyconfig.h at runtime to see what kind + # of functionality is enabled in the build. Deploy it behind the back of portage as + # need be. + ln "${ED}/usr/include/python${SLOT}/pyconfig.h" "${libdir}/pyconfig_h" || die + + # Workaround https://bugs.gentoo.org/380569 + keepdir /etc/env.d/python +} + +pkg_preinst() { + if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version "${CATEGORY}/${PN}:2.7"; then + python_updater_warning="1" + fi +} + +eselect_python_update() { + [[ -z "${EROOT}" || (! -d "${EROOT}" && -d "${ROOT}") ]] && EROOT="${ROOT%/}${EPREFIX}/" + + if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then + eselect python update + fi + + if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then + eselect python update --python${PV%%.*} + fi +} + +pkg_postinst() { + eselect_python_update + + if [[ "${python_updater_warning}" == "1" ]]; then + ewarn "You have just upgraded from an older version of Python." + ewarn "You should switch active version of Python ${PV%%.*} and run" + ewarn "'python-updater [options]' to rebuild Python modules." + fi + + local pyconfig="${EROOT}/usr/$(get_libdir)/python${SLOT}/pyconfig_h" + if [[ ! -e ${EROOT}/usr/include/python${SLOT}/pyconfig.h ]] ; then + # See pkg_preinst above for details. + install -D -m644 "${pyconfig}" "${EROOT}/usr/include/python${SLOT}/pyconfig.h" || die + fi + rm "${pyconfig}" || die +} + +pkg_postrm() { + eselect_python_update +} diff --git a/sdk_container/src/third_party/coreos-overlay/profiles/base/make.defaults b/sdk_container/src/third_party/coreos-overlay/profiles/base/make.defaults index 6e7daf2336..29b3e60d44 100644 --- a/sdk_container/src/third_party/coreos-overlay/profiles/base/make.defaults +++ b/sdk_container/src/third_party/coreos-overlay/profiles/base/make.defaults @@ -125,10 +125,8 @@ BOOTSTRAP_USE="cxx unicode threads curl" # Mike Gilbert (15 May 2012) # Default target(s) for python-r1.eclass -PYTHON_TARGETS="python2_6" +PYTHON_TARGETS="python2_6 python2_7" PYTHON_SINGLE_TARGET="python2_6" -# TODO(marineam): remove USE_PYTHON during the 2.7 upgrade -USE_PYTHON="2.6" # ChromeOS-specific: BOARD_USE for accessing board value in cros-board.eclass # CROS_WORKON_TREE for cros-workon