Skip to content

Commit

Permalink
1.7.1dev: merge [17845:17846] from 1.6-stable
Browse files Browse the repository at this point in the history
git-svn-id: http://trac.edgewall.org/intertrac/log:/trunk@17847 af82e41b-90c4-0310-8c96-b1721e28e2e2
  • Loading branch information
jomae committed Sep 30, 2024
2 parents 0362277 + b088f60 commit a016dd4
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 106 deletions.
96 changes: 28 additions & 68 deletions .github/posix-prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,35 @@ 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 |
sed -n '/^libsvn_/ { s/ .*$//; p; }' |
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"
Expand All @@ -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 \
Expand All @@ -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
Expand All @@ -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

Expand Down
31 changes: 15 additions & 16 deletions .github/posix-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -24,7 +22,7 @@ init_postgresql() {
sudo -u postgres psql -e
;;
macos-*)
psql -U postgres -e
psql -U "$LOGNAME" postgres -e
;;
esac
} <<_EOS_
Expand All @@ -45,7 +43,7 @@ init_mysql() {
} >~/.my.cnf
;;
macos-*)
brew install mysql
brew install -q mysql
mysql.server start
{
echo '[client]'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down
20 changes: 13 additions & 7 deletions contrib/make_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
18 changes: 11 additions & 7 deletions trac/tests/functional/better_twill.py
Original file line number Diff line number Diff line change
Expand Up @@ -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('<!DOCTYPE html><html><body></body></html>')
tidylib.tidy_document('<!DOCTYPE html><html><body></body></html>',
_tidy_options)
except ImportError:
print("SKIP: validation of HTML output in functional tests"
" (no tidylib installed)")
Expand All @@ -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
Expand Down Expand Up @@ -562,19 +571,14 @@ 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*<!DOCTYPE\b'.encode('ascii'))

def _validate_html(self, source):
if not tidy_document:
return
if not self._doctype_re.match(source):
return
corrected, errors = tidy_document(source, self._tidy_options)
corrected, errors = tidy_document(source, _tidy_options)
if errors:
errors = errors.splitlines()
url = self.write_source(source)
Expand Down

0 comments on commit a016dd4

Please sign in to comment.