Changeset View
Changeset View
Standalone View
Standalone View
head/lang/python27/files/patch-setup.py
# Description: Partial script installation backport from Python3 | # Description: Partial script installation backport from Python3 | ||||
# Submitted by: mva | # Submitted by: mva | ||||
# Description: Some modules are installed via other ports | # Description: Some modules are installed via other ports | ||||
# Description: ossaudiodev detection fix backport | # Description: ossaudiodev detection fix backport | ||||
--- setup.py.orig 2014-06-30 04:05:48.000000000 +0200 | --- setup.py.orig 2017-04-22 03:42:03 UTC | ||||
+++ setup.py 2014-07-26 14:51:29.000000000 +0200 | +++ setup.py | ||||
@@ -15,6 +15,7 @@ from distutils.core import Extension, se | @@ -15,6 +15,7 @@ from distutils.core import Extension, se | ||||
from distutils.command.build_ext import build_ext | from distutils.command.build_ext import build_ext | ||||
from distutils.command.install import install | from distutils.command.install import install | ||||
from distutils.command.install_lib import install_lib | from distutils.command.install_lib import install_lib | ||||
+from distutils.command.build_scripts import build_scripts | +from distutils.command.build_scripts import build_scripts | ||||
from distutils.spawn import find_executable | from distutils.spawn import find_executable | ||||
cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ | cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ | ||||
@@ -33,7 +34,7 @@ host_platform = get_platform() | @@ -33,7 +34,7 @@ host_platform = get_platform() | ||||
COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS")) | COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS")) | ||||
# This global variable is used to hold the list of modules to be disabled. | # This global variable is used to hold the list of modules to be disabled. | ||||
-disabled_module_list = [] | -disabled_module_list = [] | ||||
+disabled_module_list = ["_bsddb", "_sqlite3", "_tkinter", "gdbm", "mpz"] | +disabled_module_list = ["_bsddb", "_sqlite3", "_tkinter", "gdbm", "mpz"] | ||||
def add_dir_to_list(dirlist, dir): | def add_dir_to_list(dirlist, dir): | ||||
"""Add the directory 'dir' to the list 'dirlist' (at the front) if | """Add the directory 'dir' to the list 'dirlist' (at the front) if | ||||
@@ -1214,7 +1215,7 @@ class PyBuildExt(build_ext): | @@ -1234,7 +1235,7 @@ class PyBuildExt(build_ext): | ||||
sysroot = macosx_sdk_root() | sysroot = macosx_sdk_root() | ||||
f = os.path.join(sysroot, f[1:]) | f = os.path.join(sysroot, f[1:]) | ||||
- if os.path.exists(f) and not db_incs: | - if os.path.exists(f) and not db_incs: | ||||
+ if os.path.exists(f): | + if os.path.exists(f): | ||||
data = open(f).read() | data = open(f).read() | ||||
m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data) | m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data) | ||||
if m is not None: | if m is not None: | ||||
@@ -1553,7 +1554,7 @@ class PyBuildExt(build_ext): | @@ -1624,9 +1625,10 @@ class PyBuildExt(build_ext): | ||||
macros = dict() | |||||
libraries = [] | |||||
- elif host_platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'): | |||||
+ elif host_platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8', 'freebsd9', 'freebsd10', 'freebsd11'): | |||||
# FreeBSD's P1003.1b semaphore support is very experimental | |||||
# and has many known problems. (as of June 2008) | |||||
macros = dict() | |||||
@@ -1604,9 +1605,10 @@ class PyBuildExt(build_ext): | |||||
else: | else: | ||||
missing.append('linuxaudiodev') | missing.append('linuxaudiodev') | ||||
- if (host_platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6', | - if (host_platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6', | ||||
- 'freebsd7', 'freebsd8') | - 'freebsd7', 'freebsd8') | ||||
- or host_platform.startswith("gnukfreebsd")): | - or host_platform.startswith("gnukfreebsd")): | ||||
+# Initial backport of http://hg.python.org/cpython/rev/50f1922bc1d5 | +# Initial backport of http://hg.python.org/cpython/rev/50f1922bc1d5 | ||||
+ | + | ||||
+ if any(sys.platform.startswith(prefix) | + if any(sys.platform.startswith(prefix) | ||||
+ for prefix in ("linux", "freebsd", "gnukfreebsd")): | + for prefix in ("linux", "freebsd", "gnukfreebsd")): | ||||
exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) ) | exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) ) | ||||
else: | else: | ||||
missing.append('ossaudiodev') | missing.append('ossaudiodev') | ||||
@@ -2178,6 +2180,22 @@ class PyBuildInstallLib(install_lib): | @@ -2200,6 +2202,22 @@ class PyBuildInstallLib(install_lib): | ||||
def is_chmod_supported(self): | def is_chmod_supported(self): | ||||
return hasattr(os, 'chmod') | return hasattr(os, 'chmod') | ||||
+class PyBuildScripts(build_scripts): | +class PyBuildScripts(build_scripts): | ||||
+ def copy_scripts(self): | + def copy_scripts(self): | ||||
+ outfiles = build_scripts.copy_scripts(self) | + outfiles = build_scripts.copy_scripts(self) | ||||
+ fullversion = '{0[0]}.{0[1]}'.format(sys.version_info) | + fullversion = '{0[0]}.{0[1]}'.format(sys.version_info) | ||||
+ newoutfiles = [] | + newoutfiles = [] | ||||
+ for filename in outfiles: | + for filename in outfiles: | ||||
+ if filename.endswith('2to3'): | + if filename.endswith('2to3'): | ||||
+ newfilename = filename + '-' + fullversion | + newfilename = filename + '-' + fullversion | ||||
+ else: | + else: | ||||
+ newfilename = filename + fullversion | + newfilename = filename + fullversion | ||||
+ log.info('renaming {} to {}'.format(filename, newfilename)) | + log.info('renaming {} to {}'.format(filename, newfilename)) | ||||
+ os.rename(filename, newfilename) | + os.rename(filename, newfilename) | ||||
+ newoutfiles.append(newfilename) | + newoutfiles.append(newfilename) | ||||
+ return newoutfiles | + return newoutfiles | ||||
+ | + | ||||
+ | + | ||||
SUMMARY = """ | SUMMARY = """ | ||||
Python is an interpreted, interactive, object-oriented programming | Python is an interpreted, interactive, object-oriented programming | ||||
language. It is often compared to Tcl, Perl, Scheme or Java. | language. It is often compared to Tcl, Perl, Scheme or Java. | ||||
@@ -2223,7 +2241,9 @@ def main(): | @@ -2245,7 +2263,9 @@ def main(): | ||||
platforms = ["Many"], | platforms = ["Many"], | ||||
# Build info | # Build info | ||||
- cmdclass = {'build_ext':PyBuildExt, 'install':PyBuildInstall, | - cmdclass = {'build_ext':PyBuildExt, 'install':PyBuildInstall, | ||||
+ cmdclass = {'build_ext':PyBuildExt, | + cmdclass = {'build_ext':PyBuildExt, | ||||
+ 'build_scripts':PyBuildScripts, | + 'build_scripts':PyBuildScripts, | ||||
+ 'install':PyBuildInstall, | + 'install':PyBuildInstall, | ||||
'install_lib':PyBuildInstallLib}, | 'install_lib':PyBuildInstallLib}, | ||||
# The struct module is defined here, because build_ext won't be | # The struct module is defined here, because build_ext won't be | ||||
# called unless there's at least one extension module defined. | # called unless there's at least one extension module defined. | ||||
@@ -2231,8 +2251,7 @@ def main(): | @@ -2253,8 +2273,7 @@ def main(): | ||||
# Scripts to install | # Scripts to install | ||||
scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle', | scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle', | ||||
- 'Tools/scripts/2to3', | - 'Tools/scripts/2to3', | ||||
- 'Lib/smtpd.py'] | - 'Lib/smtpd.py'] | ||||
+ 'Tools/scripts/2to3'] | + 'Tools/scripts/2to3'] | ||||
) | ) | ||||
# --install-platlib | # --install-platlib |