Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.12 update. #58

Merged
merged 88 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
111024a
Zlib 1.3.1 update.
dumol May 28, 2024
ff41dd8
Pip 24.0 update.
dumol May 28, 2024
a102aee
Debug outdated macOS Homebrew hacks.
dumol May 28, 2024
d5240fa
No more Homebrew hacking on GitHub's macOS setups.
dumol May 28, 2024
3a2291c
Make it possible to ignore preset Safety IDs.
dumol May 28, 2024
4a5cb66
Make it possible to ignore preset Safety IDs, take two.
dumol May 28, 2024
12b79af
Unified debugging for testing on GitHub's bare OS'es.
dumol May 28, 2024
543d85f
Update macOS setup for latest GitHub labels.
dumol May 28, 2024
f6e873c
Shellcheck fixes.
dumol May 28, 2024
40291f7
Shellcheck fixes and more.
dumol May 28, 2024
87713dd
Put back Homebrew hacks for x86 macOS.
dumol May 30, 2024
e7e0fb6
Do not install binary wheels.
dumol Jun 3, 2024
8aaeaa3
Do not install binary wheels, take two.
dumol Jun 3, 2024
e515cfc
Also ignore the jinja2 disputed safety issue.
dumol Jun 3, 2024
c562a70
Properly generate SAFETY_IGNORDE_OPTS for multiple Safety IDs to ignore.
dumol Jun 3, 2024
bf771c3
Properly generate SAFETY_IGNORDE_OPTS for multiple Safety IDs to igno…
dumol Jun 3, 2024
1ee3fd8
Try debugging safety opts.
dumol Jun 4, 2024
f5e176a
Process Safety IDs the Bash way.
dumol Jun 4, 2024
e0675ce
Make it possible to skip tests during build.
dumol Jun 5, 2024
e61df38
Switched to latest OpenSSL 3.0.x on non-Windows platforms.
dumol Jun 5, 2024
041ee81
More updated libs.
dumol Jun 5, 2024
2724f91
Latest versions for remaining Python modules.
dumol Jun 5, 2024
238dda3
Manual merge with master
dumol Jun 18, 2024
abdeddf
Try building Python 3.13.0b2.
dumol Jun 18, 2024
0feae9d
Try building Python 3.13.0b2, take two.
dumol Jun 19, 2024
1018d97
Python 3.13 deprecates `crypt` and `spwd`.
dumol Jun 19, 2024
04a4a72
Try building Python 3.13.0b2, take three.
dumol Jun 19, 2024
9844b39
Get more Homebrew stuff out of the way.
dumol Jun 19, 2024
c164875
Try building Python 3.13.0b2, take four.
dumol Jun 19, 2024
676caf9
Get more Homebrew stuff out of the way, take two.
dumol Jun 24, 2024
dcabbcb
Python builds with OS-provided libedit on macOS lately.
dumol Jun 24, 2024
eb0ab77
Python builds with OS-provided libedit on macOS lately, take two.
dumol Jun 24, 2024
8ce0751
Python builds with OS-provided libedit on macOS lately, take three.
dumol Jun 24, 2024
42d6e8f
Python builds with OS-provided libedit on macOS lately, take four.
dumol Jun 24, 2024
176a8ad
Python 3.13.0b3 update.
dumol Jul 3, 2024
c936949
Python 3.13.0b3 update, take two.
dumol Jul 3, 2024
9d08ba7
Removed debugging spillover from package checks.
dumol Jul 3, 2024
f1f1615
Removed safety, added requirements.txt.
dumol Jul 3, 2024
ec8a45e
Removed safety, added requirements.txt, take two.
dumol Jul 4, 2024
3a41156
Get generic Linux deps back to normal.
dumol Jul 19, 2024
f7a73bf
Get generic Linux deps back to normal, take two.
dumol Jul 19, 2024
1f4ce2a
Install gdb on Amazon Linux 2 for improved Python tests.
dumol Jul 19, 2024
36616a8
Python 3.13.0b4 update.
dumol Jul 19, 2024
8e372ef
Python modules update.
dumol Jul 19, 2024
4f22e7e
Amazon 2 has a gdb unusable for Python tests (built with Python 2).
dumol Jul 19, 2024
35f4b1c
Automatically regenerate requirements.txt when done building.
dumol Jul 22, 2024
7fe9200
Include pip version in requirements.txt.
dumol Jul 22, 2024
0f0c21e
Fixed Windows package filename.
dumol Jul 22, 2024
5bb35ca
Try actions/checkout@v4.
dumol Jul 22, 2024
e7cc6e0
Remove download cache instead of just purging.
dumol Sep 11, 2024
5766411
Synced pythia.sh with server repo version.
dumol Sep 11, 2024
797af65
Synced pythia.sh from server repo.
dumol Sep 25, 2024
f3a26fe
Allow building Python release candidate versions.
dumol Sep 27, 2024
6246aae
Also updated pythia.conf from server repo.
dumol Sep 27, 2024
1648d3b
Fixed sha512.sum file for embedded Windows package.
dumol Sep 27, 2024
7921672
Fixed sha512.sum file for embedded Windows package, take two
dumol Sep 27, 2024
e43aaa7
Try latest 3.12 Python release.
dumol Sep 27, 2024
253a5d7
Shellcheck-related fixes.
dumol Sep 30, 2024
21a69bb
Fixed Amazon Linux 2 build.
dumol Sep 30, 2024
3cb102c
Try building musl package on Alpine 3.15.
dumol Sep 30, 2024
9545364
Updated OpenSSL to version 3.0.15 on non-Windows platforms.
dumol Sep 30, 2024
879667f
Updated pip and setuptools to latest versions.
dumol Sep 30, 2024
e4c1428
Try latest 3.12 Python release, take two.
dumol Sep 30, 2024
b46e772
Updated OpenSSL version check.
dumol Sep 30, 2024
bb559dd
Try auto-updating requirements.txt through the Windows build.
dumol Oct 1, 2024
d65c50f
Try auto-updating requirements.txt through the Windows build, take 2.
dumol Oct 1, 2024
3ec71bf
Try auto-updating requirements.txt through the Windows build, take 3.
dumol Oct 1, 2024
253e629
Try auto-updating requirements.txt through the Windows build, take 4.
dumol Oct 1, 2024
e783ef9
Automated update of requirements.txt from Windows build.
dumol Oct 1, 2024
ddd58ee
Changes after a quick own review.
dumol Oct 1, 2024
955703b
Do not copy xz binaries in dist packages.
dumol Oct 1, 2024
1535503
Compress saved Makefiles.
dumol Oct 1, 2024
2ae496a
Compress saved Makefiles, take 2.
dumol Oct 1, 2024
6187a23
Put back tests for crypt and spwd for now.
dumol Oct 3, 2024
e4868b4
Also uninstall setuptools before packing the dist.
dumol Oct 3, 2024
c1d74ac
Automated update of requirements.txt from Windows build.
dumol Oct 3, 2024
c87952a
Use same setuptools version as server repo.
dumol Oct 3, 2024
bf5f05b
The unzip ersatz in Alpine Linux busybox is good enough.
dumol Oct 3, 2024
ffac61a
Try gcc10 for building on Amazon Linux 2 through GHA.
dumol Oct 3, 2024
7548eaa
Try gcc10 for building on Amazon Linux 2 through GHA, take 2.
dumol Oct 3, 2024
ced2651
Back to default gcc for building on Amazon Linux 2 through GHA.
dumol Oct 3, 2024
8a2f99d
Leave setuptools as-is.
dumol Oct 3, 2024
a5de779
Automated update of requirements.txt from Windows build.
dumol Oct 3, 2024
2303a25
Updated Python to version 3.12.7.
dumol Oct 4, 2024
aada621
One more hack for not building a default Python module.
dumol Oct 8, 2024
ac6595f
One more hack for not building a default Python module, take two.
dumol Oct 8, 2024
e45dcd7
Added a comment for psutil.
dumol Oct 10, 2024
77ba463
Changes after own review.
dumol Oct 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/bare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ jobs:
run: |
sudo mv -v /usr/local/bin/git{,.saved}
sudo chmod -v a-r /usr/local/include/libintl.h
sudo chmod -v a-r /usr/local/include/gdbm.h
sudo chmod -v a-r /usr/local/opt/gettext/lib/libintl.*
sudo chmod -v a-r /usr/local/opt/gdbm/lib/libgdbm*
sudo chmod -v a-r /usr/local/opt/mpdecimal/lib/libmpdec*

- name: Build Pythia
timeout-minutes: 30
Expand All @@ -103,8 +106,11 @@ jobs:
# Fix back Homebrew, for working Shellcheck tests and tmate debugging.
- name: Unhack Homebrew
run: |
sudo chmod -v a+r /usr/local/opt/gettext/lib/libintl*
sudo chmod -v a+r /usr/local/include/libintl.h
sudo chmod -v a-r /usr/local/include/gdbm.h
sudo chmod -v a+r /usr/local/opt/gettext/lib/libintl*
sudo chmod -v a+r /usr/local/opt/gdbm/lib/libgdbm*
sudo chmod -v a+r /usr/local/opt/mpdecimal/lib/libmpdec*
sudo mv -v /usr/local/bin/git{.saved,}

- name: Test Pythia
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ jobs:
run: |
yum -y upgrade
yum -y install git-core gcc make m4 patch tar unzip perl perl-Test-Simple perl-IPC-Cmd xz gcc-c++ dejagnu
# To avoid linking against libdb and gdmb libraries on Amazon Linux 2.
dumol marked this conversation as resolved.
Show resolved Hide resolved
# Can't simply uninstall libdb-devel and gdmb-devel, they are required by perl-IPC-Cmd.
rm -v /usr/include/libdb/db.h
rm -v /usr/include/gdbm.h

- name: Ubuntu setup
if: startsWith(matrix.container, 'ubuntu')
Expand Down
15 changes: 4 additions & 11 deletions build.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ DIST_DIR="dist"
PYTHIA_BUILD_TESTS="${PYTHIA_BUILD_TESTS:-1}"

# Python and lib versions.
PYTHON_BUILD_VERSION="3.11.9"
PYTHON_BUILD_VERSION="3.13.0b4"
LIBFFI_VERSION="3.4.6"
ZLIB_VERSION="1.3.1"
BZIP2_VERSION="1.0.8"
Expand All @@ -36,18 +36,15 @@ SQLITE_VERSION="3460000"
BOOTSTRAP_GET_PIP="https://bootstrap.pypa.io/get-pip.py"

# Python modules installed after bootstraping pip.
PIP_VERSION="24.0"
SETUPTOOLS_VERSION="70.0.0"
PIP_VERSION="24.1.2"
SETUPTOOLS_VERSION="71.0.3"
# pycparser is explicitly installed to work around setuptools auto dependencies.
PYCPARSER_VERSION="2.22"

# Python modules that have to be built and/or installed in Pythia.
PSUTIL_VERSION="5.9.8"
PSUTIL_VERSION="6.0.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this variabl here.

I think that we can install all the packageis via pip install -r requirements.txt

then the requirements.txt file will be used by the security scanners.

Copy link
Contributor Author

@dumol dumol Jul 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hhmmm… Now that you put it this way, it's obvious pywin32 is missing from requirements.txt. Unless the dev building locally uses Windows, of course!

There's also pip itself, which is installed in a peculiar way, which differs on Windows compared to the other OS'es.

Actually, lately only psutil is always installed in a generic way, using the the still present PIP_LIBRARIES env var. And this is only until #60 is fixed.

So, I guess no?

Copy link
Contributor Author

@dumol dumol Jul 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hhmmm… Now that you put it this way, it's obvious pywin32 is missing from requirements.txt. Unless the dev building locally uses Windows, of course!

Maintaining requirements.txt could be fixed through https://github.com/stefanzweifel/git-auto-commit-action to automate updating requirements.txt through the Windows GHA job. Of course, only after there's a pywin32 wheel for Python 3.13 and the Windows build can finish successfully.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left things as is for now, as requirements.txt is not the same on Windows and the other platforms.

To make sure it's not left behind, I've used the above GitHub action on Windows, where pywin32 is also installed. An example of such an automatic commit: e783ef9.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also filled #62 for improving current situation.

PYWIN32_VERSION="306"

# Pin safety to keep the deps of the test environment under control.
SAFETY_VERSION="3.2.0"

# Global flags for building required libs.
BUILD_LIBFFI="no"
BUILD_ZLIB="no"
Expand All @@ -72,7 +69,3 @@ PIP_ARGS=(\
--index-url="$PIP_INDEX_URL" \
--no-warn-script-location \
)
# Array of safety IDs to ignore.
# 67599: pip 24.0, https://data.safetycli.com/v/67599/f17/ (disputed).
# 70612: jinja2 3.1.4, https://data.safetycli.com/v/70612/97c (disputed).
SAFETY_IGNORED_IDS=(67599 70612)
24 changes: 6 additions & 18 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,12 @@ command_install_python_modules() {
execute "$PYTHON_BIN" -m pip install "${PIP_ARGS[@]}" "$library"
done

# When done, uninstall wheel.
echo "# Uninstalling wheel... #"
execute "$PYTHON_BIN" -m pip uninstall --yes wheel

echo "# Regenerating requirements.txt file... #"
execute "$PYTHON_BIN" -m pip freeze > requirements.txt

echo "::endgroup::"
}

Expand All @@ -222,8 +225,6 @@ help_text_test="Run own tests for the newly-build Python distribution."
command_test() {
local test_file="test_python_binary_dist.py"
local python_binary="$PYTHON_BIN"
local safety_id_to_ignore
declare -a safety_ignore_opts

echo "::group::Chevah tests"
if [ ! -d "$BUILD_DIR" ]; then
Expand All @@ -240,25 +241,12 @@ command_test() {
execute cp src/chevah-python-tests/get_binaries_deps.sh "$BUILD_DIR"
execute pushd "$BUILD_DIR"
execute "$python_binary" "$test_file"
execute popd
echo "::endgroup::"

echo "::group::Security tests"
echo "## Testing for outdated packages and security issues... ##"
echo "## Testing for outdated packages... ##"
execute "$python_binary" -m pip list --outdated --format=columns
execute "$python_binary" -m pip install "${PIP_ARGS[@]}" \
safety=="$SAFETY_VERSION"

if (( ${#SAFETY_IGNORED_IDS[@]} != 0 )); then
(>&2 echo "Following Safety DB IDs are excepted from checks:")
(>&2 echo -e "\t${SAFETY_IGNORED_IDS[*]}")
for safety_id_to_ignore in "${SAFETY_IGNORED_IDS[@]}"; do
safety_ignore_opts+=("-i $safety_id_to_ignore")
done
fi

execute "$python_binary" -m safety check --full-report \
"${safety_ignore_opts[@]}"
execute popd
echo "::endgroup::"

echo "::group::Shell tests"
Expand Down
4 changes: 2 additions & 2 deletions pkg_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ PACKAGES="$CC make m4 git patch curl sha512sum tar unzip"
# This is defined as an array of commands and opts, to allow it to be quoted.
CHECK_CMD=(command -v)

# $CHECK_CMD should exit with 0 only when checked packages is installed.
# $CHECK_CMD should exit with 0 only when checked package is installed.
case "$OS" in
windows)
# Nothing to actually build on Windows.
Expand Down Expand Up @@ -74,7 +74,7 @@ esac
# External checks with various exit codes are checked below.
set +o errexit

# If $CHECK_CMD is still (command -v), it's only a check for needed commands.
# If $CHECK_CMD is still "(command -v)", it's only a check for needed commands.
if [ -n "$PACKAGES" ]; then
for package in $PACKAGES ; do
echo "Checking if $package is available..."
Expand Down
2 changes: 1 addition & 1 deletion pythia.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PYTHON_CONFIGURATION="default@3.11.3.f9d9434"
PYTHON_CONFIGURATION="default@3.13.deadbeef"
# This is defined as a Bash array of options to be passed to commands.
BASE_REQUIREMENTS=("chevah-brink==1.0.13" "paver==1.3.4")
# Use our production server instead of the GitHub releases set by default.
Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
psutil==6.0.0
pycparser==2.22
setuptools==71.0.3
dumol marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 7 additions & 3 deletions src/Python-Windows/chevahbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ INSTALL_DIR="$3"/lib
# Construct the relevant download link for the Windows version.
EXT="amd64.zip"
ARCHIVE="python-$VER.$EXT"
LINK="https://www.python.org/ftp/python/$VER/python-$VER-embed-$EXT"

# For beta versions, remove everything after the b for the dir name.
DIR=${VER%b*}

LINK="https://www.python.org/ftp/python/$DIR/python-$VER-embed-$EXT"

# Download without unpacking (amd64.zip extension is treated specially).
download_sources "$NAME" "$VER" "$LINK" "$EXT"
Expand All @@ -30,5 +34,5 @@ echo "## Extracting ZIP archive to $INSTALL_DIR... ##"
execute unzip -q "$ARCHIVE" -d "$INSTALL_DIR"

echo "## Adding site-packages to python*._pth file... ##"
echo "import site" >> "$INSTALL_DIR"/python311._pth
echo "site.main()" >> "$INSTALL_DIR"/python311._pth
echo "import site" >> "$INSTALL_DIR"/python313._pth
echo "site.main()" >> "$INSTALL_DIR"/python313._pth
2 changes: 1 addition & 1 deletion src/Python-Windows/sha512.sum
Original file line number Diff line number Diff line change
@@ -1 +1 @@
24106fc0e2a798c34840222083f2643c95a0e14c1eb8bb5489dfbcc3eb56d631cc0649c406d75eae173e2d03cd1cf88d246e5903abf62d414fab88e94afa176e python-3.11.9.amd64.zip
26f41b11034323f072ae0e0ada544935b266d0767b264c2fac9917bec82337bdc2571d76acce19160275d6411f65e9ad2a4449545e1e70f4e6124d1aba443bde python-3.13.0b4-amd64.zip
11 changes: 6 additions & 5 deletions src/Python/chevahbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@ chevahbs_getsources() {
local name="$1"
local ver="$2"
local ext="tgz"
local link=https://www.python.org/ftp/python/"$ver"/"$name"-"$ver"."$ext"
local dir
local link

# For beta versions, remove everything after the b for the dir name.
dir=${ver%b*}
link=https://www.python.org/ftp/python/"$dir"/"$name"-"$ver"."$ext"

download_sources "$name" "$ver" "$link" "$ext"
}


chevahbs_patch() {
# Our own patch to avoid compiling certain modules.
echo "# Applying disabled_modules.patch... #"
execute patch < disabled_modules.patch

if [ "$BUILD_LIBEDIT" = "yes" ]; then
# Adapted from https://bugs.python.org/issue13501.
echo "# Applying readline_libedit.patch... #"
Expand Down
20 changes: 0 additions & 20 deletions src/Python/disabled_modules.patch

This file was deleted.

2 changes: 1 addition & 1 deletion src/Python/sha512.sum
Original file line number Diff line number Diff line change
@@ -1 +1 @@
33651f373fcc6da9aac895da25300de0f807e3643daff99e8c81e6205d75c67a060d7fd7bbee5ce8b5e142aa2f407284d90b182b5fffd9befc54e6b55b7c08f7 Python-3.11.9.tgz
0c5a33fed810fbaa2a0ca2a9a817aaca0d2b1aec394f6366f7705903cd344463ebe056d3fabf31197d1ae0578ec1108fb7a317d8a2c1e3e244823fe95e56bbba Python-3.13.0b4.tgz
19 changes: 2 additions & 17 deletions src/chevah-python-tests/test_python_binary_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,11 @@ def get_allowed_deps():
'/System/Library/Frameworks/Security.framework/Versions/A/Security',
'/System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration',
'/usr/lib/libbz2.1.0.dylib',
'/usr/lib/libedit.3.dylib',
'/usr/lib/libffi.dylib',
'/usr/lib/libiconv.2.dylib',
'/usr/lib/libncurses.5.4.dylib',
'/usr/lib/libpanel.5.4.dylib',
'/usr/lib/libresolv.9.dylib',
'/usr/lib/libSystem.B.dylib',
'/usr/lib/libz.1.dylib',
Expand Down Expand Up @@ -461,13 +463,6 @@ def main():

else:
# Linux / Unix stuff.
try:
import crypt
crypt
except:
sys.stderr.write('"crypt" is missing.\n')
exit_code = 155

# Check for the git revision in Python's sys.version on Linux and Unix.
try:
git_rev_cmd = ['git', 'log', '-1', '--no-merges', '--format=%h']
Expand All @@ -483,16 +478,6 @@ def main():
"\tGit rev: {0}".format(git_rev) + "\n")
exit_code = 158

if platform_system in [ 'linux', 'sunos' ]:
try:
import spwd
spwd
except:
sys.stderr.write('"spwd" is missing, but it should be present.\n')
exit_code = 161
else:
print('"spwd" module is present.')

# The readline module is built using libedit only on selected platforms.
if BUILD_LIBEDIT:
try:
Expand Down
Loading