diff --git a/.github/posix-prepare.sh b/.github/posix-prepare.sh index 81c0fafb1e..279f779eb8 100755 --- a/.github/posix-prepare.sh +++ b/.github/posix-prepare.sh @@ -14,11 +14,19 @@ build_svnpy() { sudo apt-get install -qq -y libsvn-dev libapr1-dev libaprutil1-dev liblz4-dev libutf8proc-dev with_apr=/usr/bin/apr-1-config with_apr_util=/usr/bin/apu-1-config + with_lz4=std + with_utf8proc=std + cflags='' + ldflags='' ;; macos-*) - brew install apr apr-util lz4 utf8proc + brew install -q apr apr-util lz4 utf8proc with_apr="$(brew --prefix apr)/bin/apr-1-config" with_apr_util="$(brew --prefix apr-util)/bin/apu-1-config" + with_lz4="$(brew --prefix lz4)" + with_utf8proc="$(brew --prefix utf8proc)" + cflags="$(pkg-config --cflags-only-I libsvn_subr)" + ldflags="$(pkg-config --libs-only-L libsvn_subr)" ;; esac installed_libs="$(pkg-config --list-all | @@ -26,6 +34,15 @@ build_svnpy() { sort | tr '\n' ',' | sed -e 's/,$//')" + if grep -q 'with-swig-python' configure; then + opt_swig_python="--with-swig-python=$python" + opt_swig_perl='--without-swig-perl' + opt_swig_ruby='--without-swig-ruby' + else + opt_swig_python="PYTHON=$python" + opt_swig_perl='PERL=none' + opt_swig_ruby='RUBY=none' + fi test -d "$HOME/arc" || mkdir "$HOME/arc" curl -s -o "$svntarball" "$svnurl" @@ -42,6 +59,8 @@ build_svnpy() { ./configure --prefix="$venvdir" \ --with-apr="$with_apr" \ --with-apr-util="$with_apr_util" \ + --with-lz4="$with_lz4" \ + --with-utf8proc="$with_utf8proc" \ --with-py3c="$GITHUB_WORKSPACE/py3c" \ --without-apxs \ --without-doxygen \ @@ -50,9 +69,12 @@ build_svnpy() { --without-gnome-keyring \ --without-kwallet \ --without-jdk \ - PERL=none \ - RUBY=none \ - PYTHON="$python" + "$opt_swig_python" \ + "$opt_swig_perl" \ + "$opt_swig_ruby" \ + PYTHON="$python" \ + CFLAGS="$cflags" \ + LDFLAGS="$ldflags" make -j3 swig_pydir="${sitedir}/libsvn" \ swig_pydir_extra="${sitedir}/svn" \ swig-py @@ -63,76 +85,14 @@ build_svnpy() { cd "$OLDPWD" } -init_postgresql() { - case "$MATRIX_OS" in - ubuntu-*) - sudo systemctl start postgresql.service - ;; - macos-*) - rm -rf /usr/local/var/postgres - pg_ctl initdb --pgdata /usr/local/var/postgres - pg_ctl -w start --pgdata /usr/local/var/postgres --log /usr/local/var/postgres/postgresql.log || { - echo "Exited with $?" - cat /usr/local/var/postgres/postgresql.log - exit 1 - } - createuser -s postgres - ;; - esac - { - case "$MATRIX_OS" in - ubuntu-*) - sudo -u postgres psql -e - ;; - macos-*) - psql -U postgres -e - ;; - esac - } <<_EOS_ -CREATE USER tracuser NOSUPERUSER NOCREATEDB CREATEROLE PASSWORD 'password'; -CREATE DATABASE trac OWNER tracuser; -_EOS_ -} - -init_mysql() { - case "$MATRIX_OS" in - ubuntu-*) - sudo systemctl start mysql.service - { - echo '[client]' - echo 'host = localhost' - echo 'user = root' - echo 'password = root' - } >~/.my.cnf - ;; - macos-*) - brew install mysql - mysql.server start - { - echo '[client]' - echo 'host = localhost' - echo 'user = root' - } >~/.my.cnf - ;; - esac - mysql -v <<_EOS_ -CREATE DATABASE trac DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; -CREATE USER tracuser@'%' IDENTIFIED BY 'password'; -GRANT ALL ON trac.* TO tracuser@'%'; -FLUSH PRIVILEGES; -_EOS_ -} - case "$MATRIX_OS" in ubuntu-*) sudo apt-get update -qq sudo apt-get install -qq -y subversion ;; macos-*) - HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 - export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK - brew update || : - brew install subversion + brew update -q || : + brew install -q subversion ;; esac diff --git a/.github/posix-test.sh b/.github/posix-test.sh index 46eaeeb74a..6ff9b4aedb 100755 --- a/.github/posix-test.sh +++ b/.github/posix-test.sh @@ -8,14 +8,12 @@ init_postgresql() { sudo systemctl start postgresql.service ;; macos-*) - rm -rf /usr/local/var/postgres - pg_ctl initdb --pgdata /usr/local/var/postgres - pg_ctl -w start --pgdata /usr/local/var/postgres --log /usr/local/var/postgres/postgresql.log || { - echo "Exited with $?" - cat /usr/local/var/postgres/postgresql.log - exit 1 - } - createuser -s postgres + brew install -q postgresql@14 + brew services start postgresql@14 + for i in $(seq 1 15); do + psql -U "$LOGNAME" postgres -t -c 'SELECT version()' && break + sleep 1 + done ;; esac { @@ -24,7 +22,7 @@ init_postgresql() { sudo -u postgres psql -e ;; macos-*) - psql -U postgres -e + psql -U "$LOGNAME" postgres -e ;; esac } <<_EOS_ @@ -45,7 +43,7 @@ init_mysql() { } >~/.my.cnf ;; macos-*) - brew install mysql + brew install -q mysql mysql.server start { echo '[client]' @@ -75,8 +73,11 @@ run_tests() { ( case "$MATRIX_OS" in macos-*) - LDFLAGS='-L/usr/local/opt/openssl/lib' - export LDFLAGS + brew install -q libpq openssl + PATH="$PATH:$(brew --prefix libpq)/bin" + CFLAGS="-L$(brew --prefix openssl)/include" + LDFLAGS="-L$(brew --prefix openssl)/lib" + export CFLAGS LDFLAGS ;; esac pip install -r .github/requirements.txt @@ -118,10 +119,8 @@ case "$MATRIX_OS" in sudo apt-get install -qq -y subversion ;; macos-*) - HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 - export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK - brew update || : - brew install subversion + brew update -q || : + brew install -q subversion tidy-html5 ;; esac diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dd277d62ab..4114d34186 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-22.04, macos-12] + os: [ubuntu-22.04, macos-14] python-version: ['3.12'] tests: [functional] @@ -85,11 +85,11 @@ jobs: - {os: ubuntu-22.04, python-version: '3.7', tracdb: ''} - {os: ubuntu-20.04, python-version: '3.6', tracdb: ''} - {os: ubuntu-20.04, python-version: '3.5', tracdb: ''} - - {os: macos-12, python-version: '3.12', tracdb: sqlite, tests: functional} - - {os: macos-12, python-version: '3.12', tracdb: postgresql} - - {os: macos-12, python-version: '3.12', tracdb: mysql} - - {os: macos-12, python-version: '3.12', tracdb: ''} - - {os: macos-12, python-version: '3.11', tracdb: ''} + - {os: macos-14, python-version: '3.12', tracdb: sqlite, tests: functional} + - {os: macos-14, python-version: '3.12', tracdb: postgresql} + - {os: macos-14, python-version: '3.12', tracdb: mysql} + - {os: macos-14, python-version: '3.12', tracdb: ''} + - {os: macos-14, python-version: '3.11', tracdb: ''} env: MATRIX_OS: ${{ matrix.os }} @@ -160,8 +160,8 @@ jobs: - {os: ubuntu-22.04, python-version: '3.7'} - {os: ubuntu-20.04, python-version: '3.6'} - {os: ubuntu-20.04, python-version: '3.5'} - - {os: macos-12, python-version: '3.12'} - - {os: macos-12, python-version: '3.11'} + - {os: macos-14, python-version: '3.12'} + - {os: macos-14, python-version: '3.11'} env: MATRIX_OS: ${{ matrix.os }} diff --git a/contrib/make_status.py b/contrib/make_status.py index 2e23cf8324..31ab602782 100755 --- a/contrib/make_status.py +++ b/contrib/make_status.py @@ -30,13 +30,19 @@ def _pytidylib_version(): info = 'not installed' else: import ctypes - cdll = tidy._tidy - fn = cdll.tidyLibraryVersion - fn.restype = ctypes.c_char_p - libver = fn() - if isinstance(libver, bytes): - libver = str(libver, 'utf-8') - info = '%s %s' % (libver, cdll._name) + try: + cdll = tidy._tidy + try: + fn = cdll.tidyLibraryVersion + fn.restype = ctypes.c_char_p + libver = fn() + if isinstance(libver, bytes): + libver = str(libver, 'utf-8') + except Exception as e: + libver = repr(e) + info = '%s %s' % (libver, cdll._name) + except Exception as e: + info = repr(e) return '%s (%s)' % (version, info) if info else version def _pysqlite3_version(): diff --git a/trac/tests/functional/better_twill.py b/trac/tests/functional/better_twill.py index 8d1a58e8ac..aee512b495 100755 --- a/trac/tests/functional/better_twill.py +++ b/trac/tests/functional/better_twill.py @@ -40,10 +40,16 @@ except ImportError: selenium = None + +_tidy_options = { + 'escape-scripts': 0, + 'drop-empty-elements': 0, +} _curr = locale.setlocale(locale.LC_ALL, None) try: import tidylib - tidylib.tidy_document('') + tidylib.tidy_document('', + _tidy_options) except ImportError: print("SKIP: validation of HTML output in functional tests" " (no tidylib installed)") @@ -52,6 +58,9 @@ print("SKIP: validation of HTML output in functional tests" " (no tidy dynamic library installed: %s)" % e) tidy_document = None +except ValueError as e: + print("SKIP: validation of HTML output in functional tests (%r)" % e) + tidy_document = None else: if _curr == locale.setlocale(locale.LC_ALL, None): tidy_document = tidylib.tidy_document @@ -562,11 +571,6 @@ def _urljoin(self, url): url = urljoin(self.get_url(), url) return url - _tidy_options = { - 'escape-scripts': 0, - 'drop-empty-elements': 0, - } - _doctype_re = re.compile(r'\s*