From fe50ed29eae8a417c66a55925e6dc7346d9b6020 Mon Sep 17 00:00:00 2001 From: Yamashita Yuu Date: Wed, 8 May 2013 17:49:09 +0900 Subject: [PATCH 1/3] bundle patches into python-build repository --- .../patches/all/common/patch-setup.py.diff | 47 +++++++++++++++++++ .../patches/all/python30/patch-setup.py.diff | 44 +++++++++++++++++ .../patches/all/python32/patch-setup.py.diff | 38 +++++++++++++++ plugins/python-build/share/python-build/2.6.6 | 3 +- plugins/python-build/share/python-build/2.6.7 | 3 +- plugins/python-build/share/python-build/2.6.8 | 3 +- plugins/python-build/share/python-build/2.7 | 3 +- plugins/python-build/share/python-build/2.7.1 | 3 +- plugins/python-build/share/python-build/3.0.1 | 3 +- plugins/python-build/share/python-build/3.1.3 | 3 +- plugins/python-build/share/python-build/3.2 | 3 +- 11 files changed, 137 insertions(+), 16 deletions(-) create mode 100644 plugins/python-build/patches/all/common/patch-setup.py.diff create mode 100644 plugins/python-build/patches/all/python30/patch-setup.py.diff create mode 100644 plugins/python-build/patches/all/python32/patch-setup.py.diff diff --git a/plugins/python-build/patches/all/common/patch-setup.py.diff b/plugins/python-build/patches/all/common/patch-setup.py.diff new file mode 100644 index 00000000..b2998bca --- /dev/null +++ b/plugins/python-build/patches/all/common/patch-setup.py.diff @@ -0,0 +1,47 @@ + +# HG changeset patch +# User Barry Warsaw +# Date 1302190091 14400 +# Node ID bd0f73a9538e05f526feaf05821e68bdcff498fa +# Parent 2e4cdaffe493e879fb5367a4aa454491de451137 +Backport for Python 2.7 of issue 11715 support for building Python on +multiarch Debian/Ubuntu. + +diff --git a/setup.py b/setup.py +--- setup.py.orig ++++ setup.py +@@ -345,10 +345,33 @@ class PyBuildExt(build_ext): + 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: ++ with open(tmpfile) as fp: ++ multiarch_path_component = fp.readline().strip() ++ 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. + diff --git a/plugins/python-build/patches/all/python30/patch-setup.py.diff b/plugins/python-build/patches/all/python30/patch-setup.py.diff new file mode 100644 index 00000000..8f1a1773 --- /dev/null +++ b/plugins/python-build/patches/all/python30/patch-setup.py.diff @@ -0,0 +1,44 @@ +--- setup.py.orig 2011-07-07 19:41:48.610196111 +0900 ++++ setup.py 2011-07-07 19:46:44.986310031 +0900 +@@ -14,6 +14,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 = [] +@@ -308,10 +309,33 @@ + 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: ++ with open(tmpfile) as fp: ++ multiarch_path_component = fp.readline().strip() ++ 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. diff --git a/plugins/python-build/patches/all/python32/patch-setup.py.diff b/plugins/python-build/patches/all/python32/patch-setup.py.diff new file mode 100644 index 00000000..f4c361e6 --- /dev/null +++ b/plugins/python-build/patches/all/python32/patch-setup.py.diff @@ -0,0 +1,38 @@ +--- setup.py.orig 2011-07-07 20:26:15.000000000 +0900 ++++ setup.py 2011-07-07 20:29:28.735543350 +0900 +@@ -370,12 +370,35 @@ + 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: ++ with open(tmpfile) as fp: ++ multiarch_path_component = fp.readline().strip() ++ 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, but the local build + # directories (i.e. '.' and 'Include') must be first. See issue + # 10520. + 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. diff --git a/plugins/python-build/share/python-build/2.6.6 b/plugins/python-build/share/python-build/2.6.6 index 9d0ee555..80fab439 100644 --- a/plugins/python-build/share/python-build/2.6.6 +++ b/plugins/python-build/share/python-build/2.6.6 @@ -2,8 +2,7 @@ before_install_package() { local package_name="$1" case "$package_name" in Python*) - http get "https://raw.github.com/saghul/pythonz/346450868902fed0fe654c472b7b58e2e31fde70/pythonz/patches/all/common/patch-setup.py.diff" setup.patch - patch -p0 < setup.patch + patch -p0 < "${PYTHON_BUILD_ROOT}/patches/all/common/patch-setup.py.diff" ;; esac } diff --git a/plugins/python-build/share/python-build/2.6.7 b/plugins/python-build/share/python-build/2.6.7 index 5dabc9ea..012e144e 100644 --- a/plugins/python-build/share/python-build/2.6.7 +++ b/plugins/python-build/share/python-build/2.6.7 @@ -2,8 +2,7 @@ before_install_package() { local package_name="$1" case "$package_name" in Python*) - http get "https://raw.github.com/saghul/pythonz/346450868902fed0fe654c472b7b58e2e31fde70/pythonz/patches/all/common/patch-setup.py.diff" setup.patch - patch -p0 < setup.patch + patch -p0 < "${PYTHON_BUILD_ROOT}/patches/all/common/patch-setup.py.diff" ;; esac } diff --git a/plugins/python-build/share/python-build/2.6.8 b/plugins/python-build/share/python-build/2.6.8 index 636926f9..c2b4f354 100644 --- a/plugins/python-build/share/python-build/2.6.8 +++ b/plugins/python-build/share/python-build/2.6.8 @@ -2,8 +2,7 @@ before_install_package() { local package_name="$1" case "$package_name" in Python*) - http get "https://raw.github.com/saghul/pythonz/346450868902fed0fe654c472b7b58e2e31fde70/pythonz/patches/all/common/patch-setup.py.diff" setup.patch - patch -p0 < setup.patch + patch -p0 < "${PYTHON_BUILD_ROOT}/patches/all/common/patch-setup.py.diff" ;; esac } diff --git a/plugins/python-build/share/python-build/2.7 b/plugins/python-build/share/python-build/2.7 index 42a42578..67453b52 100644 --- a/plugins/python-build/share/python-build/2.7 +++ b/plugins/python-build/share/python-build/2.7 @@ -2,8 +2,7 @@ before_install_package() { local package_name="$1" case "$package_name" in Python*) - http get "https://raw.github.com/saghul/pythonz/346450868902fed0fe654c472b7b58e2e31fde70/pythonz/patches/all/common/patch-setup.py.diff" setup.patch - patch -p0 < setup.patch + patch -p0 < "${PYTHON_BUILD_ROOT}/patches/all/common/patch-setup.py.diff" ;; esac } diff --git a/plugins/python-build/share/python-build/2.7.1 b/plugins/python-build/share/python-build/2.7.1 index fe0746e3..79e6452d 100644 --- a/plugins/python-build/share/python-build/2.7.1 +++ b/plugins/python-build/share/python-build/2.7.1 @@ -2,8 +2,7 @@ before_install_package() { local package_name="$1" case "$package_name" in Python*) - http get "https://raw.github.com/saghul/pythonz/346450868902fed0fe654c472b7b58e2e31fde70/pythonz/patches/all/common/patch-setup.py.diff" setup.patch - patch -p0 < setup.patch + patch -p0 < "${PYTHON_BUILD_ROOT}/patches/all/common/patch-setup.py.diff" ;; esac } diff --git a/plugins/python-build/share/python-build/3.0.1 b/plugins/python-build/share/python-build/3.0.1 index a84a24a2..8531fa89 100644 --- a/plugins/python-build/share/python-build/3.0.1 +++ b/plugins/python-build/share/python-build/3.0.1 @@ -2,8 +2,7 @@ before_install_package() { local package_name="$1" case "$package_name" in Python*) - http get "https://raw.github.com/saghul/pythonz/346450868902fed0fe654c472b7b58e2e31fde70/pythonz/patches/all/python30/patch-setup.py.diff" setup.patch - patch -p0 < setup.patch + patch -p0 < "${PYTHON_BUILD_ROOT}/patches/all/python30/patch-setup.py.diff" ;; esac } diff --git a/plugins/python-build/share/python-build/3.1.3 b/plugins/python-build/share/python-build/3.1.3 index e4a182f6..77141287 100644 --- a/plugins/python-build/share/python-build/3.1.3 +++ b/plugins/python-build/share/python-build/3.1.3 @@ -2,8 +2,7 @@ before_install_package() { local package_name="$1" case "$package_name" in Python*) - http get "https://raw.github.com/saghul/pythonz/346450868902fed0fe654c472b7b58e2e31fde70/pythonz/patches/all/common/patch-setup.py.diff" setup.patch - patch -p0 < setup.patch + patch -p0 < "${PYTHON_BUILD_ROOT}/patches/all/common/patch-setup.py.diff" ;; esac } diff --git a/plugins/python-build/share/python-build/3.2 b/plugins/python-build/share/python-build/3.2 index f8072b88..3c03ecbe 100644 --- a/plugins/python-build/share/python-build/3.2 +++ b/plugins/python-build/share/python-build/3.2 @@ -2,8 +2,7 @@ before_install_package() { local package_name="$1" case "$package_name" in Python*) - http get "https://raw.github.com/saghul/pythonz/346450868902fed0fe654c472b7b58e2e31fde70/pythonz/patches/all/python32/patch-setup.py.diff" setup.patch - patch -p0 < setup.patch + patch -p0 < "${PYTHON_BUILD_ROOT}/patches/all/python32/patch-setup.py.diff" ;; esac } From cc20ab33921b319ecec6614e117aed7bdda8603e Mon Sep 17 00:00:00 2001 From: Yamashita Yuu Date: Wed, 8 May 2013 18:35:30 +0900 Subject: [PATCH 2/3] find appropriate patch for package automatically --- plugins/python-build/bin/python-build | 14 +++++- .../Python-2.6.6/000_patch-setup.py.diff | 47 +++++++++++++++++++ .../Python-2.6.7/000_patch-setup.py.diff | 47 +++++++++++++++++++ .../Python-2.6.8/000_patch-setup.py.diff | 47 +++++++++++++++++++ .../Python-2.7.1/000_patch-setup.py.diff | 47 +++++++++++++++++++ .../2.7/Python-2.7/000_patch-setup.py.diff | 47 +++++++++++++++++++ .../Python-3.0.1/000_patch-setup.py.diff | 44 +++++++++++++++++ .../Python-3.1.3/000_patch-setup.py.diff | 47 +++++++++++++++++++ .../3.2/Python-3.2/000_patch-setup.py.diff | 38 +++++++++++++++ plugins/python-build/share/python-build/2.6.6 | 9 ---- plugins/python-build/share/python-build/2.6.7 | 9 ---- plugins/python-build/share/python-build/2.6.8 | 9 ---- plugins/python-build/share/python-build/2.7 | 9 ---- plugins/python-build/share/python-build/2.7.1 | 9 ---- plugins/python-build/share/python-build/3.0.1 | 9 ---- plugins/python-build/share/python-build/3.1.3 | 9 ---- plugins/python-build/share/python-build/3.2 | 9 ---- 17 files changed, 377 insertions(+), 73 deletions(-) create mode 100644 plugins/python-build/patches/2.6.6/Python-2.6.6/000_patch-setup.py.diff create mode 100644 plugins/python-build/patches/2.6.7/Python-2.6.7/000_patch-setup.py.diff create mode 100644 plugins/python-build/patches/2.6.8/Python-2.6.8/000_patch-setup.py.diff create mode 100644 plugins/python-build/patches/2.7.1/Python-2.7.1/000_patch-setup.py.diff create mode 100644 plugins/python-build/patches/2.7/Python-2.7/000_patch-setup.py.diff create mode 100644 plugins/python-build/patches/3.0.1/Python-3.0.1/000_patch-setup.py.diff create mode 100644 plugins/python-build/patches/3.1.3/Python-3.1.3/000_patch-setup.py.diff create mode 100644 plugins/python-build/patches/3.2/Python-3.2/000_patch-setup.py.diff diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index 22088f00..cf25b66d 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -137,12 +137,24 @@ install_package_using() { } >&2 } +apply_patches() { + local package_name="$1" + local patches_path="${PYTHON_BUILD_ROOT}/patches/${DEFINITION_PATH##*/}/${package_name}" + for patch in "${patches_path}"/*; do + if [ -f "$patch" ]; then + echo "Applying ${patch##*/} to ${package_name}..." >&2 + patch -p0 < "$patch" + fi + done +} + make_package() { local package_name="$1" shift pushd "$package_name" >&4 before_install_package "$package_name" + apply_patches "$package_name" build_package "$package_name" $* after_install_package "$package_name" fix_directory_permissions @@ -371,7 +383,7 @@ build_package() { done if [ ! -f "$PYTHON_BIN" ]; then - for python in ${PREFIX_PATH}/bin/python*; do + for python in "${PREFIX_PATH}"/bin/python*; do if basename "$python" | grep '^python[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; then { cd ${PREFIX_PATH}/bin diff --git a/plugins/python-build/patches/2.6.6/Python-2.6.6/000_patch-setup.py.diff b/plugins/python-build/patches/2.6.6/Python-2.6.6/000_patch-setup.py.diff new file mode 100644 index 00000000..b2998bca --- /dev/null +++ b/plugins/python-build/patches/2.6.6/Python-2.6.6/000_patch-setup.py.diff @@ -0,0 +1,47 @@ + +# HG changeset patch +# User Barry Warsaw +# Date 1302190091 14400 +# Node ID bd0f73a9538e05f526feaf05821e68bdcff498fa +# Parent 2e4cdaffe493e879fb5367a4aa454491de451137 +Backport for Python 2.7 of issue 11715 support for building Python on +multiarch Debian/Ubuntu. + +diff --git a/setup.py b/setup.py +--- setup.py.orig ++++ setup.py +@@ -345,10 +345,33 @@ class PyBuildExt(build_ext): + 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: ++ with open(tmpfile) as fp: ++ multiarch_path_component = fp.readline().strip() ++ 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. + diff --git a/plugins/python-build/patches/2.6.7/Python-2.6.7/000_patch-setup.py.diff b/plugins/python-build/patches/2.6.7/Python-2.6.7/000_patch-setup.py.diff new file mode 100644 index 00000000..b2998bca --- /dev/null +++ b/plugins/python-build/patches/2.6.7/Python-2.6.7/000_patch-setup.py.diff @@ -0,0 +1,47 @@ + +# HG changeset patch +# User Barry Warsaw +# Date 1302190091 14400 +# Node ID bd0f73a9538e05f526feaf05821e68bdcff498fa +# Parent 2e4cdaffe493e879fb5367a4aa454491de451137 +Backport for Python 2.7 of issue 11715 support for building Python on +multiarch Debian/Ubuntu. + +diff --git a/setup.py b/setup.py +--- setup.py.orig ++++ setup.py +@@ -345,10 +345,33 @@ class PyBuildExt(build_ext): + 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: ++ with open(tmpfile) as fp: ++ multiarch_path_component = fp.readline().strip() ++ 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. + diff --git a/plugins/python-build/patches/2.6.8/Python-2.6.8/000_patch-setup.py.diff b/plugins/python-build/patches/2.6.8/Python-2.6.8/000_patch-setup.py.diff new file mode 100644 index 00000000..b2998bca --- /dev/null +++ b/plugins/python-build/patches/2.6.8/Python-2.6.8/000_patch-setup.py.diff @@ -0,0 +1,47 @@ + +# HG changeset patch +# User Barry Warsaw +# Date 1302190091 14400 +# Node ID bd0f73a9538e05f526feaf05821e68bdcff498fa +# Parent 2e4cdaffe493e879fb5367a4aa454491de451137 +Backport for Python 2.7 of issue 11715 support for building Python on +multiarch Debian/Ubuntu. + +diff --git a/setup.py b/setup.py +--- setup.py.orig ++++ setup.py +@@ -345,10 +345,33 @@ class PyBuildExt(build_ext): + 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: ++ with open(tmpfile) as fp: ++ multiarch_path_component = fp.readline().strip() ++ 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. + diff --git a/plugins/python-build/patches/2.7.1/Python-2.7.1/000_patch-setup.py.diff b/plugins/python-build/patches/2.7.1/Python-2.7.1/000_patch-setup.py.diff new file mode 100644 index 00000000..b2998bca --- /dev/null +++ b/plugins/python-build/patches/2.7.1/Python-2.7.1/000_patch-setup.py.diff @@ -0,0 +1,47 @@ + +# HG changeset patch +# User Barry Warsaw +# Date 1302190091 14400 +# Node ID bd0f73a9538e05f526feaf05821e68bdcff498fa +# Parent 2e4cdaffe493e879fb5367a4aa454491de451137 +Backport for Python 2.7 of issue 11715 support for building Python on +multiarch Debian/Ubuntu. + +diff --git a/setup.py b/setup.py +--- setup.py.orig ++++ setup.py +@@ -345,10 +345,33 @@ class PyBuildExt(build_ext): + 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: ++ with open(tmpfile) as fp: ++ multiarch_path_component = fp.readline().strip() ++ 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. + diff --git a/plugins/python-build/patches/2.7/Python-2.7/000_patch-setup.py.diff b/plugins/python-build/patches/2.7/Python-2.7/000_patch-setup.py.diff new file mode 100644 index 00000000..b2998bca --- /dev/null +++ b/plugins/python-build/patches/2.7/Python-2.7/000_patch-setup.py.diff @@ -0,0 +1,47 @@ + +# HG changeset patch +# User Barry Warsaw +# Date 1302190091 14400 +# Node ID bd0f73a9538e05f526feaf05821e68bdcff498fa +# Parent 2e4cdaffe493e879fb5367a4aa454491de451137 +Backport for Python 2.7 of issue 11715 support for building Python on +multiarch Debian/Ubuntu. + +diff --git a/setup.py b/setup.py +--- setup.py.orig ++++ setup.py +@@ -345,10 +345,33 @@ class PyBuildExt(build_ext): + 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: ++ with open(tmpfile) as fp: ++ multiarch_path_component = fp.readline().strip() ++ 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. + diff --git a/plugins/python-build/patches/3.0.1/Python-3.0.1/000_patch-setup.py.diff b/plugins/python-build/patches/3.0.1/Python-3.0.1/000_patch-setup.py.diff new file mode 100644 index 00000000..8f1a1773 --- /dev/null +++ b/plugins/python-build/patches/3.0.1/Python-3.0.1/000_patch-setup.py.diff @@ -0,0 +1,44 @@ +--- setup.py.orig 2011-07-07 19:41:48.610196111 +0900 ++++ setup.py 2011-07-07 19:46:44.986310031 +0900 +@@ -14,6 +14,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 = [] +@@ -308,10 +309,33 @@ + 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: ++ with open(tmpfile) as fp: ++ multiarch_path_component = fp.readline().strip() ++ 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. diff --git a/plugins/python-build/patches/3.1.3/Python-3.1.3/000_patch-setup.py.diff b/plugins/python-build/patches/3.1.3/Python-3.1.3/000_patch-setup.py.diff new file mode 100644 index 00000000..b2998bca --- /dev/null +++ b/plugins/python-build/patches/3.1.3/Python-3.1.3/000_patch-setup.py.diff @@ -0,0 +1,47 @@ + +# HG changeset patch +# User Barry Warsaw +# Date 1302190091 14400 +# Node ID bd0f73a9538e05f526feaf05821e68bdcff498fa +# Parent 2e4cdaffe493e879fb5367a4aa454491de451137 +Backport for Python 2.7 of issue 11715 support for building Python on +multiarch Debian/Ubuntu. + +diff --git a/setup.py b/setup.py +--- setup.py.orig ++++ setup.py +@@ -345,10 +345,33 @@ class PyBuildExt(build_ext): + 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: ++ with open(tmpfile) as fp: ++ multiarch_path_component = fp.readline().strip() ++ 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. + diff --git a/plugins/python-build/patches/3.2/Python-3.2/000_patch-setup.py.diff b/plugins/python-build/patches/3.2/Python-3.2/000_patch-setup.py.diff new file mode 100644 index 00000000..f4c361e6 --- /dev/null +++ b/plugins/python-build/patches/3.2/Python-3.2/000_patch-setup.py.diff @@ -0,0 +1,38 @@ +--- setup.py.orig 2011-07-07 20:26:15.000000000 +0900 ++++ setup.py 2011-07-07 20:29:28.735543350 +0900 +@@ -370,12 +370,35 @@ + 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: ++ with open(tmpfile) as fp: ++ multiarch_path_component = fp.readline().strip() ++ 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, but the local build + # directories (i.e. '.' and 'Include') must be first. See issue + # 10520. + 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. diff --git a/plugins/python-build/share/python-build/2.6.6 b/plugins/python-build/share/python-build/2.6.6 index 80fab439..7f9f5c9a 100644 --- a/plugins/python-build/share/python-build/2.6.6 +++ b/plugins/python-build/share/python-build/2.6.6 @@ -1,12 +1,3 @@ -before_install_package() { - local package_name="$1" - case "$package_name" in - Python*) - patch -p0 < "${PYTHON_BUILD_ROOT}/patches/all/common/patch-setup.py.diff" - ;; - esac -} - install_package "Python-2.6.6" "http://www.python.org/ftp/python/2.6.6/Python-2.6.6.tgz#b2f209df270a33315e62c1ffac1937f0" install_package "distribute-0.6.36" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.36.tar.gz#a923385de72dcdca68cd4ac2b9dc1148" python install_package "pip-1.3.1" "http://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz#cbb27a191cebc58997c4da8513863153" python diff --git a/plugins/python-build/share/python-build/2.6.7 b/plugins/python-build/share/python-build/2.6.7 index 012e144e..9c799dd5 100644 --- a/plugins/python-build/share/python-build/2.6.7 +++ b/plugins/python-build/share/python-build/2.6.7 @@ -1,12 +1,3 @@ -before_install_package() { - local package_name="$1" - case "$package_name" in - Python*) - patch -p0 < "${PYTHON_BUILD_ROOT}/patches/all/common/patch-setup.py.diff" - ;; - esac -} - install_package "Python-2.6.7" "http://www.python.org/ftp/python/2.6.7/Python-2.6.7.tgz#af474f85a3af69ea50438a2a48039d7d" install_package "distribute-0.6.36" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.36.tar.gz#a923385de72dcdca68cd4ac2b9dc1148" python install_package "pip-1.3.1" "http://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz#cbb27a191cebc58997c4da8513863153" python diff --git a/plugins/python-build/share/python-build/2.6.8 b/plugins/python-build/share/python-build/2.6.8 index c2b4f354..530b07db 100644 --- a/plugins/python-build/share/python-build/2.6.8 +++ b/plugins/python-build/share/python-build/2.6.8 @@ -1,12 +1,3 @@ -before_install_package() { - local package_name="$1" - case "$package_name" in - Python*) - patch -p0 < "${PYTHON_BUILD_ROOT}/patches/all/common/patch-setup.py.diff" - ;; - esac -} - install_package "Python-2.6.8" "http://www.python.org/ftp/python/2.6.8/Python-2.6.8.tgz#f6c1781f5d73ab7dfa5181f43ea065f6" install_package "distribute-0.6.36" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.36.tar.gz#a923385de72dcdca68cd4ac2b9dc1148" python install_package "pip-1.3.1" "http://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz#cbb27a191cebc58997c4da8513863153" python diff --git a/plugins/python-build/share/python-build/2.7 b/plugins/python-build/share/python-build/2.7 index 67453b52..151ae47d 100644 --- a/plugins/python-build/share/python-build/2.7 +++ b/plugins/python-build/share/python-build/2.7 @@ -1,12 +1,3 @@ -before_install_package() { - local package_name="$1" - case "$package_name" in - Python*) - patch -p0 < "${PYTHON_BUILD_ROOT}/patches/all/common/patch-setup.py.diff" - ;; - esac -} - install_package "Python-2.7" "http://www.python.org/ftp/python/2.7/Python-2.7.tgz#35f56b092ecf39a6bd59d64f142aae0f" install_package "distribute-0.6.36" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.36.tar.gz#a923385de72dcdca68cd4ac2b9dc1148" python install_package "pip-1.3.1" "http://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz#cbb27a191cebc58997c4da8513863153" python diff --git a/plugins/python-build/share/python-build/2.7.1 b/plugins/python-build/share/python-build/2.7.1 index 79e6452d..dc29d223 100644 --- a/plugins/python-build/share/python-build/2.7.1 +++ b/plugins/python-build/share/python-build/2.7.1 @@ -1,12 +1,3 @@ -before_install_package() { - local package_name="$1" - case "$package_name" in - Python*) - patch -p0 < "${PYTHON_BUILD_ROOT}/patches/all/common/patch-setup.py.diff" - ;; - esac -} - install_package "Python-2.7.1" "http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tgz#15ed56733655e3fab785e49a7278d2fb" install_package "distribute-0.6.36" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.36.tar.gz#a923385de72dcdca68cd4ac2b9dc1148" python install_package "pip-1.3.1" "http://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz#cbb27a191cebc58997c4da8513863153" python diff --git a/plugins/python-build/share/python-build/3.0.1 b/plugins/python-build/share/python-build/3.0.1 index 8531fa89..3bb42f78 100644 --- a/plugins/python-build/share/python-build/3.0.1 +++ b/plugins/python-build/share/python-build/3.0.1 @@ -1,12 +1,3 @@ -before_install_package() { - local package_name="$1" - case "$package_name" in - Python*) - patch -p0 < "${PYTHON_BUILD_ROOT}/patches/all/python30/patch-setup.py.diff" - ;; - esac -} - install_package "Python-3.0.1" "http://www.python.org/ftp/python/3.0.1/Python-3.0.1.tgz#220b73f0a1a20c4b1cdf9f9db4cd52fe" install_package "distribute-0.6.36" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.36.tar.gz#a923385de72dcdca68cd4ac2b9dc1148" python install_package "pip-1.3.1" "http://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz#cbb27a191cebc58997c4da8513863153" python diff --git a/plugins/python-build/share/python-build/3.1.3 b/plugins/python-build/share/python-build/3.1.3 index 77141287..4a1c5d6a 100644 --- a/plugins/python-build/share/python-build/3.1.3 +++ b/plugins/python-build/share/python-build/3.1.3 @@ -1,12 +1,3 @@ -before_install_package() { - local package_name="$1" - case "$package_name" in - Python*) - patch -p0 < "${PYTHON_BUILD_ROOT}/patches/all/common/patch-setup.py.diff" - ;; - esac -} - install_package "Python-3.1.3" "http://www.python.org/ftp/python/3.1.3/Python-3.1.3.tgz#d797fa6abe82c21227e328f05a535424" install_package "distribute-0.6.36" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.36.tar.gz#a923385de72dcdca68cd4ac2b9dc1148" python install_package "pip-1.3.1" "http://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz#cbb27a191cebc58997c4da8513863153" python diff --git a/plugins/python-build/share/python-build/3.2 b/plugins/python-build/share/python-build/3.2 index 3c03ecbe..4fbfe90c 100644 --- a/plugins/python-build/share/python-build/3.2 +++ b/plugins/python-build/share/python-build/3.2 @@ -1,12 +1,3 @@ -before_install_package() { - local package_name="$1" - case "$package_name" in - Python*) - patch -p0 < "${PYTHON_BUILD_ROOT}/patches/all/python32/patch-setup.py.diff" - ;; - esac -} - install_package "Python-3.2" "http://www.python.org/ftp/python/3.2/Python-3.2.tgz#5efe838a7878b170f6728d7e5d7517af" install_package "distribute-0.6.36" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.36.tar.gz#a923385de72dcdca68cd4ac2b9dc1148" python install_package "pip-1.3.1" "http://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz#cbb27a191cebc58997c4da8513863153" python From 95882fce6835486fdbad904992ecc1a7b6524cd0 Mon Sep 17 00:00:00 2001 From: Yamashita Yuu Date: Wed, 8 May 2013 18:38:34 +0900 Subject: [PATCH 3/3] remove useless patches --- .../patches/all/common/patch-setup.py.diff | 47 ------------------- .../patches/all/python30/patch-setup.py.diff | 44 ----------------- .../patches/all/python32/patch-setup.py.diff | 38 --------------- 3 files changed, 129 deletions(-) delete mode 100644 plugins/python-build/patches/all/common/patch-setup.py.diff delete mode 100644 plugins/python-build/patches/all/python30/patch-setup.py.diff delete mode 100644 plugins/python-build/patches/all/python32/patch-setup.py.diff diff --git a/plugins/python-build/patches/all/common/patch-setup.py.diff b/plugins/python-build/patches/all/common/patch-setup.py.diff deleted file mode 100644 index b2998bca..00000000 --- a/plugins/python-build/patches/all/common/patch-setup.py.diff +++ /dev/null @@ -1,47 +0,0 @@ - -# HG changeset patch -# User Barry Warsaw -# Date 1302190091 14400 -# Node ID bd0f73a9538e05f526feaf05821e68bdcff498fa -# Parent 2e4cdaffe493e879fb5367a4aa454491de451137 -Backport for Python 2.7 of issue 11715 support for building Python on -multiarch Debian/Ubuntu. - -diff --git a/setup.py b/setup.py ---- setup.py.orig -+++ setup.py -@@ -345,10 +345,33 @@ class PyBuildExt(build_ext): - 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: -+ with open(tmpfile) as fp: -+ multiarch_path_component = fp.readline().strip() -+ 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. - diff --git a/plugins/python-build/patches/all/python30/patch-setup.py.diff b/plugins/python-build/patches/all/python30/patch-setup.py.diff deleted file mode 100644 index 8f1a1773..00000000 --- a/plugins/python-build/patches/all/python30/patch-setup.py.diff +++ /dev/null @@ -1,44 +0,0 @@ ---- setup.py.orig 2011-07-07 19:41:48.610196111 +0900 -+++ setup.py 2011-07-07 19:46:44.986310031 +0900 -@@ -14,6 +14,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 = [] -@@ -308,10 +309,33 @@ - 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: -+ with open(tmpfile) as fp: -+ multiarch_path_component = fp.readline().strip() -+ 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. diff --git a/plugins/python-build/patches/all/python32/patch-setup.py.diff b/plugins/python-build/patches/all/python32/patch-setup.py.diff deleted file mode 100644 index f4c361e6..00000000 --- a/plugins/python-build/patches/all/python32/patch-setup.py.diff +++ /dev/null @@ -1,38 +0,0 @@ ---- setup.py.orig 2011-07-07 20:26:15.000000000 +0900 -+++ setup.py 2011-07-07 20:29:28.735543350 +0900 -@@ -370,12 +370,35 @@ - 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: -+ with open(tmpfile) as fp: -+ multiarch_path_component = fp.readline().strip() -+ 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, but the local build - # directories (i.e. '.' and 'Include') must be first. See issue - # 10520. - 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.