From f410b1d1d8ffc090d9b4f2b903586ab679b99cd1 Mon Sep 17 00:00:00 2001 From: utahta Date: Fri, 8 Jul 2011 19:25:18 +0900 Subject: [PATCH] update --- pythonbrew/installer/pythoninstaller.py | 5 ++- .../patches/all/python24/patch-setup.py.diff | 45 +++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 pythonbrew/patches/all/python24/patch-setup.py.diff diff --git a/pythonbrew/installer/pythoninstaller.py b/pythonbrew/installer/pythoninstaller.py index 4e2e7cb..4575df4 100644 --- a/pythonbrew/installer/pythoninstaller.py +++ b/pythonbrew/installer/pythoninstaller.py @@ -114,7 +114,10 @@ class PythonInstaller(object): def patch(self): version = self.pkg.version # ubuntu 11.04(Natty) - if is_python25(version): + if is_python24(version): + patch_dir = os.path.join(PATH_PATCHES_ALL, "python24") + self._add_patches_to_list(patch_dir, ['patch-setup.py.diff']) + elif is_python25(version): patch_dir = os.path.join(PATH_PATCHES_ALL, "python25") self._add_patches_to_list(patch_dir, ['patch-setup.py.diff']) elif is_python26(version): diff --git a/pythonbrew/patches/all/python24/patch-setup.py.diff b/pythonbrew/patches/all/python24/patch-setup.py.diff new file mode 100644 index 0000000..ffe4b0d --- /dev/null +++ b/pythonbrew/patches/all/python24/patch-setup.py.diff @@ -0,0 +1,45 @@ +--- setup.py.orig 2011-07-07 19:19:43.800122463 +0900 ++++ setup.py 2011-07-07 19:25:04.548416377 +0900 +@@ -13,6 +13,7 @@ + from distutils.command.build_ext import build_ext + from distutils.command.install import install + from distutils.command.install_lib import install_lib ++from distutils.spawn import find_executable + + # This global variable is used to hold the list of modules to be disabled. + disabled_module_list = [] +@@ -242,10 +243,34 @@ + return platform + return sys.platform + ++ def add_multiarch_paths(self): ++ # Debian/Ubuntu multiarch support. ++ # https://wiki.ubuntu.com/MultiarchSpec ++ if not find_executable('dpkg-architecture'): ++ return ++ tmpfile = os.path.join(self.build_temp, 'multiarch') ++ if not os.path.exists(self.build_temp): ++ os.makedirs(self.build_temp) ++ ret = os.system( ++ 'dpkg-architecture -qDEB_HOST_MULTIARCH > %s 2> /dev/null' % ++ tmpfile) ++ try: ++ if ret >> 8 == 0: ++ fp = open(tmpfile) ++ multiarch_path_component = fp.readline().strip() ++ fp.close() ++ add_dir_to_list(self.compiler.library_dirs, ++ '/usr/lib/' + multiarch_path_component) ++ add_dir_to_list(self.compiler.include_dirs, ++ '/usr/include/' + multiarch_path_component) ++ finally: ++ os.unlink(tmpfile) ++ + 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') ++ self.add_multiarch_paths() + + # Add paths specified in the environment variables LDFLAGS and + # CPPFLAGS for header and library files.