Skip to content

Commit

Permalink
[#699] Python 3.12 update. (#700)
Browse files Browse the repository at this point in the history
* Update pythia stuff to latest versions.

* Try latest pynose instead of nose with imp.

* Simplify cloning the repo independently.

* Use importlib instead of imp.

* Increment version.

* Clenaup pavement.py for py3 only code.

* Fix tearDown error.

* Remove six usage.

* Cleanup GHA yaml s we no longer support older centos.

* Fix docker run.

* Run on latest Ubuntu

* Even more simple rules.

* Try su.

* Add gnu tar for alpine.

* Use production packages.

---------

Co-authored-by: Adi Roiban <[email protected]>
  • Loading branch information
dumol and adiroiban authored Oct 10, 2024
1 parent 0ab5293 commit ff42db8
Show file tree
Hide file tree
Showing 7 changed files with 245 additions and 316 deletions.
48 changes: 15 additions & 33 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# Available VMs. Don't use `-latest` as we want to pin an OS version.
# https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
#
# Available images https://github.com/actions/runner-images
#
# When running a tmate debug session you might need to increase the
# timeout-minutes for each build.

Expand All @@ -25,7 +27,8 @@ defaults:

jobs:

ubuntu-2004-unicode-path:
# Try to run using oldest Ubuntu version available on GitHub
ubuntu-old-unicode-path:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
timeout-minutes: 30
Expand Down Expand Up @@ -69,8 +72,9 @@ jobs:
run: mv build-py3-ț build-py


ubuntu-2204-ascii-path:
runs-on: ubuntu-22.04
# Try to run with latest Ubuntu version available on GitHub
ubuntu-latest-ascii-path:
runs-on: ubuntu-24.04
timeout-minutes: 30

# Steps represent a sequence of tasks that will be executed as part of the job
Expand Down Expand Up @@ -265,7 +269,7 @@ jobs:

- name: Alpine setup
if: startsWith(matrix.container, 'alpine')
run: apk add git bash shadow sudo curl
run: apk add git bash shadow sudo curl tar

- name: Amazon Linux 2022 setup
if: matrix.container == 'amazonlinux:2022' || matrix.container == 'rockylinux:9'
Expand All @@ -288,52 +292,30 @@ jobs:
useradd -g adm -s /bin/bash -m chevah
echo '%adm ALL=NOPASSWD: ALL' > /etc/sudoers
# GHA's checkout action fails on CentOS 5/6, issue same commands manually.
# This fails when opening a new PR, but works starting with second commit.
- name: Clone sources independently
run: |
cd /home/chevah/
git init $CHEVAH_REPO
cd $CHEVAH_REPO
# Cleanup the repo.
git rev-parse --symbolic-full-name --verify --quiet HEAD || true
git rev-parse --symbolic-full-name --branches || true
git remote remove origin || true
# Update repo token.
git remote add origin https://github.com/chevah/$CHEVAH_REPO
git fetch --no-tags --prune origin
# Prepare the code.
git clean -f
git reset --hard ${{ github.event.after }}
git log -1 --format='%H'
# This action also fails on CentOS 5/6.
- uses: actions/checkout@v4

- name: Cache build
uses: actions/cache@v4
if: matrix.container != 'proatria/centos:5.11-chevah1' && matrix.container != 'centos:6.10'
with:
path: |
/home/chevah/$CHEVAH_REPO/build-$CHEVAH_REPO
build-py3
key: ${{ runner.os }}-${{ hashFiles('pavement.py') }}-${{ hashFiles('pythia.conf') }}-${{ matrix.container }}

- name: Deps
run: |
cd /home/chevah/$CHEVAH_REPO
./pythia.sh deps
chown -R chevah .
su chevah -c "./pythia.sh deps"
- uses: chevah/python-info-action@v1
with:
python-path: /home/chevah/$CHEVAH_REPO/build-py3/bin/python
python-path: build-py3/bin/python

- name: Build
run: |
cd /home/chevah/$CHEVAH_REPO
su chevah -c "./pythia.sh build"
- name: Test
run: |
cd /home/chevah/$CHEVAH_REPO
su chevah -c "./pythia.sh test_ci2"
Expand All @@ -344,8 +326,8 @@ jobs:
timeout-minutes: 10
if: always()
needs:
- ubuntu-2004-unicode-path
- ubuntu-2204-ascii-path
- ubuntu-old-unicode-path
- ubuntu-latest-ascii-path
- macos-m1-unicode-path
- windows
- docker
Expand Down
62 changes: 0 additions & 62 deletions pavement.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
Build script for chevah-compat.
"""

import compileall
import imp
import os
import py_compile
import struct
import subprocess
import sys

Expand Down Expand Up @@ -92,64 +88,6 @@ def _set_umask(mask):
_set_umask(0o002)


def compile_file(fullname, ddir=None, force=0, rx=None, quiet=0):
"""
<Byte-compile one file.
Arguments (only fullname is required):
fullname: the file to byte-compile
ddir: if given, the directory name compiled in to the
byte-code file.
force: if 1, force compilation, even if timestamps are up-to-date
quiet: if 1, be quiet during compilation
"""
success = 1
name = os.path.basename(fullname)
if ddir is not None:
dfile = os.path.join(ddir, name)
else:
dfile = None
if rx is not None:
mo = rx.search(fullname)
if mo:
return success
if os.path.isfile(fullname):
tail = name[-3:]
if tail == '.py':
if not force:
try:
mtime = int(os.stat(fullname).st_mtime)
expect = struct.pack('<4sl', imp.get_magic(), mtime)
cfile = fullname + (__debug__ and 'c' or 'o')
with open(cfile, 'rb') as chandle:
actual = chandle.read(8)
if expect == actual:
return success
except OSError:
pass
if not quiet:
print('Compiling', fullname.encode('utf-8'), '...')
try:
ok = py_compile.compile(fullname, None, dfile, True)
except py_compile.PyCompileError as err:
if quiet:
print('Compiling', fullname.encode('utf-8'), '...')
print(err.msg.encode('utf-8'))
success = 0
except OSError as e:
print('Sorry', e)
success = 0
else:
if ok == 0:
success = 0
return success


# Path the upstream code.
compileall.compile_file = compile_file


@task
def update_setup():
"""
Expand Down
13 changes: 6 additions & 7 deletions pythia.conf
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@

PYTHON_CONFIGURATION="[email protected]"
PYTHON_CONFIGURATION="[email protected]"
# This is defined as a Bash array of options to be passed to commands.
BASE_REQUIREMENTS=("chevah-brink==1.0.15" "paver==1.3.4" "wheel")
# Use our private PyPi server instead of the default one set in pythia.sh.
PIP_INDEX_URL="https://bin.chevah.com:20443/pypi/simple"
# Use our production server instead of the GitHub releases set by default.
BINARY_DIST_URI='https://github.com/chevah/pythia/releases/download'
BINARY_DIST_URI="https://bin.chevah.com:20443/production"
# For testing packages, make sure this one is the last uncommented instance:
# BINARY_DIST_URI="https://bin.chevah.com:20443/testing"
# Also overwrite the default pypi.org site set by default in pythia.sh.
PIP_INDEX_URL="https://bin.chevah.com:20443/pypi/simple"
# This is used by the Python runtime.
#BINARY_DIST_URI="https://bin.chevah.com:20443/testing"
# This directory is used by the Python runtime.
CHEVAH_BUILD_DIR="build-py3"
Loading

0 comments on commit ff42db8

Please sign in to comment.