summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorJames McCoy <jamessan@debian.org>2020-04-10 08:28:37 -0400
committerJames McCoy <jamessan@debian.org>2020-04-10 08:28:37 -0400
commitf04f369300121ce8d8e66eb5aaeb2926e02880e4 (patch)
tree2020cc3a965e09afeae1348ece5300705716728e /build
parentff0dcb36b05eb662b51423774a4502bc04378f69 (diff)
New upstream version 1.14.0~rc2
Diffstat (limited to 'build')
-rw-r--r--build/ac-macros/py3c.m4105
-rw-r--r--build/ac-macros/swig.m498
-rw-r--r--build/ac-macros/utf8proc.m42
-rw-r--r--build/generator/gen_base.py3
-rw-r--r--build/generator/gen_make.py5
-rw-r--r--build/generator/gen_vcnet_vcproj.py5
-rw-r--r--build/generator/gen_win.py13
-rw-r--r--build/generator/gen_win_dependencies.py65
-rw-r--r--build/generator/swig/__init__.py4
-rwxr-xr-xbuild/generator/swig/header_wrappers.py8
-rw-r--r--build/generator/templates/build-outputs.mk.ezt12
-rw-r--r--build/generator/templates/vcnet_vcproj.ezt3
-rw-r--r--build/generator/templates/vcnet_vcxproj.ezt6
-rw-r--r--build/generator/templates/vcnet_vsprops.ezt31
-rw-r--r--build/get-py-info.py14
-rwxr-xr-xbuild/run_tests.py24
16 files changed, 348 insertions, 50 deletions
diff --git a/build/ac-macros/py3c.m4 b/build/ac-macros/py3c.m4
new file mode 100644
index 0000000..f358cae
--- /dev/null
+++ b/build/ac-macros/py3c.m4
@@ -0,0 +1,105 @@
+dnl ===================================================================
+dnl Licensed to the Apache Software Foundation (ASF) under one
+dnl or more contributor license agreements. See the NOTICE file
+dnl distributed with this work for additional information
+dnl regarding copyright ownership. The ASF licenses this file
+dnl to you under the Apache License, Version 2.0 (the
+dnl "License"); you may not use this file except in compliance
+dnl with the License. You may obtain a copy of the License at
+dnl
+dnl http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl Unless required by applicable law or agreed to in writing,
+dnl software distributed under the License is distributed on an
+dnl "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+dnl KIND, either express or implied. See the License for the
+dnl specific language governing permissions and limitations
+dnl under the License.
+dnl ===================================================================
+dnl
+dnl SVN_PY3C
+dnl
+dnl Check configure options and assign variables related to
+dnl the py3c library.
+dnl
+dnl If configuring via prefix, the ac_cv_python_includes variable needs
+dnl to be set to the appropriate include configuration to build against
+dnl the correct Python C interface.
+dnl
+
+AC_DEFUN(SVN_PY3C,
+[
+ py3c_found=no
+ py3c_skip=no
+
+ AC_ARG_WITH(py3c,AS_HELP_STRING([--with-py3c=PREFIX],
+ [py3c python extension compatibility library]),
+ [
+ if test "$withval" = "yes"; then
+ py3c_skip=no
+ elif test "$withval" = "no"; then
+ py3c_skip=yes
+ else
+ py3c_skip=no
+ py3c_prefix="$withval"
+ fi
+ ])
+
+ if test "$py3c_skip" = "yes"; then
+ AC_MSG_NOTICE([Skipping configure of py3c])
+ else
+ if test -n "$py3c_prefix"; then
+ AC_MSG_NOTICE([py3c library configuration via prefix $py3c_prefix])
+
+ dnl The standard Python headers are required to validate py3c.h
+ if test "$ac_cv_python_includes" = "none"; then
+ AC_MSG_WARN([py3c cannot be used without distutils module])
+ fi
+
+ save_cppflags="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $ac_cv_python_includes -I$py3c_prefix/include"
+ AC_CHECK_HEADERS(py3c.h,[
+ py3c_found="yes"
+ SVN_PY3C_INCLUDES="-I$py3c_prefix/include"
+ ])
+ CPPFLAGS="$save_cppflags"
+ else
+ SVN_PY3C_PKG_CONFIG()
+
+ if test "$py3c_found" = "no"; then
+ AC_MSG_NOTICE([py3c library configuration without pkg-config])
+
+ dnl The standard Python headers are required to validate py3c.h
+ if test "$ac_cv_python_includes" = "none"; then
+ AC_MSG_WARN([py3c cannot be used without distutils module])
+ fi
+
+ save_cppflags="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $ac_cv_python_includes"
+ AC_CHECK_HEADER(py3c.h, [
+ py3c_found="yes"
+ ])
+ CPPFLAGS="$save_cppflags"
+ fi
+ fi
+ fi
+
+ AC_SUBST(SVN_PY3C_INCLUDES)
+])
+
+dnl SVN_PY3C_PKG_CONFIG()
+dnl Use pkg-config to try and detect and configure py3c
+AC_DEFUN(SVN_PY3C_PKG_CONFIG,
+[
+ AC_MSG_NOTICE([py3c library configuration via pkg-config])
+ if test -n "$PKG_CONFIG"; then
+ AC_MSG_CHECKING([for py3c library])
+ if $PKG_CONFIG py3c --exists; then
+ AC_MSG_RESULT([yes])
+ py3c_found=yes
+ SVN_PY3C_INCLUDES=`$PKG_CONFIG py3c --cflags`
+ else
+ AC_MSG_RESULT([no])
+ fi
+ fi
+])
diff --git a/build/ac-macros/swig.m4 b/build/ac-macros/swig.m4
index 2963872..c707a8c 100644
--- a/build/ac-macros/swig.m4
+++ b/build/ac-macros/swig.m4
@@ -102,6 +102,8 @@ AC_DEFUN(SVN_FIND_SWIG,
SWIG_PY_COMPILE="none"
SWIG_PY_LINK="none"
+ SWIG_PY_OPTS="none"
+ SWIG_PY_ERRMSG="check config.log for details"
if test "$PYTHON" != "none"; then
AC_MSG_NOTICE([Configuring python swig binding])
@@ -111,25 +113,82 @@ AC_DEFUN(SVN_FIND_SWIG,
SWIG_PY_INCLUDES="\$(SWIG_INCLUDES) $ac_cv_python_includes"
if test "$ac_cv_python_includes" = "none"; then
+ SWIG_PY_ERRMSG="no distutils found"
AC_MSG_WARN([python bindings cannot be built without distutils module])
- fi
+ else
- AC_CACHE_CHECK([for compiling Python extensions], [ac_cv_python_compile],[
- ac_cv_python_compile="`$PYTHON ${abs_srcdir}/build/get-py-info.py --compile`"
- ])
- SWIG_PY_COMPILE="$ac_cv_python_compile $CFLAGS"
+ python_header_found="no"
- AC_CACHE_CHECK([for linking Python extensions], [ac_cv_python_link],[
- ac_cv_python_link="`$PYTHON ${abs_srcdir}/build/get-py-info.py --link`"
- ])
- SWIG_PY_LINK="$ac_cv_python_link"
+ save_cppflags="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $ac_cv_python_includes"
+ AC_CHECK_HEADER(Python.h, [
+ python_header_found="yes"
+ ])
+ CPPFLAGS="$save_cppflags"
+
+ if test "$python_header_found" = "no"; then
+ SWIG_PY_ERRMSG="no Python.h found"
+ AC_MSG_WARN([Python.h not found; disabling python swig bindings])
+ else
+ SVN_PY3C()
+
+ if test "$py3c_found" = "no"; then
+ SWIG_PY_ERRMSG="py3c library not found"
+ AC_MSG_WARN([py3c library not found; disabling python swig bindings])
+ else
+ AC_CACHE_CHECK([for compiling Python extensions], [ac_cv_python_compile],[
+ ac_cv_python_compile="`$PYTHON ${abs_srcdir}/build/get-py-info.py --compile`"
+ ])
+ SWIG_PY_COMPILE="$ac_cv_python_compile $CFLAGS"
+
+ AC_CACHE_CHECK([for linking Python extensions], [ac_cv_python_link],[
+ ac_cv_python_link="`$PYTHON ${abs_srcdir}/build/get-py-info.py --link`"
+ ])
+ SWIG_PY_LINK="$ac_cv_python_link"
+
+ AC_CACHE_CHECK([for linking Python libraries], [ac_cv_python_libs],[
+ ac_cv_python_libs="`$PYTHON ${abs_srcdir}/build/get-py-info.py --libs`"
+ ])
+ SWIG_PY_LIBS="`SVN_REMOVE_STANDARD_LIB_DIRS($ac_cv_python_libs)`"
+
+ AC_CACHE_CHECK([for Python >= 3], [ac_cv_python_is_py3],[
+ ac_cv_python_is_py3="no"
+ $PYTHON -c 'import sys; sys.exit(0x3000000 > sys.hexversion)' && \
+ ac_cv_python_is_py3="yes"
+ ])
+
+ if test "$ac_cv_python_is_py3" = "yes"; then
+ if test "$SWIG_VERSION" -ge "300010"; then
+ dnl SWIG Python bindings successfully configured, clear the error message dnl
+ SWIG_PY_ERRMSG=""
+ else
+ SWIG_PY_ERRMSG="SWIG version is not suitable"
+ AC_MSG_WARN([Subversion Python bindings for Python 3 require SWIG 3.0.10 or newer])
+ fi
+ if test "$SWIG_VERSION" -lt "400000"; then
+ SWIG_PY_OPTS="-python -py3 -nofastunpack -modern"
+ else
+ SWIG_PY_OPTS="-python -py3 -nofastunpack"
+ fi
+ else
+ if test "$SWIG_VERSION" -lt "400000"; then
+ SWIG_PY_OPTS="-python -classic"
+ dnl SWIG Python bindings successfully configured, clear the error message dnl
+ SWIG_PY_ERRMSG=""
+ else
+ SWIG_PY_OPTS="-python -nofastunpack"
+ SWIG_PY_ERRMSG="SWIG version is not suitable"
+ AC_MSG_WARN([Subversion Python bindings for Python 2 require 1.3.24 <= SWIG < 4.0.0])
+ fi
+ fi
+ fi
+
+ fi
+ fi
- AC_CACHE_CHECK([for linking Python libraries], [ac_cv_python_libs],[
- ac_cv_python_libs="`$PYTHON ${abs_srcdir}/build/get-py-info.py --libs`"
- ])
- SWIG_PY_LIBS="`SVN_REMOVE_STANDARD_LIB_DIRS($ac_cv_python_libs)`"
fi
+ SWIG_PL_ERRMSG="check config.log for details"
if test "$PERL" != "none"; then
AC_MSG_CHECKING([perl version])
dnl Note that the q() bit is there to avoid unbalanced brackets
@@ -140,6 +199,9 @@ AC_DEFUN(SVN_FIND_SWIG,
SWIG_PL_INCLUDES="\$(SWIG_INCLUDES) `$PERL -MExtUtils::Embed -e ccopts`"
SWIG_PL_LINK="`$PERL -MExtUtils::Embed -e ldopts`"
SWIG_PL_LINK="`SVN_REMOVE_STANDARD_LIB_DIRS($SWIG_PL_LINK)`"
+
+ dnl SWIG Perl bindings successfully configured, clear the error message
+ SWIG_PL_ERRMSG=""
else
AC_MSG_WARN([perl bindings require perl 5.8.0 or newer.])
fi
@@ -147,6 +209,7 @@ AC_DEFUN(SVN_FIND_SWIG,
SWIG_RB_COMPILE="none"
SWIG_RB_LINK="none"
+ SWIG_RB_ERRMSG="check config.log for details"
if test "$RUBY" != "none"; then
if test x"$SWIG_VERSION" = x"3""00""008"; then
# Use a local variable to escape the '#' sign.
@@ -167,7 +230,7 @@ AC_DEFUN(SVN_FIND_SWIG,
AC_CACHE_CHECK([for Ruby include path], [svn_cv_ruby_includes],[
if test -d "$rbconfig_rubyhdrdir"; then
dnl Ruby >=1.9
- svn_cv_ruby_includes="-I. -I$rbconfig_rubyhdrdir -I$rbconfig_rubyhdrdir/ruby -I$rbconfig_rubyhdrdir/ruby/backward"
+ svn_cv_ruby_includes="-I. -I$rbconfig_rubyhdrdir"
if test -d "$rbconfig_rubyarchhdrdir"; then
dnl Ruby >=2.0
svn_cv_ruby_includes="$svn_cv_ruby_includes -I$rbconfig_rubyarchhdrdir"
@@ -264,14 +327,20 @@ int main()
[svn_ruby_test_verbose="$svn_cv_ruby_test_verbose"])
SWIG_RB_TEST_VERBOSE="$svn_ruby_test_verbose"
AC_MSG_RESULT([$SWIG_RB_TEST_VERBOSE])
+
+ dnl SWIG Ruby bindings successfully configured, clear the error message
+ SWIG_RB_ERRMSG=""
fi
AC_SUBST(SWIG)
AC_SUBST(SWIG_PY_INCLUDES)
AC_SUBST(SWIG_PY_COMPILE)
AC_SUBST(SWIG_PY_LINK)
AC_SUBST(SWIG_PY_LIBS)
+ AC_SUBST(SWIG_PY_OPTS)
+ AC_SUBST(SWIG_PY_ERRMSG)
AC_SUBST(SWIG_PL_INCLUDES)
AC_SUBST(SWIG_PL_LINK)
+ AC_SUBST(SWIG_PL_ERRMSG)
AC_SUBST(SWIG_RB_LINK)
AC_SUBST(SWIG_RB_LIBS)
AC_SUBST(SWIG_RB_INCLUDES)
@@ -279,4 +348,5 @@ int main()
AC_SUBST(SWIG_RB_SITE_LIB_DIR)
AC_SUBST(SWIG_RB_SITE_ARCH_DIR)
AC_SUBST(SWIG_RB_TEST_VERBOSE)
+ AC_SUBST(SWIG_RB_ERRMSG)
])
diff --git a/build/ac-macros/utf8proc.m4 b/build/ac-macros/utf8proc.m4
index fbd1e42..e929d6e 100644
--- a/build/ac-macros/utf8proc.m4
+++ b/build/ac-macros/utf8proc.m4
@@ -54,7 +54,7 @@ AC_DEFUN(SVN_UTF8PROC,
SVN_UTF8PROC_PREFIX
fi
if test "$utf8proc_found" != "yes"; then
- AC_MSG_ERROR([Subversion requires UTF8PROC])
+ AC_MSG_ERROR([Subversion requires UTF8PROC; install it or re-run configure with "--with-utf8proc=internal"])
fi
fi
AC_SUBST(SVN_UTF8PROC_INCLUDES)
diff --git a/build/generator/gen_base.py b/build/generator/gen_base.py
index 458545c..f3041f9 100644
--- a/build/generator/gen_base.py
+++ b/build/generator/gen_base.py
@@ -1273,7 +1273,8 @@ class IncludeDependencyInfo:
Return a dictionary with included full file names as keys and None as
values."""
hdrs = { }
- for line in fileinput.input(fname):
+
+ for line in fileinput.FileInput(fname, openhook=fileinput.hook_encoded("utf-8")):
match = self._re_include.match(line)
if not match:
continue
diff --git a/build/generator/gen_make.py b/build/generator/gen_make.py
index bdb5d00..c532b02 100644
--- a/build/generator/gen_make.py
+++ b/build/generator/gen_make.py
@@ -208,7 +208,9 @@ class Generator(gen_base.GeneratorBase):
swig_lang_deps[objname.lang].append(str(objname))
for lang in self.swig.langs:
- data.swig_langs.append(_eztdata(short=self.swig.short[lang],
+ data.swig_langs.append(_eztdata(name=lang,
+ short=self.swig.short[lang],
+ short_upper=self.swig.short[lang].upper(),
deps=swig_lang_deps[lang]))
########################################
@@ -509,6 +511,7 @@ class Generator(gen_base.GeneratorBase):
standalone.write('top_srcdir = .\n')
standalone.write('top_builddir = .\n')
standalone.write('SWIG = swig\n')
+ standalone.write('SWIG_PY_OPTS = -python -py3 -nofastunpack -modern\n')
standalone.write('PYTHON = ' + sys.executable + '\n')
standalone.write('\n')
standalone.write(open("build-outputs.mk","r").read())
diff --git a/build/generator/gen_vcnet_vcproj.py b/build/generator/gen_vcnet_vcproj.py
index f34b280..31a2d7b 100644
--- a/build/generator/gen_vcnet_vcproj.py
+++ b/build/generator/gen_vcnet_vcproj.py
@@ -120,10 +120,13 @@ class Generator(gen_win.WinGeneratorBase):
'instrument_purify_quantify' : self.instrument_purify_quantify,
'version' : self.vcproj_version,
'toolset_version' : 'v' + self.vcproj_version.replace('.',''),
+ 'user_macros': self.user_macros,
}
if self.vcproj_extension == '.vcproj':
self.write_with_template(fname, 'templates/vcnet_vcproj.ezt', data)
+ self.write_with_template(os.path.splitext(fname)[0] + '.vsprops',
+ 'templates/vcnet_vsprops.ezt', data)
else:
self.write_with_template(fname, 'templates/vcnet_vcxproj.ezt', data)
self.write_with_template(fname + '.filters', 'templates/vcnet_vcxproj_filters.ezt', data)
@@ -286,7 +289,7 @@ class Generator(gen_win.WinGeneratorBase):
def quote_define(self, value):
"Properly quote special characters in a define (if needed)"
-
+
if self.vcproj_extension == '.vcproj':
return value.replace('"', '""')
else:
diff --git a/build/generator/gen_win.py b/build/generator/gen_win.py
index 9d7350a..7565a9a 100644
--- a/build/generator/gen_win.py
+++ b/build/generator/gen_win.py
@@ -158,6 +158,13 @@ class WinGeneratorBase(gen_win_dependencies.GenDependenciesBase):
### implement this from scratch using the algorithms described in
### http://www.webdav.org/specs/draft-leach-uuids-guids-01.txt
+ # Ensure data is in byte representation. If it doesn't have an encode
+ # attribute, assume it is already in the correct form.
+ try:
+ data = data.encode('utf8')
+ except AttributeError:
+ pass
+
myhash = hashlib_md5(data).hexdigest()
guid = ("{%s-%s-%s-%s-%s}" % (myhash[0:8], myhash[8:12],
@@ -739,7 +746,7 @@ class WinGeneratorBase(gen_win_dependencies.GenDependenciesBase):
fakedefines.append(self.quote_define('SVN_WIN32_CRASHREPORT_EMAIL="users@subversion.apache.org"'))
return fakedefines
-
+
def quote_define(self, value):
"Properly quote special characters in a define (if needed)"
return value
@@ -778,6 +785,10 @@ class WinGeneratorBase(gen_win_dependencies.GenDependenciesBase):
else:
lang_subdir = target.lang
+ if target.lang == "python":
+ lib = self._libraries['py3c']
+ fakeincludes.extend(lib.include_dirs)
+
# After the language specific includes include the generic libdir,
# to allow overriding a generic with a per language include
fakeincludes.append(os.path.join(self.swig_libdir, lang_subdir))
diff --git a/build/generator/gen_win_dependencies.py b/build/generator/gen_win_dependencies.py
index da59599..03048c0 100644
--- a/build/generator/gen_win_dependencies.py
+++ b/build/generator/gen_win_dependencies.py
@@ -32,6 +32,7 @@ import fnmatch
import re
import subprocess
import string
+from collections import namedtuple
if sys.version_info[0] >= 3:
# Python >=3.0
@@ -46,6 +47,8 @@ else:
import gen_base
import ezt
+UserMacro = namedtuple('UserMacro', ['name', 'value'])
+
class SVNCommonLibrary:
def __init__(self, name, include_dirs, lib_dir, lib_name, version=None,
@@ -117,6 +120,7 @@ class GenDependenciesBase(gen_base.GeneratorBase):
'swig',
'perl',
'python',
+ 'py3c',
'ruby',
'java_sdk',
'openssl',
@@ -148,6 +152,7 @@ class GenDependenciesBase(gen_base.GeneratorBase):
self.jdk_path = None
self.junit_path = None
self.swig_path = None
+ self.py3c_path = None
self.vs_version = '2002'
self.sln_version = '7.00'
self.vcproj_version = '7.00'
@@ -167,6 +172,7 @@ class GenDependenciesBase(gen_base.GeneratorBase):
self.instrument_purify_quantify = None
self.sasl_path = None
self.cpp_defines = []
+ self.user_macros = []
# NLS options
self.enable_nls = None
@@ -198,6 +204,8 @@ class GenDependenciesBase(gen_base.GeneratorBase):
self.zlib_path = val
elif opt == '--with-swig':
self.swig_path = val
+ elif opt == '--with-py3c':
+ self.py3c_path = val
elif opt == '--with-sqlite':
self.sqlite_path = val
elif opt == '--with-sasl':
@@ -329,13 +337,15 @@ class GenDependenciesBase(gen_base.GeneratorBase):
# Swig (optional) dependencies
if self._find_swig(show_warnings):
self._find_perl(show_warnings)
- self._find_python(show_warnings)
+ # py3c is required to build python bindings, show check it first
+ if self._find_py3c(show_warnings):
+ self._find_python(show_warnings)
self._find_ruby(show_warnings)
def _find_apr(self):
"Find the APR library and version"
- minimal_apr_version = (1, 3, 0)
+ minimal_apr_version = (1, 5, 0)
if not self.apr_path:
sys.stderr.write("ERROR: Use '--with-apr' option to configure APR " + \
@@ -770,7 +780,7 @@ class GenDependenciesBase(gen_base.GeneratorBase):
if self.bdb_path:
bdb_path = self.bdb_path
-
+
inc_path = os.path.join(bdb_path, 'include')
db_h_path = os.path.join(inc_path, 'db.h')
@@ -1027,9 +1037,52 @@ class GenDependenciesBase(gen_base.GeneratorBase):
except ImportError:
return
+ if sys.version_info[0] >= 3:
+ self.user_macros.append(UserMacro("SWIG_PY_OPTS", "-python -py3"))
+ else:
+ self.user_macros.append(UserMacro("SWIG_PY_OPTS", "-python -classic"))
+
self._libraries['python'] = SVNCommonLibrary('python', inc_dir, lib_dir, None,
sys.version.split(' ')[0])
+ def _find_py3c(self, show_warnings):
+ "Find the py3c library which is used in SWIG python bindings"
+ show_warnings = True
+ # Assume a default path, unless otherwise specified
+ py3c_path = "py3c"
+
+ if self.py3c_path:
+ py3c_path = self.py3c_path
+
+ py3c_path = os.path.abspath(py3c_path)
+ inc_path = os.path.join(py3c_path, 'include')
+ py3c_hdr_path = os.path.join(inc_path, 'py3c.h')
+
+ pc_path = os.path.join(py3c_path, 'py3c.pc.in')
+
+ if not os.path.isfile(py3c_hdr_path):
+ if show_warnings:
+ print('WARNING: "%s" not found' % py3c_hdr_path)
+ print('Use "--with-py3c" to configure py3c location.')
+ return False
+
+ with open(pc_path) as fp:
+ txt = fp.read()
+
+ ver_match = re.search(r'Version:\s+([0-9.]+)', txt)
+
+ if not ver_match:
+ if show_warnings:
+ print("WARNING: Failed to find version in '%s'" % pc_path)
+ return False
+
+ py3c_version = ver_match.group(1)
+
+ self._libraries['py3c'] = SVNCommonLibrary('py3c', inc_path, None,
+ None, py3c_version)
+
+ return True
+
def _find_jdk(self, show_warnings):
"Find details about an installed jdk"
@@ -1080,7 +1133,7 @@ class GenDependenciesBase(gen_base.GeneratorBase):
outfp = subprocess.Popen([os.path.join(jdk_path, 'bin', 'javac.exe'),
'-version'], stdout=subprocess.PIPE,
stderr=subprocess.STDOUT).stdout
- line = outfp.read()
+ line = outfp.read().decode('utf8')
if line:
vermatch = re.search(r'(([0-9]+(\.[0-9]+)+)(_[._0-9]+)?)', line, re.M)
else:
@@ -1138,7 +1191,7 @@ class GenDependenciesBase(gen_base.GeneratorBase):
try:
fp = subprocess.Popen([self.swig_exe, '-version'],
stdout=subprocess.PIPE).stdout
- txt = fp.read()
+ txt = fp.read().decode('utf8')
if txt:
vermatch = re.search(r'^SWIG\ Version\ (\d+)\.(\d+)\.(\d+)', txt, re.M)
else:
@@ -1166,7 +1219,7 @@ class GenDependenciesBase(gen_base.GeneratorBase):
try:
fp = subprocess.Popen([self.swig_exe, '-swiglib'],
stdout=subprocess.PIPE).stdout
- lib_dir = fp.readline().strip()
+ lib_dir = fp.readline().decode('utf8').strip()
fp.close()
except OSError:
lib_dir = None
diff --git a/build/generator/swig/__init__.py b/build/generator/swig/__init__.py
index 2ecfe4b..000524e 100644
--- a/build/generator/swig/__init__.py
+++ b/build/generator/swig/__init__.py
@@ -62,7 +62,7 @@ class Generator:
if os.access(self.swig_path, os.X_OK):
# ### TODO: What's the reason for this os.access() check? It was added
# ### in r873265 (== r33191).
- self.swig_libdir = subprocess.check_output([self.swig_path, "-swiglib"]).strip()
+ self.swig_libdir = subprocess.check_output([self.swig_path, "-swiglib"]).decode('utf8').strip()
else:
self.swig_libdir = None
@@ -71,7 +71,7 @@ class Generator:
"""Get the version number of SWIG"""
if not self._swigVersion:
- swig_version = subprocess.check_output([self.swig_path, "-version"])
+ swig_version = subprocess.check_output([self.swig_path, "-version"]).decode('utf8')
m = re.search("Version (\d+).(\d+).(\d+)", swig_version)
if m:
self._swigVersion = tuple(map(int, m.groups()))
diff --git a/build/generator/swig/header_wrappers.py b/build/generator/swig/header_wrappers.py
index 6c3533d..89b2802 100755
--- a/build/generator/swig/header_wrappers.py
+++ b/build/generator/swig/header_wrappers.py
@@ -265,7 +265,13 @@ class Generator(generator.swig.Generator):
self.proxy_filename(base_fname))
# Open a temporary output file
- self.ofile = tempfile.TemporaryFile(dir=self.proxy_dir)
+ if sys.version_info[0] >= 3:
+ self.ofile = tempfile.TemporaryFile(dir=self.proxy_dir,
+ mode="w+",
+ encoding="utf8")
+ else:
+ self.ofile = tempfile.TemporaryFile(dir=self.proxy_dir)
+
self.ofile.write('/* Proxy classes for %s\n' % base_fname)
self.ofile.write(' * DO NOT EDIT -- AUTOMATICALLY GENERATED\n')
self.ofile.write(' * BY build/generator/swig/header_wrappers.py */\n')
diff --git a/build/generator/templates/build-outputs.mk.ezt b/build/generator/templates/build-outputs.mk.ezt
index 8e52bdf..56d03d3 100644
--- a/build/generator/templates/build-outputs.mk.ezt
+++ b/build/generator/templates/build-outputs.mk.ezt
@@ -70,8 +70,18 @@ RELEASE_MODE = 1
# Section 3: SWIG autogen rules
########################################
[for swig_langs]
-autogen-swig-[swig_langs.short]:[for swig_langs.deps] [swig_langs.deps][end]
+.swig_[swig_langs.short]_checked:
+ @if [ -n "$(SWIG_[swig_langs.short_upper]_ERRMSG)" ]; then \
+ echo "SWIG [swig_langs.name] disabled at configure time: $(SWIG_[swig_langs.short_upper]_ERRMSG)" >&2; \
+ exit 1; \
+ fi
+ @touch $@
+
+autogen-swig-[swig_langs.short]: .swig_[swig_langs.short]_checked [for swig_langs.deps] [swig_langs.deps][end]
autogen-swig: autogen-swig-[swig_langs.short]
+
+# Ensure the swig build targets depend on the configuration check
+swig-[swig_langs.short]: .swig_[swig_langs.short]_checked
[end]
diff --git a/build/generator/templates/vcnet_vcproj.ezt b/build/generator/templates/vcnet_vcproj.ezt
index b12ed1a..f614f0a 100644
--- a/build/generator/templates/vcnet_vcproj.ezt
+++ b/build/generator/templates/vcnet_vcproj.ezt
@@ -33,6 +33,7 @@
OutputDirectory="..\..\..\[configs.name]\[target.output_dir]"
BuildLogFile="$(IntDir)\BuildLog_$(ProjectName).htm"
IntermediateDirectory="..\..\..\[configs.name]\[target.intermediate_dir]\[target.proj_name]"
+ InheritedPropertySheets=".\[target.proj_name].vsprops"
ConfigurationType="[target_type]"[is configs.name "Release"]
WholeProgramOptimization="FALSE"[end]>
<Tool
@@ -59,7 +60,7 @@
DisableSpecificWarnings="4100;4127;4206;4512;4701;4706;4800"
Detect64BitPortabilityProblems="FALSE"
AdditionalOptions="
- /we4002 /we4003 /we4013 /we4020 /we4022 /we4024 /we4028 /we4029 /we4030 /we4031 /we4033 /we4047 /we4089 /we4113 /we4115 /we4204 /we4715"
+ /we4002 /we4003 /we4013 /we4020 /we4022 /we4024 /we4028 /we4029 /we4030 /we4031 /we4033 /we4047 /we4089 /we4113 /we4204 /we4715"
DebugInformationFormat="3"
ProgramDataBaseFileName="$(IntDir)\[target.output_pdb]"
[if-any configs.forced_include_files]ForcedIncludeFiles="[for configs.forced_include_files][configs.forced_include_files][if-index configs.forced_include_files last][else];[end][end]"
diff --git a/build/generator/templates/vcnet_vcxproj.ezt b/build/generator/templates/vcnet_vcxproj.ezt
index 41c8f08..144463f 100644
--- a/build/generator/templates/vcnet_vcxproj.ezt
+++ b/build/generator/templates/vcnet_vcxproj.ezt
@@ -43,7 +43,9 @@
[for platforms][for configs] <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='[configs.name]|[platforms]'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
-[end][end] <PropertyGroup Label="UserMacros" />
+[end][end] <PropertyGroup Label="UserMacros">
+[for user_macros] <[user_macros.name]>[user_macros.value]</[user_macros.name]>
+[end] </PropertyGroup>
[for platforms][for configs] <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='[configs.name]|[platforms]'">
<OutDir>$(SolutionDir)[configs.name]\[target.output_dir]\</OutDir>
<IntDir>$(SolutionDir)[configs.name]\obj\[target.intermediate_dir]\[target.proj_name]\</IntDir>
@@ -63,7 +65,7 @@
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4100;4127;4206;4512;4701;4706;4800;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- <TreatSpecificWarningsAsErrors>4002;4003;4013;4020;4022;4024;4028;4029;4030;4031;4033;4047;4089;4113;4115;4133;4204;4700;4715;4789;%(TreatSpecificWarningsAsErrors)</TreatSpecificWarningsAsErrors>
+ <TreatSpecificWarningsAsErrors>4002;4003;4013;4020;4022;4024;4028;4029;4030;4031;4033;4047;4089;4113;4133;4204;4700;4715;4789;%(TreatSpecificWarningsAsErrors)</TreatSpecificWarningsAsErrors>
[if-any configs.forced_include_files] <ForcedIncludeFiles>[for configs.forced_include_files][configs.forced_include_files];[end]%(ForcedIncludeFiles)</ForcedIncludeFiles>
[end] </ClCompile>
<ResourceCompile>
diff --git a/build/generator/templates/vcnet_vsprops.ezt b/build/generator/templates/vcnet_vsprops.ezt
new file mode 100644
index 0000000..4aff513
--- /dev/null
+++ b/build/generator/templates/vcnet_vsprops.ezt
@@ -0,0 +1,31 @@
+[#
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+]<?xml version="1.0" encoding = "Windows-1252"?>
+[format "xml"]<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="[target.proj_name]"
+ >
+ [for user_macros]<UserMacro
+ Name="[user_macros.name]"
+ Value="[user_macros.value]"
+ />[end]
+</VisualStudioPropertySheet>
+[end]
diff --git a/build/get-py-info.py b/build/get-py-info.py
index 29a6c0a..95bad41 100644
--- a/build/get-py-info.py
+++ b/build/get-py-info.py
@@ -81,20 +81,8 @@ def link_options():
# Initialize config variables
assert os.name == "posix"
options = sysconfig.get_config_var('LDSHARED').split()
- fwdir = sysconfig.get_config_var('PYTHONFRAMEWORKDIR')
- if fwdir and fwdir != "no-framework":
-
- # Setup the framework prefix
- fwprefix = sysconfig.get_config_var('PYTHONFRAMEWORKPREFIX')
- if fwprefix != "/System/Library/Frameworks":
- add_option_if_missing(options, "-F%s" % fwprefix)
-
- # Load in the framework
- fw = sysconfig.get_config_var('PYTHONFRAMEWORK')
- add_option(options, "-framework", fw)
-
- elif sys.platform == 'darwin':
+ if sys.platform == 'darwin':
# Load bundles from python
python_exe = os.path.join(sysconfig.get_config_var("BINDIR"),
diff --git a/build/run_tests.py b/build/run_tests.py
index 7760d81..5a661af 100755
--- a/build/run_tests.py
+++ b/build/run_tests.py
@@ -50,7 +50,7 @@ separated list of test numbers; the default is to run all the tests in it.
import os, sys, shutil, codecs
import re
import logging
-import optparse, subprocess, imp, threading, traceback
+import optparse, subprocess, threading, traceback
from datetime import datetime
try:
@@ -64,6 +64,13 @@ if sys.version_info < (3, 0):
# Python >= 3.0 already has this build in
import exceptions
+if sys.version_info < (3, 5):
+ import imp
+else:
+ # The imp module is deprecated since Python 3.4; the replacement we use,
+ # module_from_spec(), is available since Python 3.5.
+ import importlib.util
+
# Ensure the compiled C tests use a known locale (Python tests set the locale
# explicitly).
os.environ['LC_ALL'] = 'C'
@@ -383,7 +390,7 @@ class TestHarness:
lines = prog.stdout.readlines()
for i in range(0, len(lines) - 2):
- self.result.append(TestHarness.Job(i + 1, True, progabs,
+ self.result.append(TestHarness.Job(i + 1, True, progabs,
progdir, progbase))
prog.wait()
@@ -713,9 +720,11 @@ class TestHarness:
# Summary.
if failed or xpassed or failed_list:
- print("SUMMARY: Some tests failed.\n")
+ summary = "Some tests failed"
else:
- print("SUMMARY: All tests successful.\n")
+ summary = "All tests successful"
+ print("Python version: %d.%d.%d." % sys.version_info[:3])
+ print("SUMMARY: %s\n" % summary)
self._close_log()
return failed
@@ -819,10 +828,15 @@ class TestHarness:
if sys.version_info < (3, 0):
prog_mod = imp.load_module(progbase[:-3], open(progabs, 'r'), progabs,
('.py', 'U', imp.PY_SOURCE))
- else:
+ elif sys.version_info < (3, 5):
prog_mod = imp.load_module(progbase[:-3],
open(progabs, 'r', encoding="utf-8"),
progabs, ('.py', 'U', imp.PY_SOURCE))
+ else:
+ spec = importlib.util.spec_from_file_location(progbase[:-3], progabs)
+ prog_mod = importlib.util.module_from_spec(spec)
+ sys.modules[progbase[:-3]] = prog_mod
+ spec.loader.exec_module(prog_mod)
except:
print("\nError loading test (details in following traceback): " + progbase)
traceback.print_exc()