added patch-python26

This commit is contained in:
Yuta
2011-05-02 17:30:59 +09:00
parent 3bc8c36aaa
commit 20027a4a36
19 changed files with 221 additions and 83 deletions
+1
View File
@@ -24,6 +24,7 @@ PATH_SCRIPTS_PYTHONBREW_COMMANDS = os.path.join(PATH_SCRIPTS_PYTHONBREW,"command
PATH_SCRIPTS_PYTHONBREW_INSTALLER = os.path.join(PATH_SCRIPTS_PYTHONBREW,"installer")
PATH_PATCHES = os.path.join(ROOT,"patches")
PATH_PATCHES_MACOSX = os.path.join(PATH_PATCHES,"macosx")
PATH_PATCHES_MACOSX_PYTHON26 = os.path.join(PATH_PATCHES_MACOSX,"python26")
PATH_PATCHES_MACOSX_PYTHON25 = os.path.join(PATH_PATCHES_MACOSX,"python25")
PATH_PATCHES_MACOSX_PYTHON24 = os.path.join(PATH_PATCHES_MACOSX,"python24")
+32 -7
View File
@@ -10,7 +10,8 @@ from pythonbrew.util import makedirs, symlink, Package, is_url, Link,\
fileurl_to_path
from pythonbrew.define import PATH_BUILD, PATH_DISTS, PATH_PYTHONS,\
ROOT, PATH_LOG, DISTRIBUTE_SETUP_DLSITE,\
PATH_PATCHES_MACOSX_PYTHON25, PATH_PATCHES_MACOSX_PYTHON24
PATH_PATCHES_MACOSX_PYTHON25, PATH_PATCHES_MACOSX_PYTHON24,\
PATH_PATCHES_MACOSX_PYTHON26
from pythonbrew.downloader import get_python_version_url, Downloader,\
get_headerinfo_from_url
from pythonbrew.log import logger
@@ -200,6 +201,7 @@ class PythonInstallerMacOSX(PythonInstaller):
try:
s = Subprocess(log=self.logfile, cwd=self.build_dir)
patches = []
eds = {}
if is_python24(version):
patch_dir = PATH_PATCHES_MACOSX_PYTHON24
patches = ['patch-configure', 'patch-Makefile.pre.in',
@@ -212,15 +214,38 @@ class PythonInstallerMacOSX(PythonInstaller):
'patch-gestaltmodule.c.diff']
elif is_python25(version):
patch_dir = PATH_PATCHES_MACOSX_PYTHON25
patches = ['patch-Makefile.pre.in.diff', 'patch-Lib-cgi.py.diff',
'patch-Lib-distutils-dist.py.diff', 'patch-setup.py.diff',
'patch-configure-badcflags.diff', 'patch-configure-arch_only.diff',
'patch-64bit.diff', 'patch-pyconfig.h.in.diff',
'patch-Modules-posixmodule.c.diff', 'patch-gestaltmodule.c.diff']
if patches:
patches = ['patch-Makefile.pre.in.diff',
'patch-Lib-cgi.py.diff',
'patch-Lib-distutils-dist.py.diff',
'patch-setup.py.diff',
'patch-configure-badcflags.diff',
'patch-configure-arch_only.diff',
'patch-64bit.diff',
'patch-pyconfig.h.in.diff',
'patch-gestaltmodule.c.diff']
eds = {'_localemodule.c.ed': 'Modules/_localemodule.c',
'locale.py.ed': 'Lib/locale.py'}
elif is_python26(version):
patch_dir = PATH_PATCHES_MACOSX_PYTHON26
patches = ['patch-Lib-cgi.py.diff',
'patch-Lib-distutils-dist.py.diff',
'patch-Mac-IDLE-Makefile.in.diff',
'patch-Mac-Makefile.in.diff',
'patch-Mac-PythonLauncher-Makefile.in.diff',
'patch-Mac-Tools-Doc-setup.py.diff',
'patch-setup.py-db46.diff',
'patch-Lib-ctypes-macholib-dyld.py.diff',
'patch-setup_no_tkinter.py.diff']
eds = {'_localemodule.c.ed': 'Modules/_localemodule.c',
'locale.py.ed': 'Lib/locale.py'}
if patches or eds:
logger.info("Patching %s" % self.pkg.name)
for patch in patches:
s.check_call("patch -p0 < %s" % os.path.join(patch_dir, patch))
for (ed, source) in eds.items():
ed = os.path.join(patch_dir, ed)
s.check_call('ed - %s < %s' % (source, ed))
except:
logger.error("Failed to patch `%s`" % self.build_dir)
sys.exit(1)
@@ -0,0 +1,2 @@
g/defined(__APPLE__)/s//0/g
w
@@ -0,0 +1,2 @@
g/'darwin', /s///
w
@@ -1,11 +0,0 @@
--- Mac/Modules/file/_Filemodule.c.orig 2009-09-12 15:55:59.000000000 +1000
+++ Mac/Modules/file/_Filemodule.c 2009-09-12 16:12:07.000000000 +1000
@@ -7,6 +7,8 @@
#include "pymactoolbox.h"
+typedef SInt16 FSIORefNum;
+
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
PyErr_SetString(PyExc_NotImplementedError, \
@@ -1,16 +0,0 @@
--- Misc/setuid-prog.c.orig Sat Dec 11 14:29:22 2004
+++ Misc/setuid-prog.c Sat Dec 11 14:30:13 2004
@@ -70,6 +70,12 @@
#define environ _environ
#endif
+#if defined(__APPLE__)
+#include <sys/time.h>
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+#endif
+
/* don't change def_IFS */
char def_IFS[] = "IFS= \t\n";
/* you may want to change def_PATH, but you should really change it in */
@@ -1,21 +0,0 @@
--- Modules/posixmodule.c.orig Sat Dec 11 14:27:52 2004
+++ Modules/posixmodule.c Sat Dec 11 14:28:17 2004
@@ -339,7 +339,7 @@
#endif
/* Return a dictionary corresponding to the POSIX environment table */
-#ifdef WITH_NEXT_FRAMEWORK
+#ifdef __APPLE__
/* On Darwin/MacOSX a shared library or framework has no access to
** environ directly, we must obtain it with _NSGetEnviron().
*/
@@ -357,7 +357,7 @@
d = PyDict_New();
if (d == NULL)
return NULL;
-#ifdef WITH_NEXT_FRAMEWORK
+#ifdef __APPLE__
if (environ == NULL)
environ = *_NSGetEnviron();
#endif
@@ -1,28 +0,0 @@
--- configure.in.orig 2007-09-28 21:07:32.000000000 +0200
+++ configure.in 2007-09-28 21:08:12.000000000 +0200
@@ -669,6 +669,11 @@
BLDLIBRARY='-L. -lpython$(VERSION)'
RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
;;
+ Darwin*)
+ LDLIBRARY='libpython$(VERSION).dylib'
+ BLDLIBRARY='-L. -lpython$(VERSION)'
+ RUNSHARED=DYLD_LIBRARY_PATH="`pwd`:${DYLD_LIBRARY_PATH}"
+ ;;
esac
else # shared is disabled
case $ac_sys_system in
--- configure.orig 2007-09-28 21:07:26.000000000 +0200
+++ configure 2007-09-28 21:07:33.000000000 +0200
@@ -3445,6 +3445,11 @@
BLDLIBRARY='-L. -lpython$(VERSION)'
RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
;;
+ Darwin*)
+ LDLIBRARY='libpython$(VERSION).dylib'
+ BLDLIBRARY='-L. -lpython$(VERSION)'
+ RUNSHARED=DYLD_LIBRARY_PATH="`pwd`:${DYLD_LIBRARY_PATH}"
+ ;;
esac
else # shared is disabled
case $ac_sys_system in
@@ -0,0 +1,3 @@
g/defined(__APPLE__)/s//0/g
w
@@ -0,0 +1,3 @@
g/'darwin', /s///
w
@@ -0,0 +1,18 @@
--- Lib/cgi.py.orig 2006-08-10 19:41:07.000000000 +0200
+++ Lib/cgi.py 2007-08-21 15:36:54.000000000 +0200
@@ -1,13 +1,6 @@
-#! /usr/local/bin/python
+#! @@PREFIX@@/bin/python2.6
-# NOTE: the above "/usr/local/bin/python" is NOT a mistake. It is
-# intentionally NOT "/usr/bin/env python". On many systems
-# (e.g. Solaris), /usr/local/bin is not in $PATH as passed to CGI
-# scripts, and /usr/local/bin is the default directory where Python is
-# installed, so /usr/bin/env would be unable to find python. Granted,
-# binary installations by Linux vendors often install Python in
-# /usr/bin. So let those vendors patch cgi.py to match their choice
-# of installation.
+# NOTE: /usr/local/bin/python patched for MacPorts installation
"""Support module for CGI (Common Gateway Interface) scripts.
@@ -0,0 +1,11 @@
--- Lib/ctypes/macholib/dyld.py.orig 2008-02-21 11:52:20.000000000 -0700
+++ Lib/ctypes/macholib/dyld.py 2009-10-11 02:42:21.000000000 -0600
@@ -26,7 +26,7 @@
DEFAULT_LIBRARY_FALLBACK = [
os.path.expanduser("~/lib"),
- "/usr/local/lib",
+ "@@PREFIX@@/lib",
"/lib",
"/usr/lib",
]
@@ -0,0 +1,51 @@
--- Lib/distutils/dist.py.orig 2008-09-03 05:13:56.000000000 -0600
+++ Lib/distutils/dist.py 2008-10-03 18:33:47.000000000 -0600
@@ -60,6 +60,7 @@
('quiet', 'q', "run quietly (turns verbosity off)"),
('dry-run', 'n', "don't actually do anything"),
('help', 'h', "show detailed help message"),
+ ('no-user-cfg', None,'ignore pydistutils.cfg in your home directory'),
]
# 'common_usage' is a short (2-3 line) string describing the common
@@ -267,6 +268,12 @@
else:
sys.stderr.write(msg + "\n")
+ # no-user-cfg is handled before other command line args
+ # because other args override the config files, and this
+ # one is needed before we can load the config files.
+ # If attrs['script_args'] wasn't passed, assume false.
+ self.want_user_cfg = '--no-user-cfg' not in (self.script_args or [])
+
self.finalize_options()
# __init__ ()
@@ -327,6 +334,9 @@
Distutils __inst__.py file lives), a file in the user's home
directory named .pydistutils.cfg on Unix and pydistutils.cfg
on Windows/Mac, and setup.cfg in the current directory.
+
+ The file in the user's home directory can be disabled with the
+ --no-user-cfg option.
"""
files = []
check_environ()
@@ -347,7 +357,7 @@
# And look for the user config file
user_file = os.path.join(os.path.expanduser('~'), user_filename)
- if os.path.isfile(user_file):
+ if self.want_user_cfg and os.path.isfile(user_file):
files.append(user_file)
# All platforms support local setup.cfg
@@ -355,6 +365,8 @@
if os.path.isfile(local_file):
files.append(local_file)
+ if DEBUG:
+ print "using config files: %s" % ', '.join(files)
return files
# find_config_files ()
@@ -0,0 +1,20 @@
--- Mac/IDLE/Makefile.in.orig 2009-01-02 04:47:17.000000000 -0700
+++ Mac/IDLE/Makefile.in 2009-04-16 00:54:43.000000000 -0600
@@ -22,7 +22,7 @@
BUNDLEBULDER=$(srcdir)/../../Lib/plat-mac/bundlebuilder.py
-PYTHONAPPSDIR=/Applications/$(PYTHONFRAMEWORK) $(VERSION)
+PYTHONAPPSDIR=@@APPLICATIONS_DIR@@/$(PYTHONFRAMEWORK) $(VERSION)
all: IDLE.app
@@ -42,7 +42,7 @@
$(srcdir)/../Icons/PythonSource.icns \
$(srcdir)/../Icons/PythonCompiled.icns Info.plist
rm -fr IDLE.app
- $(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) $(BUNDLEBULDER) \
+ PYTHONHOME=$(DESTDIR)$(prefix) $(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) $(BUNDLEBULDER) \
--builddir=. \
--name=IDLE \
--link-exec \
@@ -0,0 +1,20 @@
--- Mac/Makefile.in.orig 2009-03-30 13:58:41.000000000 -0600
+++ Mac/Makefile.in 2009-04-16 00:54:26.000000000 -0600
@@ -19,7 +19,7 @@
# These are normally glimpsed from the previous set
bindir=$(prefix)/bin
-PYTHONAPPSDIR=/Applications/$(PYTHONFRAMEWORK) $(VERSION)
+PYTHONAPPSDIR=@@APPLICATIONS_DIR@@/$(PYTHONFRAMEWORK) $(VERSION)
APPINSTALLDIR=$(prefix)/Resources/Python.app
# Variables for installing the "normal" unix binaries
@@ -224,7 +224,7 @@
cd IDLE && make install
install_BuildApplet:
- $(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) $(srcdir)/scripts/BuildApplet.py \
+ PYTHONHOME=$(DESTDIR)$(prefix) $(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) $(srcdir)/scripts/BuildApplet.py \
--destroot "$(DESTDIR)" \
--python=$(prefix)/Resources/Python.app/Contents/MacOS/$(PYTHONFRAMEWORK)`test -f "$(DESTDIR)$(prefix)/Resources/Python.app/Contents/MacOS/$(PYTHONFRAMEWORK)-32" && echo "-32"` \
--output "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app" \
@@ -0,0 +1,25 @@
--- Mac/PythonLauncher/Makefile.in.orig 2009-01-02 04:47:17.000000000 -0700
+++ Mac/PythonLauncher/Makefile.in 2009-04-16 00:55:11.000000000 -0600
@@ -1,3 +1,4 @@
+prefix=@prefix@
CC=@CC@
LD=@CC@
BASECFLAGS=@BASECFLAGS@
@@ -21,7 +22,7 @@
BUNDLEBULDER=$(srcdir)/../../Lib/plat-mac/bundlebuilder.py
-PYTHONAPPSDIR=/Applications/$(PYTHONFRAMEWORK) $(VERSION)
+PYTHONAPPSDIR=@@APPLICATIONS_DIR@@/$(PYTHONFRAMEWORK) $(VERSION)
OBJECTS=FileSettings.o MyAppDelegate.o MyDocument.o PreferencesWindowController.o doscript.o main.o
all: Python\ Launcher.app
@@ -42,7 +43,7 @@
$(srcdir)/../Icons/PythonCompiled.icns \
$(srcdir)/factorySettings.plist
rm -fr "Python Launcher.app"
- $(RUNSHARED) $(BUILDPYTHON) $(BUNDLEBULDER) \
+ PYTHONHOME=$(DESTDIR)$(prefix) $(RUNSHARED) $(BUILDPYTHON) $(BUNDLEBULDER) \
--builddir=. \
--name="Python Launcher" \
--executable="Python Launcher" \
@@ -0,0 +1,11 @@
--- Mac/Tools/Doc/setup.py.diff 2008-03-29 09:24:25.000000000 -0600
+++ Mac/Tools/Doc/setup.py 2008-10-04 19:53:40.000000000 -0600
@@ -30,7 +30,7 @@
MAJOR_VERSION='2.4'
MINOR_VERSION='2.4.1'
-DESTDIR='/Applications/MacPython-%s/PythonIDE.app/Contents/Resources/English.lproj/PythonDocumentation' % MAJOR_VERSION
+DESTDIR='@@APPLICATIONS_DIR@@/MacPython-%s/PythonIDE.app/Contents/Resources/English.lproj/PythonDocumentation' % MAJOR_VERSION
class DocBuild(build):
def initialize_options(self):
@@ -0,0 +1,11 @@
--- setup.py.orig 2010-10-19 22:33:25.000000000 +0200
+++ setup.py 2010-10-19 22:33:54.000000000 +0200
@@ -799,7 +799,7 @@
# BerkeleyDB 4.6.x is not stable on many architectures.
arch = platform_machine()
if arch not in ('i386', 'i486', 'i586', 'i686',
- 'x86_64', 'ia64'):
+ 'x86_64', 'ia64', 'Power Macintosh'):
return False
return True
@@ -0,0 +1,11 @@
--- setup.py.orig 2009-03-31 12:20:48.000000000 -0600
+++ setup.py 2009-09-17 00:33:12.000000000 -0600
@@ -17,7 +17,7 @@
from distutils.command.install_lib import install_lib
# This global variable is used to hold the list of modules to be disabled.
-disabled_module_list = []
+disabled_module_list = ["_tkinter"]
def add_dir_to_list(dirlist, dir):
"""Add the directory 'dir' to the list 'dirlist' (at the front) if