Skip to content

Commit b2d0bb7

Browse files
authored
CI: fix release scripts to work with PEP 625 (#1051)
With version 69.3.0, setuptools started naming dist archives according to PEP 625. This broke our release scripts. Signed-off-by: Grant Lodge <6323995+thelonelyvulpes@users.noreply.github.com>
1 parent e2ddcce commit b2d0bb7

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

bin/check-dist

+7-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@ then
1313
exit 1
1414
else
1515
source "${ROOT}/bin/dist-functions"
16-
check_file "${DIST}/neo4j-driver-${VERSION}.tar.gz"
17-
check_file "${DIST}/neo4j-${VERSION}.tar.gz"
16+
for PACKAGE in "neo4j-driver" "neo4j"; do
17+
NORMALIZED_PACKAGE="$(normalize_dist_name "$PACKAGE")"
18+
if ! (check_file "${DIST}/${NORMALIZED_PACKAGE}-${VERSION}.tar.gz" \
19+
|| check_file "${DIST}/${PACKAGE}-${VERSION}.tar.gz"); then
20+
STATUS=1
21+
fi
22+
done
1823
fi
1924

2025
exit ${STATUS}

bin/dist-functions

+15-4
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,23 @@ function set_version
2424
sed -i 's/^version = .*/version = "'$1'"/g' neo4j/meta.py
2525
}
2626

27+
# distribution normalization according to PEP 625 https://peps.python.org/pep-0625/
28+
function normalize_dist_name
29+
{
30+
echo $1 | sed 's/[._-]\+/_/g' | tr '[:upper:]' '[:lower:]'
31+
}
32+
2733
function check_file
2834
{
2935
FILE=$1
30-
echo -n "Checking file $(basename ${FILE})... "
36+
echo -n "Checking file $(basename "${FILE}")... "
3137
if [ -f "${FILE}" ]
3238
then
3339
echo "OK"
40+
return 0
3441
else
3542
echo "missing"
36-
STATUS=1
43+
return 1
3744
fi
3845
}
3946

@@ -76,9 +83,13 @@ function set_metadata_and_setup
7683

7784
# Create source distribution
7885
find . -name *.pyc -delete
79-
rm -rf ${ROOT}/*.egg-info 2> /dev/null
86+
rm -rf "${ROOT}/*.egg-info" 2> /dev/null
8087
python setup.py $*
81-
check_file "${DIST}/${PACKAGE}-${VERSION}.tar.gz"
88+
NORMALIZED_PACKAGE="$(normalize_dist_name $PACKAGE)"
89+
if ! (check_file "${DIST}/${NORMALIZED_PACKAGE}-${VERSION}.tar.gz" \
90+
|| check_file "${DIST}/${PACKAGE}-${VERSION}.tar.gz"); then
91+
STATUS=1
92+
fi
8293

8394
trap - EXIT
8495
cleanup

0 commit comments

Comments
 (0)