Skip to content

Commit bac01fe

Browse files
authored
[#695] Update for latest Twisted. (#696)
* Update for latest Twisted. * More changes. * Update gha. * RUn macos only on m1.
1 parent d4a3dfc commit bac01fe

File tree

8 files changed

+70
-68
lines changed

8 files changed

+70
-68
lines changed

.github/workflows/bare.yml

+9-27
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ jobs:
3737
steps:
3838

3939
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
40-
- uses: actions/checkout@v3
40+
- uses: actions/checkout@v4
4141

4242
- name: Cache build
43-
uses: actions/cache@v3
43+
uses: actions/cache@v4
4444
with:
4545
path: |
4646
build-py3
@@ -79,7 +79,7 @@ jobs:
7979
# Steps represent a sequence of tasks that will be executed as part of the job
8080
steps:
8181
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
82-
- uses: actions/checkout@v3
82+
- uses: actions/checkout@v4
8383
with:
8484
fetch-depth: 2
8585

@@ -88,7 +88,7 @@ jobs:
8888
run: git log -1 --pretty=format:"%s" ${{ toJSON(github.event.after) }} | grep -v 'skip-ci'
8989

9090
- name: Cache build
91-
uses: actions/cache@v3
91+
uses: actions/cache@v4
9292
with:
9393
path: |
9494
build-py3
@@ -118,14 +118,14 @@ jobs:
118118
strategy:
119119
fail-fast: false
120120
matrix:
121-
runs-on: [ macos-11 ]
121+
runs-on: [ macos-14 ]
122122
runs-on: ${{ matrix.runs-on }}
123123
timeout-minutes: 30
124124
steps:
125-
- uses: actions/checkout@v3
125+
- uses: actions/checkout@v4
126126

127127
- name: Cache build
128-
uses: actions/cache@v3
128+
uses: actions/cache@v4
129129
with:
130130
path: |
131131
build-py3
@@ -157,24 +157,6 @@ jobs:
157157
env:
158158
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
159159

160-
161-
macos-ascii-path:
162-
strategy:
163-
fail-fast: false
164-
matrix:
165-
runs-on: [ macos-12 ]
166-
runs-on: ${{ matrix.runs-on }}
167-
timeout-minutes: 30
168-
steps:
169-
- uses: actions/checkout@v3
170-
171-
- name: Cache build
172-
uses: actions/cache@v3
173-
with:
174-
path: |
175-
build-py3
176-
key: ${{ runner.os }}-${{ hashFiles('pavement.py') }}-${{ hashFiles('pythia.conf') }}-ascii
177-
178160
- name: Deps
179161
run: |
180162
./pythia.sh deps
@@ -202,10 +184,10 @@ jobs:
202184
timeout-minutes: 120
203185

204186
steps:
205-
- uses: actions/checkout@v3
187+
- uses: actions/checkout@v4
206188

207189
- name: Cache build
208-
uses: actions/cache@v3
190+
uses: actions/cache@v4
209191
with:
210192
path: |
211193
build-py3

.github/workflows/docker.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,12 @@ jobs:
3333
fail-fast: false
3434
matrix:
3535
container:
36-
- alpine:3.18
37-
- amazonlinux:2
36+
- alpine:3.16
3837
- amazonlinux:2022
3938
- oraclelinux:8
4039
- rockylinux:9
41-
- ubuntu:18.04
4240
- ubuntu:22.04
41+
- ubuntu:24.04
4342

4443
# ubuntu-latest is GitHub's newest well-suported Linux distro.
4544
runs-on: ubuntu-latest
@@ -93,7 +92,7 @@ jobs:
9392
9493
# This action also fails on CentOS 5/6.
9594
- name: Cache build
96-
uses: actions/cache@v3
95+
uses: actions/cache@v4
9796
if: matrix.container != 'proatria/centos:5.11-chevah1' && matrix.container != 'centos:6.10'
9897
with:
9998
path: |

pavement.py

+2
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ def deps():
244244
env_ci = os.environ.get('CI', '').strip()
245245
if env_ci.lower() != 'true':
246246
dev_mode = ['-e']
247+
pave.fs.deleteFile([
248+
pave.path.build, pave.getPythonLibPath(), 'chevah-compat.egg-link'])
247249
else:
248250
print('Installing in non-dev mode.')
249251

pythia.conf

+10-13
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
BASE_REQUIREMENTS=('chevah-brink==1.0.10' 'paver==1.3.4' 'wheel')
2-
PYTHON_NAME='python3.11'
3-
PYTHON_VERSION='python3.11'
4-
PYTHON_CONFIGURATION='default@3.11.3.f9d9434'
5-
# For production packages there are 2 options:
1+
2+
PYTHON_CONFIGURATION="default@3.11.9.ba80a30"
3+
# This is defined as a Bash array of options to be passed to commands.
4+
BASE_REQUIREMENTS=("chevah-brink==1.0.15" "paver==1.3.4" "wheel")
5+
# Use our production server instead of the GitHub releases set by default.
66
BINARY_DIST_URI='https://github.com/chevah/pythia/releases/download'
7-
#BINARY_DIST_URI='https://bin.chevah.com:20443/production'
87
# For testing packages, make sure this one is the last uncommented instance:
9-
#BINARY_DIST_URI='https://bin.chevah.com:20443/testing'
10-
PIP_INDEX_URL='https://bin.chevah.com:20443/pypi/simple'
11-
12-
# There are 2 build directories used in this repo:
13-
# * $BUILD_DIR is used for building libffi / OpenSSL / Python / etc.
14-
# * $CHEVAH_BUILD_DIR is used by the Python that builds the above.
15-
CHEVAH_BUILD_DIR='build-py3'
8+
# BINARY_DIST_URI="https://bin.chevah.com:20443/testing"
9+
# Also overwrite the default pypi.org site set by default in pythia.sh.
10+
PIP_INDEX_URL="https://bin.chevah.com:20443/pypi/simple"
11+
# This is used by the Python runtime.
12+
CHEVAH_BUILD_DIR="build-py3"

pythia.sh

+27-17
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ OS="not-detected-yet"
8383
ARCH="not-detected-yet"
8484

8585
# Initialize default values, some are overwritten from pythia.conf.
86-
PYTHON_NAME="not.yet.defined"
8786
PYTHON_CONFIGURATION="NOT-YET-DEFINED"
88-
PYTHON_VERSION="not.defined.yet"
87+
PYTHON_NAME="not-yet-determined"
88+
PYTHON_VERSION="not-determined-yet"
8989
PYTHON_PLATFORM="unknown-os-and-arch"
9090
BINARY_DIST_URI="https://github.com/chevah/pythia/releases/download"
9191
PIP_INDEX_URL="https://pypi.org/simple"
@@ -107,7 +107,7 @@ check_source_folder() {
107107
# Called to trigger the entry point in the virtual environment.
108108
# Can be overwritten in pythia.conf
109109
execute_venv() {
110-
"$PYTHON_BIN" -c "from paver.tasks import main; main()" "$@"
110+
"$PYTHON_BIN" -X utf8 -c "from paver.tasks import main; main()" "$@"
111111
}
112112

113113

@@ -149,6 +149,8 @@ clean_build() {
149149
delete_folder "$DIST_FOLDER"
150150
echo "Removing publish/..."
151151
delete_folder publish/
152+
echo "Removing node_modules/..."
153+
delete_folder node_modules/
152154

153155
# In some case pip hangs with a build folder in temp and
154156
# will not continue until it is manually removed.
@@ -189,7 +191,7 @@ delete_folder() {
189191
local target="$1"
190192
# On Windows, we use internal command prompt for maximum speed.
191193
# See: https://stackoverflow.com/a/6208144/539264
192-
if [ "$OS" = "win" ]; then
194+
if [ "$OS" = "windows" ]; then
193195
if [ -d "$target" ]; then
194196
cmd //c "del /f/s/q $target > nul"
195197
cmd //c "rmdir /s/q $target"
@@ -225,7 +227,7 @@ execute() {
225227
update_path_variables() {
226228
resolve_python_version
227229

228-
if [ "$OS" = "win" ] ; then
230+
if [ "$OS" = "windows" ] ; then
229231
PYTHON_BIN="/lib/python.exe"
230232
PYTHON_LIB="/lib/Lib/"
231233
else
@@ -293,12 +295,15 @@ resolve_python_version() {
293295
candidate="${version_configuration_array[$i]}"
294296
candidate_platform="$(echo "$candidate" | cut -d"@" -f1)"
295297
candidate_version="$(echo "$candidate" | cut -d"@" -f2)"
298+
candidate_name="$(echo "$candidate_version" | cut -d"." -f1-2)"
296299
if [ "$candidate_platform" = "default" ]; then
297-
# On first pass, we set the default version.
300+
# On first pass, we set the default version and name.
298301
PYTHON_VERSION="$candidate_version"
302+
PYTHON_NAME="python${candidate_name}"
299303
elif [ -z "${PYTHON_PLATFORM%"$candidate_platform"*}" ]; then
300-
# If matching a specific platform, we overwrite the default version.
304+
# If matching a specific platform, we overwrite the defaults.
301305
PYTHON_VERSION="$candidate_version"
306+
PYTHON_NAME="python${candidate_name}"
302307
fi
303308
done
304309
}
@@ -308,7 +313,7 @@ resolve_python_version() {
308313
# Install base package.
309314
#
310315
install_base_deps() {
311-
echo "::groups::Installing base requirements:" "${BASE_REQUIREMENTS[@]}"
316+
echo "::group::Installing base requirements:" "${BASE_REQUIREMENTS[@]}"
312317

313318
set +e
314319
# There is a bug in pip/setuptools when using custom build folders.
@@ -365,7 +370,7 @@ get_binary_dist() {
365370
local dist_name="$1"
366371
local remote_base_url="$2"
367372

368-
echo "Getting $dist_name from $remote_base_url..."
373+
echo "Getting $dist_name from $remote_base_url ..."
369374

370375
tar_gz_file="$dist_name".tar.gz
371376
tar_file="$dist_name".tar
@@ -393,7 +398,7 @@ test_version_exists() {
393398
local remote_base_url="$1"
394399
local target_file="python-$PYTHON_VERSION-$OS-$ARCH.tar.gz"
395400

396-
echo "Checking $remote_base_url/$PYTHON_VERSION/$target_file..."
401+
echo "Checking $remote_base_url/$PYTHON_VERSION/$target_file ..."
397402
"${ONLINETEST_CMD[@]}" "$remote_base_url"/"$PYTHON_VERSION"/"$target_file"
398403
return $?
399404
}
@@ -473,7 +478,8 @@ copy_python() {
473478
get_python_dist "$BINARY_DIST_URI"
474479
fi
475480

476-
echo "Copying Python distribution files... "
481+
echo "Copying Python distribution files from $python_distributable " \
482+
"to $BUILD_FOLDER ... "
477483
cp -R "$python_distributable"/* "$BUILD_FOLDER"
478484

479485
echo "::endgroup::"
@@ -679,24 +685,28 @@ check_glibc_version(){
679685

680686
check_musl_version(){
681687
local musl_version
688+
local musl_version_cleaned
682689
local musl_version_array
683690
local musl_version_unsupported="false"
684691
local supported_musl11_version=24
685692

686693
echo "No specific runtime for the current distribution / version / arch."
687694
echo "Minimum musl version for this arch: 1.1.$supported_musl11_version."
688695

689-
# Tested with musl 1.1.24/1.2.2.
696+
# Tested with musl 1.1.24/1.2.2/1.2.4_git20230717/1.2.5.
690697
musl_version="$(grep -E ^"Version" "$ldd_output_file" | cut -d" " -f2)"
691698
rm "$ldd_output_file"
692699

693-
if [[ "$musl_version" =~ [^[:digit:]\.] ]]; then
694-
(>&2 echo "Musl version should only have digits and dots, but:")
695-
(>&2 echo " \$musl_version=$musl_version")
700+
# Some Alpine Linux releases (e.g. Alpine 3.19) use git-versioned musl.
701+
musl_version_cleaned="${musl_version//_git/.}"
702+
703+
if [[ "$musl_version_cleaned" =~ [^[:digit:]\.] ]]; then
704+
(>&2 echo "Cleaned musl version should only have digits and dots, but")
705+
(>&2 echo " \$musl_version_cleaned=$musl_version_cleaned")
696706
exit 25
697707
fi
698708

699-
IFS=. read -r -a musl_version_array <<< "$musl_version"
709+
IFS=. read -r -a musl_version_array <<< "$musl_version_cleaned"
700710

701711
# Decrement supported_musl11_version above if building against older musl.
702712
if [ "${musl_version_array[0]}" -lt 1 ]; then
@@ -736,7 +746,7 @@ detect_os() {
736746
case "$OS" in
737747
MINGW*|MSYS*)
738748
ARCH="$(uname -m)"
739-
OS="win"
749+
OS="windows"
740750
;;
741751
Linux)
742752
ARCH="$(uname -m)"

release-notes.rst

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Release notes for chevah.compat
22
===============================
33

4+
1.1.0 - 2024-01-22
5+
------------------
6+
7+
* Update support for Twisted 23.10.0
8+
9+
410

511
1.0.9 - 2023-07-04
612
--------------------

setup.cfg

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = chevah-compat
3-
version = 1.0.9
3+
version = 1.1.0
44
maintainer = Adi Roiban
55
maintainer_email = adi.roiban@proatria.com
66
license = BSD
@@ -34,14 +34,15 @@ dev =
3434

3535
bunch
3636

37-
Twisted == 20.3.0+chevah.5
38-
service_identity == 21.1.0
37+
Twisted==23.10.0+chevah.2
38+
incremental
39+
service-identity==24.1.0
3940

4041
nose == 1.3.7
4142
nose-randomly == 1.2.5
4243

43-
coverage==6.3
44-
diff_cover==6.4.4
44+
coverage ~= 7.5
45+
diff_cover == 6.4.4
4546
codecov == 2.1.12
4647

4748
; Required for showing OpenSSL version in test_ci.

src/chevah_compat/testing/testcase.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from nose import SkipTest
2323
try:
2424
from twisted.internet.defer import Deferred
25-
from twisted.internet.posixbase import (
25+
from twisted.internet._signals import (
2626
_SocketWaker, _UnixWaker, _SIGCHLDWaker
2727
)
2828
from twisted.python.failure import Failure
@@ -1012,7 +1012,12 @@ def callCleanup(self):
10121012
try:
10131013
function(*args, **kwargs)
10141014
except Exception as error: # noqa:cover
1015-
self._teardown_errors.append(error)
1015+
self._teardown_errors.append(
1016+
error,
1017+
function,
1018+
args,
1019+
kwargs,
1020+
)
10161021

10171022
self.__cleanup__ = []
10181023

0 commit comments

Comments
 (0)