Modified: subversion/branches/multi-wc-format/build/ac-macros/swig.m4 URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/build/ac-macros/swig.m4?rev=1897034&r1=1897033&r2=1897034&view=diff ============================================================================== --- subversion/branches/multi-wc-format/build/ac-macros/swig.m4 (original) +++ subversion/branches/multi-wc-format/build/ac-macros/swig.m4 Fri Jan 14 14:01:45 2022 @@ -21,33 +21,40 @@ dnl check to see if SWIG is current enou dnl dnl if it is, then check to see if we have the correct version of python. dnl -dnl if we do, then set up the appropriate SWIG_ variables to build the -dnl python bindings. +dnl if we do, then set up the appropriate SWIG_ variables to build the +dnl Python, Perl, and Ruby bindings. AC_DEFUN(SVN_CHECK_SWIG, [ - AC_ARG_WITH(swig, - AS_HELP_STRING([--with-swig=PATH], - [Try to use 'PATH/bin/swig' to build the - swig bindings. If PATH is not specified, - look for a 'swig' binary in your PATH.]), + m4_ifndef([SVN_RELEASE_MODE], [ - case "$withval" in - "no") - SWIG_SUITABLE=no - SVN_FIND_SWIG(no) - ;; - "yes") - SVN_FIND_SWIG(required) + AC_ARG_WITH(swig, + AS_HELP_STRING([--with-swig=PATH], + [Try to use 'PATH/bin/swig' to build the + swig bindings. If PATH is not specified, + look for a 'swig' binary in your PATH.]), + [ + case "$withval" in + yes) + svn_find_swig_arg=required ;; *) - SVN_FIND_SWIG($withval) + svn_find_swig_arg=$withval ;; - esac - ], - [ - SVN_FIND_SWIG(check) + esac + ], + [ + if test "$SWIG_PY_PYTHON" != "none" \ + || test "$SWIG_PL_PERL" != "none" \ + || test "$SWIG_RB_RUBY" != "none" ; then + svn_find_swig_arg=check + else + svn_find_swig_arg=no + fi + ]) + SVN_FIND_SWIG($svn_find_swig_arg) ]) + SVN_DETERMINE_SWIG_OPTS ]) AC_DEFUN(SVN_FIND_SWIG, @@ -69,7 +76,7 @@ AC_DEFUN(SVN_FIND_SWIG, fi if test ! -f "$SWIG" || test ! -x "$SWIG"; then AC_MSG_ERROR([Could not find swig binary at $SWIG]) - fi + fi fi if test "$SWIG" != "none"; then @@ -78,7 +85,7 @@ AC_DEFUN(SVN_FIND_SWIG, $SED -ne 's/^.*Version \(.*\)$/\1/p'`" # We want the version as an integer so we can test against # which version we're using. SWIG doesn't provide this - # to us so we have to come up with it on our own. + # to us so we have to come up with it on our own. # The major is passed straight through, # the minor is zero padded to two places, # and the patch level is zero padded to three places. @@ -91,222 +98,493 @@ AC_DEFUN(SVN_FIND_SWIG, AC_MSG_RESULT([$SWIG_VERSION_RAW]) # If you change the required swig version number, don't forget to update: # subversion/bindings/swig/INSTALL - if test -n "$SWIG_VERSION" && test "$SWIG_VERSION" -ge "103024"; then - SWIG_SUITABLE=yes - else - SWIG_SUITABLE=no + if test ! -n "$SWIG_VERSION" || test "$SWIG_VERSION" -lt "103024"; then AC_MSG_WARN([Detected SWIG version $SWIG_VERSION_RAW]) AC_MSG_WARN([Subversion requires SWIG >= 1.3.24]) fi fi - - SWIG_PY_COMPILE="none" - SWIG_PY_LINK="none" - if test "$PYTHON" != "none"; then - AC_MSG_NOTICE([Configuring python swig binding]) - - AC_CACHE_CHECK([for Python includes], [ac_cv_python_includes],[ - ac_cv_python_includes="`$PYTHON ${abs_srcdir}/build/get-py-info.py --includes`" - ]) - SWIG_PY_INCLUDES="\$(SWIG_INCLUDES) $ac_cv_python_includes" - - if test "$ac_cv_python_includes" = "none"; then - AC_MSG_WARN([python bindings cannot be built without distutils module]) - fi - - 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_DEFUN(SVN_DETERMINE_SWIG_OPTS, +[ + m4_ifndef([SVN_RELEASE_MODE], + [ + # not in release mode + SWIG_PY_COMPILE="none" + SWIG_PY_LINK="none" + SWIG_PY_OPTS="none" + SWIG_PY_ERRMSG="check config.log for details" + if test "$SWIG_PY_PYTHON" = "none"; then + SWIG_PY_ERRMSG="You specfied not to build Python bindings or \ +suitable Python interpreter is not found." + else + if test "$SWIG" = "none"; then + AC_MSG_WARN([You specified to build SWIG Python bindings, but SWIG is not found.]) + SWIG_PY_ERRMSG="SWIG is need to build SWIG Python bindings, but it is not found." + else + AC_MSG_NOTICE([Configuring python swig binding]) - dnl Sun Forte adds an extra space before substituting APR_INT64_T_FMT - dnl gcc-2.95 adds an extra space after substituting APR_INT64_T_FMT - dnl thus the egrep patterns have a + in them. - SVN_PYCFMT_SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $SVN_APR_INCLUDES" - AC_CACHE_CHECK([for apr_int64_t Python/C API format string], - [svn_cv_pycfmt_apr_int64_t], [ - if test "x$svn_cv_pycfmt_apr_int64_t" = "x"; then - AC_EGREP_CPP([MaTcHtHiS +\"lld\" +EnDeNd], - [#include <apr.h> - MaTcHtHiS APR_INT64_T_FMT EnDeNd], - [svn_cv_pycfmt_apr_int64_t="L"]) - fi - if test "x$svn_cv_pycfmt_apr_int64_t" = "x"; then - AC_EGREP_CPP([MaTcHtHiS +\"ld\" +EnDeNd],r - [#include <apr.h> - MaTcHtHiS APR_INT64_T_FMT EnDeNd], - [svn_cv_pycfmt_apr_int64_t="l"]) + AC_CACHE_CHECK([for Python includes], [ac_cv_python_includes],[ + ac_cv_python_includes="`$SWIG_PY_PYTHON ${abs_srcdir}/build/get-py-info.py --includes`" + ]) + 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]) + else + + python_header_found="no" + + 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="`$SWIG_PY_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="`$SWIG_PY_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="`$SWIG_PY_PYTHON ${abs_srcdir}/build/get-py-info.py --libs`" + ]) + SWIG_PY_LIBS="`SVN_REMOVE_STANDARD_LIB_DIRS($ac_cv_python_libs)`" + + # Look more closely at the SWIG and Python versions to + # determine SWIG_PY_OPTS. We can skip this if we already + # have the SWIG-generated files. + AC_CACHE_CHECK([for Python >= 3], [ac_cv_python_is_py3],[ + ac_cv_python_is_py3="no" + $SWIG_PY_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 fi - if test "x$svn_cv_pycfmt_apr_int64_t" = "x"; then - AC_EGREP_CPP([MaTcHtHiS +\"d\" +EnDeNd], - [#include <apr.h> - MaTcHtHiS APR_INT64_T_FMT EnDeNd], - [svn_cv_pycfmt_apr_int64_t="i"]) - fi - ]) - CPPFLAGS="$SVN_PYCFMT_SAVE_CPPFLAGS" - if test "x$svn_cv_pycfmt_apr_int64_t" = "x"; then - AC_MSG_ERROR([failed to recognize APR_INT64_T_FMT on this platform]) fi - AC_DEFINE_UNQUOTED([SVN_APR_INT64_T_PYCFMT], - ["$svn_cv_pycfmt_apr_int64_t"], - [Define to the Python/C API format character suitable] - [ for apr_int64_t]) - fi - if test "$PERL" != "none"; then - AC_MSG_CHECKING([perl version]) - dnl Note that the q() bit is there to avoid unbalanced brackets - dnl which m4 really doesn't like. - PERL_VERSION="`$PERL -e 'q([[); print $]] * 1000000,$/;'`" - AC_MSG_RESULT([$PERL_VERSION]) - if test "$PERL_VERSION" -ge "5008000"; then - 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)`" + SWIG_PL_ERRMSG="check config.log for details" + if test "$SWIG_PL_PERL" = "none"; then + SWIG_PL_ERRMSG="You specfied not to build Perl bindings or \ +suitable Perl interpreter is not found." else - AC_MSG_WARN([perl bindings require perl 5.8.0 or newer.]) + if test "$SWIG" = "none"; then + AC_MSG_WARN([You specified to build SWIG Perl bindings, but SWIG is not found.]) + SWIG_PL_ERRMSG="SWIG is need to build SWIG Perl bindings, but it is not found." + else + AC_MSG_CHECKING([perl version]) + dnl Note that the q() bit is there to avoid unbalanced brackets + dnl which m4 really doesn't like. + PERL_VERSION="`$SWIG_PL_PERL -e 'q([[); print $]] * 1000000,$/;'`" + AC_MSG_RESULT([$PERL_VERSION]) + if test "$PERL_VERSION" -ge "5008000"; then + SWIG_PL_INCLUDES="\$(SWIG_INCLUDES) `$SWIG_PL_PERL -MExtUtils::Embed -e ccopts`" + SWIG_PL_LINK="`$SWIG_PL_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 + fi fi - fi - SWIG_RB_COMPILE="none" - SWIG_RB_LINK="none" - if test "$RUBY" != "none"; then - if test x"$SWIG_VERSION" = x"3""00""008"; then - # Use a local variable to escape the '#' sign. - ruby_swig_issue_602='https://subversion.apache.org/docs/release-notes/1.11#ruby-swig-issue-602' - AC_MSG_WARN([Ruby bindings are known not to support swig 3.0.8; see $ruby_swig_issue_602]) + SWIG_RB_COMPILE="none" + SWIG_RB_LINK="none" + SWIG_RB_ERRMSG="check config.log for details" + if test "$SWIG_RB_RUBY" = "none"; then + SWIG_RB_ERRMSG="You specfied not to build Ruby bindings or \ +suitable Ruby interpreter is not found." + else + if test "$SWIG" = "none"; then + AC_MSG_WARN([You specified to build SWIG Ruby bindings, but SWIG is not found.]) + SWIG_RB_ERRMSG="SWIG is need to build SWIG Ruby bindings, but it is not found." + else + if test x"$SWIG_VERSION" = x"3""00""008"; then + # Use a local variable to escape the '#' sign. + ruby_swig_issue_602='https://subversion.apache.org/docs/release-notes/1.11#ruby-swig-issue-602' + AC_MSG_WARN([Ruby bindings are known not to support swig 3.0.8; see $ruby_swig_issue_602]) + fi + rbconfig="$SWIG_RB_RUBY -rrbconfig -e " + + for var_name in arch archdir CC LDSHARED DLEXT LIBS LIBRUBYARG \ + rubyhdrdir rubyarchhdrdir sitedir sitelibdir sitearchdir libdir + do + rbconfig_tmp=`$rbconfig "print RbConfig::CONFIG@<:@'$var_name'@:>@"` + eval "rbconfig_$var_name=\"$rbconfig_tmp\"" + done + + AC_MSG_NOTICE([Configuring Ruby SWIG binding]) + + 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" + if test -d "$rbconfig_rubyarchhdrdir"; then + dnl Ruby >=2.0 + svn_cv_ruby_includes="$svn_cv_ruby_includes -I$rbconfig_rubyarchhdrdir" + else + svn_cv_ruby_includes="$svn_cv_ruby_includes -I$rbconfig_rubyhdrdir/$rbconfig_arch" + fi + else + dnl Ruby 1.8 + svn_cv_ruby_includes="-I. -I$rbconfig_archdir" + fi + ]) + SWIG_RB_INCLUDES="\$(SWIG_INCLUDES) $svn_cv_ruby_includes" + + AC_CACHE_CHECK([how to compile Ruby extensions], [svn_cv_ruby_compile],[ + svn_cv_ruby_compile="$rbconfig_CC $CFLAGS" + ]) + SWIG_RB_COMPILE="$svn_cv_ruby_compile" + SVN_STRIP_FLAG([SWIG_RB_COMPILE], [-ansi]) + SVN_STRIP_FLAG([SWIG_RB_COMPILE], [-std=c89]) + SVN_STRIP_FLAG([SWIG_RB_COMPILE], [-std=c90]) + dnl FIXME: Check that the compiler for Ruby actually supports this flag + SWIG_RB_COMPILE="$SWIG_RB_COMPILE -Wno-int-to-pointer-cast" + + AC_CACHE_CHECK([how to link Ruby extensions], [svn_cv_ruby_link],[ + svn_cv_ruby_link="`$SWIG_RB_RUBY -e 'ARGV.shift; print ARGV.join(%q( ))' \ + $rbconfig_LDSHARED`" + svn_cv_ruby_link="$rbconfig_CC $svn_cv_ruby_link" + svn_cv_ruby_link="$svn_cv_ruby_link -shrext .$rbconfig_DLEXT" + ]) + SWIG_RB_LINK="$svn_cv_ruby_link" + + AC_CACHE_CHECK([how to link Ruby libraries], [ac_cv_ruby_libs], [ + ac_cv_ruby_libs="$rbconfig_LIBRUBYARG $rbconfig_LIBS" + ]) + SWIG_RB_LIBS="`SVN_REMOVE_STANDARD_LIB_DIRS($ac_cv_ruby_libs)`" + + AC_MSG_CHECKING([for rb_errinfo]) + old_CFLAGS="$CFLAGS" + old_LIBS="$LIBS" + CFLAGS="$CFLAGS $svn_cv_ruby_includes" + SVN_STRIP_FLAG([CFLAGS], [-ansi]) + SVN_STRIP_FLAG([CFLAGS], [-std=c89]) + SVN_STRIP_FLAG([CFLAGS], [-std=c90]) + LIBS="$SWIG_RB_LIBS" + AC_LINK_IFELSE([AC_LANG_SOURCE([[ +#include <ruby.h> +int main() +{rb_errinfo();}]])], have_rb_errinfo="yes", have_rb_errinfo="no") + if test "$have_rb_errinfo" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_RB_ERRINFO], [1], + [Define to 1 if you have the `rb_errinfo' function.]) + else + AC_MSG_RESULT([no]) + fi + CFLAGS="$old_CFLAGS" + LIBS="$old_LIBS" + + AC_CACHE_VAL([svn_cv_ruby_sitedir],[ + svn_cv_ruby_sitedir="$rbconfig_sitedir" + ]) + AC_ARG_WITH([ruby-sitedir], + AS_HELP_STRING([--with-ruby-sitedir=SITEDIR], + [install Ruby bindings in SITEDIR + (default is same as ruby's one)]), + [svn_ruby_installdir="$withval"], + [svn_ruby_installdir="$svn_cv_ruby_sitedir"]) + + AC_MSG_CHECKING([where to install Ruby scripts]) + AC_CACHE_VAL([svn_cv_ruby_sitedir_libsuffix],[ + svn_cv_ruby_sitedir_libsuffix="`echo "$rbconfig_sitelibdir" | \ + $SED -e "s,^$rbconfig_sitedir,,"`" + ]) + SWIG_RB_SITE_LIB_DIR="${svn_ruby_installdir}${svn_cv_ruby_sitedir_libsuffix}" + AC_MSG_RESULT([$SWIG_RB_SITE_LIB_DIR]) + + AC_MSG_CHECKING([where to install Ruby extensions]) + AC_CACHE_VAL([svn_cv_ruby_sitedir_archsuffix],[ + svn_cv_ruby_sitedir_archsuffix="`echo "$rbconfig_sitearchdir" | \ + $SED -e "s,^$rbconfig_sitedir,,"`" + ]) + SWIG_RB_SITE_ARCH_DIR="${svn_ruby_installdir}${svn_cv_ruby_sitedir_archsuffix}" + AC_MSG_RESULT([$SWIG_RB_SITE_ARCH_DIR]) + + AC_MSG_CHECKING([how to use output level for Ruby bindings tests]) + AC_CACHE_VAL([svn_cv_ruby_test_verbose],[ + svn_cv_ruby_test_verbose="normal" + ]) + AC_ARG_WITH([ruby-test-verbose], + AS_HELP_STRING([--with-ruby-test-verbose=LEVEL], + [how to use output level for Ruby bindings tests + (default is normal)]), + [svn_ruby_test_verbose="$withval"], + [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 fi - rbconfig="$RUBY -rrbconfig -e " + ], + [ + # in release mode + SWIG_PY_COMPILE="none" + SWIG_PY_LINK="none" + SWIG_PY_OPTS="none" + SWIG_PY_ERRMSG="check config.log for details" + if test "$SWIG_PY_PYTHON" = "none"; then + SWIG_PY_ERRMSG="You specfied not to build Python bindings or \ +suitable Python interpreter is not found." + else + AC_MSG_NOTICE([Configuring python swig binding]) - for var_name in arch archdir CC LDSHARED DLEXT LIBS LIBRUBYARG \ - rubyhdrdir rubyarchhdrdir sitedir sitelibdir sitearchdir libdir - do - rbconfig_tmp=`$rbconfig "print RbConfig::CONFIG@<:@'$var_name'@:>@"` - eval "rbconfig_$var_name=\"$rbconfig_tmp\"" - done - - AC_MSG_NOTICE([Configuring Ruby SWIG binding]) - - 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" - if test -d "$rbconfig_rubyarchhdrdir"; then - dnl Ruby >=2.0 - svn_cv_ruby_includes="$svn_cv_ruby_includes -I$rbconfig_rubyarchhdrdir" + AC_CACHE_CHECK([for Python includes], [ac_cv_python_includes],[ + ac_cv_python_includes="`$SWIG_PY_PYTHON ${abs_srcdir}/build/get-py-info.py --includes`" + ]) + 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]) else - svn_cv_ruby_includes="$svn_cv_ruby_includes -I$rbconfig_rubyhdrdir/$rbconfig_arch" + + python_header_found="no" + + 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="`$SWIG_PY_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="`$SWIG_PY_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="`$SWIG_PY_PYTHON ${abs_srcdir}/build/get-py-info.py --libs`" + ]) + SWIG_PY_LIBS="`SVN_REMOVE_STANDARD_LIB_DIRS($ac_cv_python_libs)`" + + SWIG_PY_ERRMSG="" + fi + fi fi + fi + + SWIG_PL_ERRMSG="check config.log for details" + if test "$SWIG_PL_PERL" = "none"; then + SWIG_PL_ERRMSG="You specfied not to build Perl bindings or \ +suitable Perl interpreter is not found." else - dnl Ruby 1.8 - svn_cv_ruby_includes="-I. -I$rbconfig_archdir" + AC_MSG_CHECKING([perl version]) + dnl Note that the q() bit is there to avoid unbalanced brackets + dnl which m4 really doesn't like. + PERL_VERSION="`$SWIG_PL_PERL -e 'q([[); print $]] * 1000000,$/;'`" + AC_MSG_RESULT([$PERL_VERSION]) + if test "$PERL_VERSION" -ge "5008000"; then + SWIG_PL_INCLUDES="\$(SWIG_INCLUDES) `$SWIG_PL_PERL -MExtUtils::Embed -e ccopts`" + SWIG_PL_LINK="`$SWIG_PL_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 fi - ]) - SWIG_RB_INCLUDES="\$(SWIG_INCLUDES) $svn_cv_ruby_includes" - AC_CACHE_CHECK([how to compile Ruby extensions], [svn_cv_ruby_compile],[ - svn_cv_ruby_compile="$rbconfig_CC $CFLAGS" - ]) - SWIG_RB_COMPILE="$svn_cv_ruby_compile" - SVN_STRIP_FLAG([SWIG_RB_COMPILE], [-ansi]) - SVN_STRIP_FLAG([SWIG_RB_COMPILE], [-std=c89]) - SVN_STRIP_FLAG([SWIG_RB_COMPILE], [-std=c90]) - dnl FIXME: Check that the compiler for Ruby actually supports this flag - SWIG_RB_COMPILE="$SWIG_RB_COMPILE -Wno-int-to-pointer-cast" - - AC_CACHE_CHECK([how to link Ruby extensions], [svn_cv_ruby_link],[ - svn_cv_ruby_link="`$RUBY -e 'ARGV.shift; print ARGV.join(%q( ))' \ - $rbconfig_LDSHARED`" - svn_cv_ruby_link="$rbconfig_CC $svn_cv_ruby_link" - svn_cv_ruby_link="$svn_cv_ruby_link -shrext .$rbconfig_DLEXT" - ]) - SWIG_RB_LINK="$svn_cv_ruby_link" + SWIG_RB_COMPILE="none" + SWIG_RB_LINK="none" + SWIG_RB_ERRMSG="check config.log for details" + if test "$SWIG_RB_RUBY" = "none"; then + SWIG_RB_ERRMSG="You specfied not to build Ruby bindings or \ +suitable Ruby interpreter is not found." + else + rbconfig="$SWIG_RB_RUBY -rrbconfig -e " - AC_CACHE_CHECK([how to link Ruby libraries], [ac_cv_ruby_libs], [ - ac_cv_ruby_libs="$rbconfig_LIBRUBYARG $rbconfig_LIBS" - ]) - SWIG_RB_LIBS="`SVN_REMOVE_STANDARD_LIB_DIRS($ac_cv_ruby_libs)`" + for var_name in arch archdir CC LDSHARED DLEXT LIBS LIBRUBYARG \ + rubyhdrdir rubyarchhdrdir sitedir sitelibdir sitearchdir libdir + do + rbconfig_tmp=`$rbconfig "print RbConfig::CONFIG@<:@'$var_name'@:>@"` + eval "rbconfig_$var_name=\"$rbconfig_tmp\"" + done + + AC_MSG_NOTICE([Configuring Ruby SWIG binding]) + + 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" + if test -d "$rbconfig_rubyarchhdrdir"; then + dnl Ruby >=2.0 + svn_cv_ruby_includes="$svn_cv_ruby_includes -I$rbconfig_rubyarchhdrdir" + else + svn_cv_ruby_includes="$svn_cv_ruby_includes -I$rbconfig_rubyhdrdir/$rbconfig_arch" + fi + else + dnl Ruby 1.8 + svn_cv_ruby_includes="-I. -I$rbconfig_archdir" + fi + ]) + SWIG_RB_INCLUDES="\$(SWIG_INCLUDES) $svn_cv_ruby_includes" - AC_MSG_CHECKING([for rb_errinfo]) - old_CFLAGS="$CFLAGS" - old_LIBS="$LIBS" - CFLAGS="$CFLAGS $svn_cv_ruby_includes" - SVN_STRIP_FLAG([CFLAGS], [-ansi]) - SVN_STRIP_FLAG([CFLAGS], [-std=c89]) - SVN_STRIP_FLAG([CFLAGS], [-std=c90]) - LIBS="$SWIG_RB_LIBS" - AC_LINK_IFELSE([AC_LANG_SOURCE([[ + AC_CACHE_CHECK([how to compile Ruby extensions], [svn_cv_ruby_compile],[ + svn_cv_ruby_compile="$rbconfig_CC $CFLAGS" + ]) + SWIG_RB_COMPILE="$svn_cv_ruby_compile" + SVN_STRIP_FLAG([SWIG_RB_COMPILE], [-ansi]) + SVN_STRIP_FLAG([SWIG_RB_COMPILE], [-std=c89]) + SVN_STRIP_FLAG([SWIG_RB_COMPILE], [-std=c90]) + dnl FIXME: Check that the compiler for Ruby actually supports this flag + SWIG_RB_COMPILE="$SWIG_RB_COMPILE -Wno-int-to-pointer-cast" + + AC_CACHE_CHECK([how to link Ruby extensions], [svn_cv_ruby_link],[ + svn_cv_ruby_link="`$SWIG_RB_RUBY -e 'ARGV.shift; print ARGV.join(%q( ))' \ + $rbconfig_LDSHARED`" + svn_cv_ruby_link="$rbconfig_CC $svn_cv_ruby_link" + svn_cv_ruby_link="$svn_cv_ruby_link -shrext .$rbconfig_DLEXT" + ]) + SWIG_RB_LINK="$svn_cv_ruby_link" + + AC_CACHE_CHECK([how to link Ruby libraries], [ac_cv_ruby_libs], [ + ac_cv_ruby_libs="$rbconfig_LIBRUBYARG $rbconfig_LIBS" + ]) + SWIG_RB_LIBS="`SVN_REMOVE_STANDARD_LIB_DIRS($ac_cv_ruby_libs)`" + + AC_MSG_CHECKING([for rb_errinfo]) + old_CFLAGS="$CFLAGS" + old_LIBS="$LIBS" + CFLAGS="$CFLAGS $svn_cv_ruby_includes" + SVN_STRIP_FLAG([CFLAGS], [-ansi]) + SVN_STRIP_FLAG([CFLAGS], [-std=c89]) + SVN_STRIP_FLAG([CFLAGS], [-std=c90]) + LIBS="$SWIG_RB_LIBS" + AC_LINK_IFELSE([AC_LANG_SOURCE([[ #include <ruby.h> int main() {rb_errinfo();}]])], have_rb_errinfo="yes", have_rb_errinfo="no") - if test "$have_rb_errinfo" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_RB_ERRINFO], [1], - [Define to 1 if you have the `rb_errinfo' function.]) - else - AC_MSG_RESULT([no]) - fi - CFLAGS="$old_CFLAGS" - LIBS="$old_LIBS" - - AC_CACHE_VAL([svn_cv_ruby_sitedir],[ - svn_cv_ruby_sitedir="$rbconfig_sitedir" - ]) - AC_ARG_WITH([ruby-sitedir], - AS_HELP_STRING([--with-ruby-sitedir=SITEDIR], - [install Ruby bindings in SITEDIR - (default is same as ruby's one)]), - [svn_ruby_installdir="$withval"], - [svn_ruby_installdir="$svn_cv_ruby_sitedir"]) - - AC_MSG_CHECKING([where to install Ruby scripts]) - AC_CACHE_VAL([svn_cv_ruby_sitedir_libsuffix],[ - svn_cv_ruby_sitedir_libsuffix="`echo "$rbconfig_sitelibdir" | \ - $SED -e "s,^$rbconfig_sitedir,,"`" - ]) - SWIG_RB_SITE_LIB_DIR="${svn_ruby_installdir}${svn_cv_ruby_sitedir_libsuffix}" - AC_MSG_RESULT([$SWIG_RB_SITE_LIB_DIR]) + if test "$have_rb_errinfo" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_RB_ERRINFO], [1], + [Define to 1 if you have the `rb_errinfo' function.]) + else + AC_MSG_RESULT([no]) + fi + CFLAGS="$old_CFLAGS" + LIBS="$old_LIBS" - AC_MSG_CHECKING([where to install Ruby extensions]) - AC_CACHE_VAL([svn_cv_ruby_sitedir_archsuffix],[ - svn_cv_ruby_sitedir_archsuffix="`echo "$rbconfig_sitearchdir" | \ - $SED -e "s,^$rbconfig_sitedir,,"`" - ]) - SWIG_RB_SITE_ARCH_DIR="${svn_ruby_installdir}${svn_cv_ruby_sitedir_archsuffix}" - AC_MSG_RESULT([$SWIG_RB_SITE_ARCH_DIR]) + AC_CACHE_VAL([svn_cv_ruby_sitedir],[ + svn_cv_ruby_sitedir="$rbconfig_sitedir" + ]) + AC_ARG_WITH([ruby-sitedir], + AS_HELP_STRING([--with-ruby-sitedir=SITEDIR], + [install Ruby bindings in SITEDIR + (default is same as ruby's one)]), + [svn_ruby_installdir="$withval"], + [svn_ruby_installdir="$svn_cv_ruby_sitedir"]) + + AC_MSG_CHECKING([where to install Ruby scripts]) + AC_CACHE_VAL([svn_cv_ruby_sitedir_libsuffix],[ + svn_cv_ruby_sitedir_libsuffix="`echo "$rbconfig_sitelibdir" | \ + $SED -e "s,^$rbconfig_sitedir,,"`" + ]) + SWIG_RB_SITE_LIB_DIR="${svn_ruby_installdir}${svn_cv_ruby_sitedir_libsuffix}" + AC_MSG_RESULT([$SWIG_RB_SITE_LIB_DIR]) + + AC_MSG_CHECKING([where to install Ruby extensions]) + AC_CACHE_VAL([svn_cv_ruby_sitedir_archsuffix],[ + svn_cv_ruby_sitedir_archsuffix="`echo "$rbconfig_sitearchdir" | \ + $SED -e "s,^$rbconfig_sitedir,,"`" + ]) + SWIG_RB_SITE_ARCH_DIR="${svn_ruby_installdir}${svn_cv_ruby_sitedir_archsuffix}" + AC_MSG_RESULT([$SWIG_RB_SITE_ARCH_DIR]) + + AC_MSG_CHECKING([how to use output level for Ruby bindings tests]) + AC_CACHE_VAL([svn_cv_ruby_test_verbose],[ + svn_cv_ruby_test_verbose="normal" + ]) + AC_ARG_WITH([ruby-test-verbose], + AS_HELP_STRING([--with-ruby-test-verbose=LEVEL], + [how to use output level for Ruby bindings tests + (default is normal)]), + [svn_ruby_test_verbose="$withval"], + [svn_ruby_test_verbose="$svn_cv_ruby_test_verbose"]) + SWIG_RB_TEST_VERBOSE="$svn_ruby_test_verbose" + AC_MSG_RESULT([$SWIG_RB_TEST_VERBOSE]) - AC_MSG_CHECKING([how to use output level for Ruby bindings tests]) - AC_CACHE_VAL([svn_cv_ruby_test_verbose],[ - svn_cv_ruby_test_verbose="normal" - ]) - AC_ARG_WITH([ruby-test-verbose], - AS_HELP_STRING([--with-ruby-test-verbose=LEVEL], - [how to use output level for Ruby bindings tests - (default is normal)]), - [svn_ruby_test_verbose="$withval"], - [svn_ruby_test_verbose="$svn_cv_ruby_test_verbose"]) - SWIG_RB_TEST_VERBOSE="$svn_ruby_test_verbose" - AC_MSG_RESULT([$SWIG_RB_TEST_VERBOSE]) - fi + 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) @@ -314,4 +592,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) ])
Modified: subversion/branches/multi-wc-format/build/ac-macros/utf8proc.m4 URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/build/ac-macros/utf8proc.m4?rev=1897034&r1=1897033&r2=1897034&view=diff ============================================================================== --- subversion/branches/multi-wc-format/build/ac-macros/utf8proc.m4 (original) +++ subversion/branches/multi-wc-format/build/ac-macros/utf8proc.m4 Fri Jan 14 14:01:45 2022 @@ -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) Propchange: subversion/branches/multi-wc-format/build/ac-macros/utf8proc.m4 ------------------------------------------------------------------------------ svn:eol-style = native Modified: subversion/branches/multi-wc-format/build/buildcheck.sh URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/build/buildcheck.sh?rev=1897034&r1=1897033&r2=1897034&view=diff ============================================================================== --- subversion/branches/multi-wc-format/build/buildcheck.sh (original) +++ subversion/branches/multi-wc-format/build/buildcheck.sh Fri Jan 14 14:01:45 2022 @@ -76,26 +76,12 @@ fi echo "buildcheck: autoheader version $ah_version (ok)" #-------------------------------------------------------------------------- -# libtool 1.4 or newer +# libtool 2.0 or newer # -LIBTOOL_WANTED_MAJOR=1 -LIBTOOL_WANTED_MINOR=4 +LIBTOOL_WANTED_MAJOR=2 +LIBTOOL_WANTED_MINOR=0 LIBTOOL_WANTED_PATCH= -LIBTOOL_WANTED_VERSION=1.4 - -# The minimum version for source releases is 1.4.3, -# because it's required by (at least) Solaris. -if test "$VERSION_CHECK" = "--release"; then - LIBTOOL_WANTED_PATCH=3 - LIBTOOL_WANTED_VERSION=1.4.3 -else - case `uname -sr` in - SunOS\ 5.*) - LIBTOOL_WANTED_PATCH=3 - LIBTOOL_WANTED_VERSION=1.4.3 - ;; - esac -fi +LIBTOOL_WANTED_VERSION=2.0 # Much like APR except we do not prefer libtool 1 over libtool 2. libtoolize=${LIBTOOLIZE:-`./build/PrintPath glibtoolize libtoolize glibtoolize1 libtoolize15 libtoolize14`} Modified: subversion/branches/multi-wc-format/build/generator/gen_base.py URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/build/generator/gen_base.py?rev=1897034&r1=1897033&r2=1897034&view=diff ============================================================================== --- subversion/branches/multi-wc-format/build/generator/gen_base.py (original) +++ subversion/branches/multi-wc-format/build/generator/gen_base.py Fri Jan 14 14:01:45 2022 @@ -663,7 +663,7 @@ class TargetExe(TargetLinked): TargetLinked.add_dependencies(self) # collect test programs - if 'svnauthz' in self.name: # special case + if 'svnauthz' in self.name or 'svnmover' in self.name: # special case self.gen_obj.test_deps.append(self.filename) self.gen_obj.test_helpers.append(self.filename) elif self.install == 'test': @@ -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 Modified: subversion/branches/multi-wc-format/build/generator/gen_make.py URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/build/generator/gen_make.py?rev=1897034&r1=1897033&r2=1897034&view=diff ============================================================================== --- subversion/branches/multi-wc-format/build/generator/gen_make.py (original) +++ subversion/branches/multi-wc-format/build/generator/gen_make.py Fri Jan 14 14:01:45 2022 @@ -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])) ######################################## @@ -445,7 +447,7 @@ class Generator(gen_base.GeneratorBase): ### we should turn AREA into an object, then test it instead of this if area[:5] == 'swig-' and area[-4:] != '-lib' \ or area[:7] == 'javahl-' \ - or area[:6] == 'cxxhl-' \ + or area[:6] == 'svnxx-' \ or area == 'tools': ezt_area.extra_install = 'yes' @@ -509,6 +511,9 @@ class Generator(gen_base.GeneratorBase): standalone.write('top_srcdir = .\n') standalone.write('top_builddir = .\n') standalone.write('SWIG = swig\n') + swig_py_opts = os.environ.get('SWIG_PY_OPTS', + '-python -py3 -nofastunpack -modern') + standalone.write('SWIG_PY_OPTS = %s\n' % (swig_py_opts)) standalone.write('PYTHON = ' + sys.executable + '\n') standalone.write('\n') standalone.write(open("build-outputs.mk","r").read()) @@ -633,9 +638,10 @@ DIR=`pwd` lib_deps=[], lib_required=[], lib_required_private=[], + version=self.version, ) - # libsvn_foo -> -lsvn_foo - data.lib_deps.append('-l%s' % lib_name.replace('lib', '', 1)) + # libsvn_foo -> -lsvn_foo-1 + data.lib_deps.append('-l%s-%s' % (lib_name.replace('lib', '', 1), data.version)) for lib_dep in lib_deps.split(): if lib_dep == 'apriconv': # apriconv is part of apr-util, skip it Modified: subversion/branches/multi-wc-format/build/generator/gen_vcnet_vcproj.py URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/build/generator/gen_vcnet_vcproj.py?rev=1897034&r1=1897033&r2=1897034&view=diff ============================================================================== --- subversion/branches/multi-wc-format/build/generator/gen_vcnet_vcproj.py (original) +++ subversion/branches/multi-wc-format/build/generator/gen_vcnet_vcproj.py Fri Jan 14 14:01:45 2022 @@ -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) @@ -283,3 +286,11 @@ class Generator(gen_win.WinGeneratorBase } self.write_with_template('subversion_vcnet.sln', 'templates/vcnet_sln.ezt', data) + + def quote_define(self, value): + "Properly quote special characters in a define (if needed)" + + if self.vcproj_extension == '.vcproj': + return value.replace('"', '""') + else: + return value Modified: subversion/branches/multi-wc-format/build/generator/gen_win.py URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/build/generator/gen_win.py?rev=1897034&r1=1897033&r2=1897034&view=diff ============================================================================== --- subversion/branches/multi-wc-format/build/generator/gen_win.py (original) +++ subversion/branches/multi-wc-format/build/generator/gen_win.py Fri Jan 14 14:01:45 2022 @@ -128,7 +128,7 @@ class WinGeneratorBase(gen_win_dependenc # VC 2002 and VC 2003 only allow a single platform per project file if subdir == 'vcnet-vcproj': if self.vcproj_version != '7.00' and self.vcproj_version != '7.10': - self.platforms = ['Win32','x64'] + self.platforms = ['Win32', 'x64', 'ARM64'] #Here we can add additional modes to compile for self.configs = ['Debug','Release'] @@ -158,6 +158,13 @@ class WinGeneratorBase(gen_win_dependenc ### 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], @@ -736,9 +743,14 @@ class WinGeneratorBase(gen_win_dependenc if target.name.endswith('svn_subr'): fakedefines.append("SVN_USE_WIN32_CRASHHANDLER") + fakedefines.append(self.quote_define('SVN_WIN32_CRASHREPORT_EMAIL="[email protected]"')) return fakedefines + def quote_define(self, value): + "Properly quote special characters in a define (if needed)" + return value + def get_win_includes(self, target, cfg='Release'): "Return the list of include directories for target" @@ -773,13 +785,17 @@ class WinGeneratorBase(gen_win_dependenc 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)) fakeincludes.append(self.swig_libdir) - if 'cxxhl' in target.name: - fakeincludes.append("subversion/bindings/cxxhl/include") + if 'svnxx' in target.name: + fakeincludes.append("subversion/bindings/cxx/include") return gen_base.unique(map(self.apath, fakeincludes)) Modified: subversion/branches/multi-wc-format/build/generator/gen_win_dependencies.py URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/build/generator/gen_win_dependencies.py?rev=1897034&r1=1897033&r2=1897034&view=diff ============================================================================== --- subversion/branches/multi-wc-format/build/generator/gen_win_dependencies.py (original) +++ subversion/branches/multi-wc-format/build/generator/gen_win_dependencies.py Fri Jan 14 14:01:45 2022 @@ -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.Gener 'swig', 'perl', 'python', + 'py3c', 'ruby', 'java_sdk', 'openssl', @@ -124,6 +128,8 @@ class GenDependenciesBase(gen_base.Gener # So optional, we don't even have any code to detect them on Windows 'magic', + 'macos-plist', + 'macos-keychain', ] # When build.conf contains a 'when = SOMETHING' where SOMETHING is not in @@ -146,6 +152,7 @@ class GenDependenciesBase(gen_base.Gener 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' @@ -161,10 +168,12 @@ class GenDependenciesBase(gen_base.Gener self.disable_shared = None self.static_apr = None self.static_openssl = None + self.shared_serf = None self.instrument_apr_pools = None self.instrument_purify_quantify = None self.sasl_path = None self.cpp_defines = [] + self.user_macros = [] # NLS options self.enable_nls = None @@ -196,6 +205,8 @@ class GenDependenciesBase(gen_base.Gener 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': @@ -215,8 +226,12 @@ class GenDependenciesBase(gen_base.Gener self.disable_shared = 1 elif opt == '--with-static-apr': self.static_apr = 1 + self.shared_serf = 0 # Can't mix apr versions elif opt == '--with-static-openssl': self.static_openssl = 1 + elif opt == '--with-shared-serf': + if not self.static_apr: + self.shared_serf = 1 elif opt == '-D': self.cpp_defines.append(val) elif opt == '--vsnet-version': @@ -265,6 +280,11 @@ class GenDependenciesBase(gen_base.Gener self.sln_version = '12.00' self.vcproj_version = '14.1' self.vcproj_extension = '.vcxproj' + elif val == '2019' or val == '16': + self.vs_version = '2019' + self.sln_version = '12.00' + self.vcproj_version = '14.2' + self.vcproj_extension = '.vcxproj' elif re.match('^20\d+$', val): print('WARNING: Unknown VS.NET version "%s",' ' assuming VS2012. Your VS can probably upgrade') @@ -322,13 +342,15 @@ class GenDependenciesBase(gen_base.Gener # 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, 4, 0) if not self.apr_path: sys.stderr.write("ERROR: Use '--with-apr' option to configure APR " + \ @@ -574,9 +596,14 @@ class GenDependenciesBase(gen_base.Gener # apr-Util 0.9-1.4 compiled expat to 'xml.lib', but apr-util 1.5 switched # to the more common 'libexpat.lib' - libname = 'libexpat.lib' - if not os.path.exists(os.path.join(lib_dir, 'libexpat.lib')): - libname = 'xml.lib' + if os.path.exists(os.path.join(lib_dir, 'libexpat.lib')): + # Shared or completely static build + libname = 'libexpat.lib' + elif os.path.exists(os.path.join(lib_dir, 'libexpatMD.lib')): + # libexpat CMake build. static build against Multithreaded DLL CRT + libname = 'libexpatMD.lib' + else: + libname = 'xml.lib' version = (major, minor, patch) xml_version = '%d.%d.%d' % version @@ -763,7 +790,7 @@ class GenDependenciesBase(gen_base.Gener 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') @@ -1020,9 +1047,64 @@ class GenDependenciesBase(gen_base.Gener except ImportError: return + if sys.version_info[0] >= 3: + if self.swig_version < (3, 0, 10): + if show_warnings: + print("WARNING: Subversion Python bindings for Python 3 require SWIG 3.0.10 or newer") + return + if self.swig_version < (4, 0, 0): + opts = "-python -py3 -nofastunpack -modern" + else: + opts = "-python -py3 -nofastunpack" + else: + if not ((1, 3, 24) <= self.swig_version < (4, 0, 0)): + if show_warnings: + print("WARNING: Subversion Python bindings for Python 2 require 1.3.24 <= SWIG < 4.0.0") + return + opts = "-python -classic" + + self.user_macros.append(UserMacro("SWIG_PY_OPTS", opts)) 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" @@ -1073,7 +1155,7 @@ class GenDependenciesBase(gen_base.Gener 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: @@ -1131,7 +1213,7 @@ class GenDependenciesBase(gen_base.Gener 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: @@ -1159,7 +1241,7 @@ class GenDependenciesBase(gen_base.Gener 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 @@ -1262,6 +1344,9 @@ class GenDependenciesBase(gen_base.Gener lib_name = 'serf-%d.lib' % (serf_ver_maj,) else: lib_name = 'serf.lib' + + if self.shared_serf: + lib_name = 'lib' + lib_name defines = ['SVN_HAVE_SERF', 'SVN_LIBSVN_RA_LINKS_RA_SERF'] Modified: subversion/branches/multi-wc-format/build/generator/swig/__init__.py URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/build/generator/swig/__init__.py?rev=1897034&r1=1897033&r2=1897034&view=diff ============================================================================== --- subversion/branches/multi-wc-format/build/generator/swig/__init__.py (original) +++ subversion/branches/multi-wc-format/build/generator/swig/__init__.py Fri Jan 14 14:01:45 2022 @@ -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())) Modified: subversion/branches/multi-wc-format/build/generator/swig/header_wrappers.py URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/build/generator/swig/header_wrappers.py?rev=1897034&r1=1897033&r2=1897034&view=diff ============================================================================== --- subversion/branches/multi-wc-format/build/generator/swig/header_wrappers.py (original) +++ subversion/branches/multi-wc-format/build/generator/swig/header_wrappers.py Fri Jan 14 14:01:45 2022 @@ -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') Modified: subversion/branches/multi-wc-format/build/generator/templates/build-outputs.mk.ezt URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/build/generator/templates/build-outputs.mk.ezt?rev=1897034&r1=1897033&r2=1897034&view=diff ============================================================================== --- subversion/branches/multi-wc-format/build/generator/templates/build-outputs.mk.ezt (original) +++ subversion/branches/multi-wc-format/build/generator/templates/build-outputs.mk.ezt Fri Jan 14 14:01:45 2022 @@ -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] Modified: subversion/branches/multi-wc-format/build/generator/templates/pkg-config.in.ezt URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/build/generator/templates/pkg-config.in.ezt?rev=1897034&r1=1897033&r2=1897034&view=diff ============================================================================== --- subversion/branches/multi-wc-format/build/generator/templates/pkg-config.in.ezt (original) +++ subversion/branches/multi-wc-format/build/generator/templates/pkg-config.in.ezt Fri Jan 14 14:01:45 2022 @@ -6,7 +6,7 @@ includedir=@includedir@ Name: [lib_name] Description: [lib_desc] Version: @PACKAGE_VERSION@ -Requires: [for lib_required] [lib_required][end] -Requires.private: [for lib_required_private] [lib_required_private][end] +Requires: [for lib_required][if-index lib_required first][else], [end][lib_required][end] +Requires.private: [for lib_required_private][if-index lib_required_private first][else], [end][lib_required_private][end] Libs: -L${libdir} [for lib_deps] [lib_deps][end] -Cflags: -I${includedir} +Cflags: -I${includedir}/subversion-[version] Modified: subversion/branches/multi-wc-format/build/generator/templates/vcnet_vcproj.ezt URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/build/generator/templates/vcnet_vcproj.ezt?rev=1897034&r1=1897033&r2=1897034&view=diff ============================================================================== --- subversion/branches/multi-wc-format/build/generator/templates/vcnet_vcproj.ezt (original) +++ subversion/branches/multi-wc-format/build/generator/templates/vcnet_vcproj.ezt Fri Jan 14 14:01:45 2022 @@ -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]" Modified: subversion/branches/multi-wc-format/build/generator/templates/vcnet_vcxproj.ezt URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/build/generator/templates/vcnet_vcxproj.ezt?rev=1897034&r1=1897033&r2=1897034&view=diff ============================================================================== --- subversion/branches/multi-wc-format/build/generator/templates/vcnet_vcxproj.ezt (original) +++ subversion/branches/multi-wc-format/build/generator/templates/vcnet_vcxproj.ezt Fri Jan 14 14:01:45 2022 @@ -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> @@ -59,16 +61,16 @@ <IntrinsicFunctions>true</IntrinsicFunctions> [end] <AdditionalIncludeDirectories>$(SolutionDir)[configs.name];[for configs.includes][configs.includes];[end]%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <StringPooling>true</StringPooling> - <PreprocessorDefinitions>[if-any instrument_apr_pools]APR_POOL_DEBUG=[instrument_apr_pools];[end][is platforms "x64"]WIN64;[end][for configs.defines][configs.defines];[end]%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>[if-any instrument_apr_pools]APR_POOL_DEBUG=[instrument_apr_pools];[end][is platforms "x64"]WIN64;[end][is platforms "ARM64"]WIN64;[end][for configs.defines][configs.defines];[end]%(PreprocessorDefinitions)</PreprocessorDefinitions> <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> <AdditionalIncludeDirectories>[for configs.includes][configs.includes];[end]%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>SVN_FILE_NAME=[target.output_name];SVN_FILE_DESCRIPTION=[target.desc];[is platforms "x64"]WIN64;[end][for configs.defines][configs.defines];[end]%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>SVN_FILE_NAME=[target.output_name];SVN_FILE_DESCRIPTION=[target.desc];[is platforms "x64"]WIN64;[end][is platforms "ARM64"]WIN64;[end][for configs.defines][configs.defines];[end]%(PreprocessorDefinitions)</PreprocessorDefinitions> </ResourceCompile> [is config_type "Application"] <Link> <AdditionalDependencies>[for configs.libs][configs.libs];[end]%(AdditionalDependencies)</AdditionalDependencies> @@ -90,7 +92,7 @@ [if-any def_file] <ModuleDefinitionFile>[def_file]</ModuleDefinitionFile> [end] </Link> [else][is config_type "StaticLibrary"] <Lib> - <TargetMachine>[is platforms "X64"]MachineX64[else]MachineX86[end]</TargetMachine> + <TargetMachine>[is platforms "X64"]MachineX64[else][is platforms "ARM64"]MachineARM64[else]MachineX86[end][end]</TargetMachine> [is configs.name "Debug"] <IgnoreSpecificDefaultLibraries>msvcrt.lib</IgnoreSpecificDefaultLibraries> [end] </Lib> [end][end][end] </ItemDefinitionGroup> Modified: subversion/branches/multi-wc-format/build/get-py-info.py URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/build/get-py-info.py?rev=1897034&r1=1897033&r2=1897034&view=diff ============================================================================== --- subversion/branches/multi-wc-format/build/get-py-info.py (original) +++ subversion/branches/multi-wc-format/build/get-py-info.py Fri Jan 14 14:01:45 2022 @@ -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"), Modified: subversion/branches/multi-wc-format/build/run_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/build/run_tests.py?rev=1897034&r1=1897033&r2=1897034&view=diff ============================================================================== --- subversion/branches/multi-wc-format/build/run_tests.py (original) +++ subversion/branches/multi-wc-format/build/run_tests.py Fri Jan 14 14:01:45 2022 @@ -34,6 +34,7 @@ [--config-file=<file>] [--ssl-cert=<file>] [--exclusive-wc-locks] [--memcached-server=<url:port>] [--fsfs-compression=<type>] [--fsfs-dir-deltification=<true|false>] + [--allow-remote-http-connection] <abs_srcdir> <abs_builddir> <prog ...> @@ -46,10 +47,10 @@ and filename of a test program, optional separated list of test numbers; the default is to run all the tests in it. ''' -import os, sys, shutil, codecs +import os, sys, shutil import re import logging -import optparse, subprocess, imp, threading, traceback +import optparse, subprocess, threading, traceback from datetime import datetime try: @@ -63,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' @@ -83,6 +91,29 @@ class TextColors: cls.SUCCESS = '' +if hasattr(subprocess.Popen, '__enter__'): + Popen = subprocess.Popen +else: + class Popen(subprocess.Popen): + """Popen objects are supported as context managers since Python 3.2. + This class provides backwards-compatibility with Python 2. + """ + + def __enter__(self): + return self + + def __exit__(self, type, value, traceback): + if self.stdout: + self.stdout.close() + if self.stderr: + self.stderr.close() + try: + if self.stdin: + self.stdin.close() + finally: + self.wait() + + def _get_term_width(): 'Attempt to discern the width of the terminal' # This may not work on all platforms, in which case the default of 80 @@ -133,6 +164,18 @@ def ensure_str(s): else: return s.decode("latin-1") +def open_logfile(filename, mode, encoding='utf-8'): + if sys.version_info[0] != 2: + return open(filename, mode, encoding=encoding, errors='surrogateescape') + else: + class Wrapper(object): + def __init__(self, stream, encoding): + self._stream = stream + self.encoding = encoding + def __getattr__(self, name): + return getattr(self._stream, name) + return Wrapper(open(filename, mode), encoding) + class TestHarness: '''Test harness for Subversion tests. ''' @@ -195,8 +238,9 @@ class TestHarness: authzparent = os.path.join(self.builddir, subdir) if not os.path.exists(authzparent): os.makedirs(authzparent); - open(os.path.join(authzparent, 'authz'), 'w').write('[/]\n' - '* = rw\n') + with open(os.path.join(authzparent, 'authz'), 'w') as fp: + fp.write('[/]\n' + '* = rw\n') # ### Support --repos-template if self.opts.list_tests is not None: @@ -280,6 +324,8 @@ class TestHarness: cmdline.append('--fsfs-compression=%s' % self.opts.fsfs_compression) if self.opts.fsfs_dir_deltification is not None: cmdline.append('--fsfs-dir-deltification=%s' % self.opts.fsfs_dir_deltification) + if self.opts.allow_remote_http_connection is not None: + cmdline.append('--allow-remote-http-connection') self.py_test_cmdline = cmdline @@ -341,15 +387,15 @@ class TestHarness: def execute(self, harness): start_time = datetime.now() - prog = subprocess.Popen(self._command_line(harness), - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - cwd=self.progdir) - - self.stdout_lines = prog.stdout.readlines() - self.stderr_lines = prog.stderr.readlines() - prog.wait() - self.result = prog.returncode + with Popen(self._command_line(harness), + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + cwd=self.progdir) as prog: + + self.stdout_lines = prog.stdout.readlines() + self.stderr_lines = prog.stderr.readlines() + prog.wait() + self.result = prog.returncode self.taken = datetime.now() - start_time class CollectingThread(threading.Thread): @@ -367,22 +413,20 @@ class TestHarness: def _count_c_tests(self, progabs, progdir, progbase): 'Run a c test, escaping parameters as required.' cmdline = [ progabs, '--list' ] - prog = subprocess.Popen(cmdline, stdout=subprocess.PIPE, cwd=progdir) - lines = prog.stdout.readlines() - self.result.append(TestHarness.Job(len(lines) - 2, False, progabs, - progdir, progbase)) - prog.wait() + with Popen(cmdline, stdout=subprocess.PIPE, cwd=progdir) as prog: + lines = prog.stdout.readlines() + self.result.append(TestHarness.Job(len(lines) - 2, False, progabs, + progdir, progbase)) def _count_py_tests(self, progabs, progdir, progbase): 'Run a c test, escaping parameters as required.' cmdline = [ sys.executable, progabs, '--list' ] - prog = subprocess.Popen(cmdline, stdout=subprocess.PIPE, cwd=progdir) - lines = prog.stdout.readlines() + with Popen(cmdline, stdout=subprocess.PIPE, cwd=progdir) as prog: + lines = prog.stdout.readlines() - for i in range(0, len(lines) - 2): - self.result.append(TestHarness.Job(i + 1, True, progabs, - progdir, progbase)) - prog.wait() + for i in range(0, len(lines) - 2): + self.result.append(TestHarness.Job(i + 1, True, progabs, + progdir, progbase)) def run(self): "Run a single test. Return the test's exit code." @@ -690,7 +734,7 @@ class TestHarness: # Copy the truly interesting verbose logs to a separate file, for easier # viewing. if xpassed or failed_list: - faillog = codecs.open(self.faillogfile, 'w', encoding="latin-1") + faillog = open_logfile(self.faillogfile, 'w') last_start_lineno = None last_start_re = re.compile('^(FAIL|SKIP|XFAIL|PASS|START|CLEANUP|END):') for lineno, line in enumerate(log_lines): @@ -710,9 +754,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 @@ -721,7 +767,7 @@ class TestHarness: 'Open the log file with the required MODE.' if self.logfile: self._close_log() - self.log = codecs.open(self.logfile, mode, encoding="latin-1") + self.log = open_logfile(self.logfile, mode) def _close_log(self): 'Close the log file.' @@ -775,8 +821,8 @@ class TestHarness: total = len(test_nums) else: total_cmdline = [cmdline[0], '--list'] - prog = subprocess.Popen(total_cmdline, stdout=subprocess.PIPE) - lines = prog.stdout.readlines() + with Popen(total_cmdline, stdout=subprocess.PIPE) as prog: + lines = prog.stdout.readlines() total = len(lines) - 2 # This has to be class-scoped for use in the progress_func() @@ -792,23 +838,22 @@ class TestHarness: self.dots_written = dots tests_completed = 0 - prog = subprocess.Popen(cmdline, stdout=subprocess.PIPE, - stderr=self.log) - line = prog.stdout.readline() - while line: - line = ensure_str(line) - if self._process_test_output_line(line): - tests_completed += 1 - progress_func(tests_completed) - + with Popen(cmdline, stdout=subprocess.PIPE, stderr=self.log) as prog: line = prog.stdout.readline() + while line: + line = ensure_str(line) + if self._process_test_output_line(line): + tests_completed += 1 + progress_func(tests_completed) + + line = prog.stdout.readline() + + # If we didn't run any tests, still print out the dots + if not tests_completed: + os.write(sys.stdout.fileno(), b'.' * dot_count) - # If we didn't run any tests, still print out the dots - if not tests_completed: - os.write(sys.stdout.fileno(), b'.' * dot_count) - - prog.wait() - return prog.returncode + prog.wait() + return prog.returncode def _run_py_test(self, progabs, progdir, progbase, test_nums, dot_count): 'Run a python test, passing parameters as needed.' @@ -816,24 +861,28 @@ 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() sys.exit(1) # setup the output pipes + old_stdout = sys.stdout.fileno() if self.log: sys.stdout.flush() sys.stderr.flush() self.log.flush() - old_stdout = os.dup(sys.stdout.fileno()) - old_stderr = os.dup(sys.stderr.fileno()) - os.dup2(self.log.fileno(), sys.stdout.fileno()) - os.dup2(self.log.fileno(), sys.stderr.fileno()) + saved_stds = sys.stdout, sys.stderr + sys.stdout = sys.stderr = self.log # These have to be class-scoped for use in the progress_func() self.dots_written = 0 @@ -874,12 +923,8 @@ class TestHarness: # restore some values if self.log: - sys.stdout.flush() - sys.stderr.flush() - os.dup2(old_stdout, sys.stdout.fileno()) - os.dup2(old_stderr, sys.stderr.fileno()) - os.close(old_stdout) - os.close(old_stderr) + self.log.flush() + sys.stdout, sys.stderr = saved_stds return failed @@ -1033,6 +1078,8 @@ def create_parser(): help='Set compression type (for fsfs)') parser.add_option('--fsfs-dir-deltification', action='store', type='str', help='Set directory deltification option (for fsfs)') + parser.add_option('--allow-remote-http-connection', action='store_true', + help='Run tests that connect to remote HTTP(S) servers') parser.set_defaults(set_log_level=None) return parser
