Skip to content

Commit ddcb14a

Browse files
authored
Python 3.13 and simplifications (#39)
1 parent eeb903a commit ddcb14a

20 files changed

+307
-464
lines changed

.github/workflows/clingo.yml

Lines changed: 34 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -15,84 +15,50 @@ concurrency:
1515
group: clingo-${{ github.ref }}
1616
cancel-in-progress: true
1717

18+
env:
19+
SPACK_COLOR: always
20+
SPACK_BACKTRACE: please
21+
PYTHONUNBUFFERED: 1
22+
1823
jobs:
19-
macos_clingo_x86_64:
20-
runs-on: macos-latest
24+
macos_clingo:
25+
runs-on: ${{ matrix.runner[0] }}
2126
strategy:
2227
matrix:
23-
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
28+
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
29+
# runner + macOS deployment target
30+
runner: [["macos-13", "10.13"], ["macos-14", "11"]]
31+
exclude:
32+
- python-version: "3.6"
33+
runner: ["macos-14", "11"]
34+
- python-version: "3.7"
35+
runner: ["macos-14", "11"]
36+
env:
37+
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.runner[1] }}
2438
steps:
2539
- uses: actions/checkout@v4
40+
- uses: actions/checkout@v4
41+
with:
42+
repository: spack/spack
43+
path: spack
44+
ref: c710a1597f3566ab850d0ee8c82e71af04a08f9e
45+
# See https://github.com/actions/setup-python/issues/960
46+
- name: Workaround for broken Python versions from setup-python
47+
run: brew install gettext zlib
2648
- uses: actions/setup-python@v4
2749
with:
2850
python-version: ${{ matrix.python-version }}
29-
- name: Prepare Spack
51+
- name: Install clingo-bootstrap
3052
run: |
3153
pip install --upgrade pip
3254
brew install bison
33-
export PATH="/usr/local/opt/bison/bin:$PATH"
34-
git clone https://github.com/spack/spack.git spack-src
35-
cd spack-src && git checkout -b docker-reference 08da9a854a53542e1f71d30ed8d14d6b7d18119f
36-
if [ ${{ matrix.python-version }} = "3.12" ] ; then
37-
# distutils -> setuptools patch
38-
wget -q -O - https://github.com/spack/spack/commit/1452e927719ddbbf07118e88f9fd8d18fabf0fae.patch | git apply -v
39-
fi
40-
cd ..
41-
. spack-src/share/spack/setup-env.sh
55+
export PATH="$(brew --prefix bison):$PATH"
56+
. spack/share/spack/setup-env.sh
4257
spack external find --not-buildable cmake bison
4358
spack config add "config:install_tree:padded_length:256"
44-
- name: Install clingo
45-
run: |
46-
. spack-src/share/spack/setup-env.sh
47-
spack python clingo/scripts/install_clingo.py
48-
mkdir -p binary-mirror
49-
spack buildcache push --unsigned --force $PWD/binary-mirror clingo-bootstrap
50-
- uses: actions/upload-artifact@v3
51-
with:
52-
name: clingo_binary_mirror
53-
path: binary-mirror
5459
55-
macos_clingo_aarch64:
56-
runs-on: ["self-hosted", "macOS", "ARM64"]
57-
strategy:
58-
matrix:
59-
python-version: ["3.6.15", "3.7.14", "3.8.14", "3.9.14", "3.10.7", "3.11.5", "3.12.0"]
60-
steps:
61-
- uses: actions/checkout@v4
62-
- name: Prepare Spack
63-
env:
64-
PYENV_VERSION: ${{ matrix.python-version }}
65-
run: |
66-
export PATH=/Users/spack-bootstrap-runner/homebrew/bin:/Users/spack-bootstrap-runner/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
67-
export PATH="$(pyenv prefix)/bin:$PATH"
68-
python --version
69-
70-
brew install cmake bison
71-
export PATH="/Users/spack-bootstrap-runner/homebrew/opt/bison/bin:$PATH"
72-
73-
pyenv exec pip install --upgrade pip
74-
75-
git clone https://github.com/spack/spack.git spack-src
76-
cd spack-src && git checkout -b docker-reference 08da9a854a53542e1f71d30ed8d14d6b7d18119f
77-
if [ ${{ matrix.python-version }} = "3.12.0" ] ; then
78-
# distutils -> setuptools patch
79-
wget -q -O - https://github.com/spack/spack/commit/1452e927719ddbbf07118e88f9fd8d18fabf0fae.patch | git apply -v
80-
fi
81-
cd ..
82-
. spack-src/share/spack/setup-env.sh
83-
spack external find --not-buildable cmake bison
84-
spack config add "config:install_tree:padded_length:256"
85-
- name: Install clingo
86-
env:
87-
PYENV_VERSION: ${{ matrix.python-version }}
88-
run: |
89-
export PATH=/Users/spack-bootstrap-runner/homebrew/bin:/Users/spack-bootstrap-runner/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
90-
export PATH="$(pyenv prefix)/bin:$PATH"
91-
python --version
92-
. spack-src/share/spack/setup-env.sh
9360
spack python clingo/scripts/install_clingo.py
94-
mkdir -p binary-mirror
95-
spack buildcache push --unsigned --force $PWD/binary-mirror clingo-bootstrap
61+
spack buildcache push --unsigned ./binary-mirror clingo-bootstrap
9662
- uses: actions/upload-artifact@v3
9763
with:
9864
name: clingo_binary_mirror
@@ -150,17 +116,15 @@ jobs:
150116
SPACK_MANYLINUX2014_TAG: ${{ needs.manylinux2014.outputs.spack_manylinux_tag }}
151117
steps:
152118
- uses: actions/checkout@v4
153-
- run: |
154-
. ./clingo/scripts/copy_mirror_manylinux2014.sh
119+
- run: ./copy_mirror_manylinux2014.sh
155120
- uses: actions/upload-artifact@v3
156121
with:
157122
name: clingo_binary_mirror
158-
path: |
159-
binary-mirror
123+
path: binary-mirror
160124

161125
clingo_json:
162126
runs-on: ubuntu-latest
163-
needs: [ upload-manylinux2014, macos_clingo_x86_64, macos_clingo_aarch64 ]
127+
needs: [ upload-manylinux2014, macos_clingo ]
164128
steps:
165129
- uses: actions/checkout@v4
166130
- uses: actions/setup-python@v4
@@ -171,9 +135,8 @@ jobs:
171135
name: clingo_binary_mirror
172136
- run: |
173137
pip install ruamel.yaml
174-
python clingo/scripts/clingo_json.py
138+
python3 clingo/scripts/clingo_json.py
175139
- uses: actions/upload-artifact@v3
176140
with:
177141
name: clingo_manifest
178-
path: |
179-
clingo.json
142+
path: clingo.json

.github/workflows/gnupg.yml

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,42 +15,48 @@ concurrency:
1515
group: gnupg-${{ github.ref }}
1616
cancel-in-progress: true
1717

18+
env:
19+
SPACK_COLOR: always
20+
SPACK_BACKTRACE: please
21+
PYTHONUNBUFFERED: 1
22+
1823
jobs:
1924
macos_gnupg:
2025
runs-on: ${{ matrix.runner[0] }}
2126
strategy:
2227
# List of:
2328
# 1. Runners
2429
# 2. Target architectures
30+
# 3. macOS deployment target
2531
matrix:
2632
runner: [
27-
["macos-latest", "x86_64"],
28-
[["self-hosted", "macOS", "ARM64"], "aarch64"]
33+
["macos-13", "x86_64", "10.13"], # highsierra
34+
["macos-14", "aarch64", "11"] # bigsur
2935
]
36+
env:
37+
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.runner[2] }}
3038
steps:
3139
- uses: actions/checkout@v4
32-
- run: |
33-
if [[ ${{ matrix.runner[1] }} == "aarch64" ]] ; then
34-
export PATH=/Users/spack-bootstrap-runner/homebrew/bin:/Users/spack-bootstrap-runner/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
35-
fi
40+
- uses: actions/checkout@v4
41+
with:
42+
repository: spack/spack
43+
path: spack
44+
ref: c710a1597f3566ab850d0ee8c82e71af04a08f9e
45+
- name: Install gnupg
46+
run: |
3647
brew install gawk perl
37-
git clone https://github.com/spack/spack.git spack-src
38-
cd spack-src && git checkout -b docker-reference 08da9a854a53542e1f71d30ed8d14d6b7d18119f && cd ..
3948
4049
# Disables internationalization to avoid linking to
4150
# libintl on MacOS, since that will make the binary
4251
# non portable
43-
cd spack-src && git apply ../gnupg/patches/gnupg_macos.patch && cd ..
52+
git -C spack apply "$PWD/gnupg/patches/gnupg_macos.patch"
4453
45-
. spack-src/share/spack/setup-env.sh
54+
. spack/share/spack/setup-env.sh
4655
spack external find --not-buildable gawk perl
47-
spack config add "config:concretizer:original"
4856
spack config add "config:install_tree:padded_length:256"
49-
mkdir -p binary-mirror
5057
51-
# Inject flags to have compatibility with MacOSX version 10.13 or higher
52-
spack install gnupg cflags="-mmacosx-version-min=10.13" target=${{ matrix.runner[1] }}
53-
spack buildcache push --unsigned --force $PWD/binary-mirror gnupg
58+
spack install gnupg target=${{ matrix.runner[1] }}
59+
spack buildcache push --unsigned ./binary-mirror gnupg
5460
- uses: actions/upload-artifact@v3
5561
with:
5662
name: gnupg_binary_mirror
@@ -106,31 +112,31 @@ jobs:
106112

107113
steps:
108114
- uses: actions/checkout@v4
109-
- run: |
110-
. ./gnupg/scripts/copy_mirror_manylinux2014.sh
115+
- run: ./copy_mirror_manylinux2014.sh
111116
- uses: actions/upload-artifact@v3
112117
with:
113118
name: gnupg_binary_mirror
114-
path: |
115-
binary-mirror
119+
path: binary-mirror
116120

117121
gnupg_json:
118122
runs-on: ubuntu-latest
119123
needs: [ upload-manylinux2014, macos_gnupg ]
120124
steps:
121125
- uses: actions/checkout@v4
126+
- uses: actions/checkout@v4
127+
with:
128+
repository: spack/spack
129+
path: spack
122130
- uses: actions/setup-python@v4
123131
with:
124132
python-version: 3.11
125133
- uses: actions/download-artifact@v3
126134
with:
127135
name: gnupg_binary_mirror
128136
- run: |
129-
git clone https://github.com/spack/spack.git spack-src
130-
. spack-src/share/spack/setup-env.sh
137+
. spack/share/spack/setup-env.sh
131138
spack python gnupg/scripts/gnupg_json.py
132139
- uses: actions/upload-artifact@v3
133140
with:
134141
name: gnupg_manifest
135-
path: |
136-
gnupg.json
142+
path: gnupg.json

.github/workflows/patchelf.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ concurrency:
1515
group: patchelf-${{ github.ref }}
1616
cancel-in-progress: true
1717

18+
env:
19+
SPACK_COLOR: always
20+
SPACK_BACKTRACE: please
21+
PYTHONUNBUFFERED: 1
22+
1823
jobs:
1924

2025
manylinux2014:
@@ -67,13 +72,11 @@ jobs:
6772

6873
steps:
6974
- uses: actions/checkout@v4
70-
- run: |
71-
. ./patchelf/scripts/copy_mirror_manylinux2014.sh
75+
- run: ./copy_mirror_manylinux2014.sh
7276
- uses: actions/upload-artifact@v3
7377
with:
7478
name: patchelf_binary_mirror
75-
path: |
76-
binary-mirror
79+
path: binary-mirror
7780

7881
patchelf_json:
7982
runs-on: ubuntu-latest
@@ -88,9 +91,8 @@ jobs:
8891
name: patchelf_binary_mirror
8992
- run: |
9093
pip install ruamel.yaml
91-
python patchelf/scripts/patchelf_json.py
94+
python3 patchelf/scripts/patchelf_json.py
9295
- uses: actions/upload-artifact@v3
9396
with:
9497
name: patchelf_manifest
95-
path: |
96-
patchelf.json
98+
path: patchelf.json

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ For completeness we report a summary of Spack requirements below:
2626

2727
Name | Supported Versions | System Requirement | Requirement Reason
2828
--- | -------------------|---------------------|--------------------
29-
Python | 3.6-3.12 | Yes | Interpreter for Spack
29+
Python | 3.6-3.13 | Yes | Interpreter for Spack
3030
C/C++ compilers | - | Yes | Building software
3131
GNU make | - | Yes | Building software
3232
patch | - | Yes | Building software
@@ -53,11 +53,11 @@ by compatibility with the [manylinux](https://github.com/pypa/manylinux) project
5353

5454
Platform | OS | Compiler Toolchain | Architecture | Python
5555
---------|----|--------------------|--------------|-------
56-
`linux` | `centos7` | `GCC 10.2.1`| `x86_64` | 3.6-3.12
57-
`linux` | `centos7` | `GCC 10.2.1`| `aarch64` | 3.6-3.12
58-
`linux` | `centos7` | `GCC 10.2.1`| `ppc64le` | 3.6-3.12
59-
`darwin`| `MacOS 10.13` or later | `Apple Clang 14.0.0` | `x86_64` | 3.6-3.12
60-
`darwin`| `MacOS 10.13` or later | `Apple Clang 14.0.3` | `aarch64` | 3.6-3.12
56+
`linux` | `centos7` | `GCC 10.2.1`| `x86_64` | 3.6-3.13
57+
`linux` | `centos7` | `GCC 10.2.1`| `aarch64` | 3.6-3.13
58+
`linux` | `centos7` | `GCC 10.2.1`| `ppc64le` | 3.6-3.13
59+
`darwin`| `MacOS 10.13` or later | `Apple Clang 14.0.0` | `x86_64` | 3.6-3.13
60+
`darwin`| `MacOS 10.13` or later | `Apple Clang 14.0.3` | `aarch64` | 3.6-3.13
6161

6262
## Github Actions Workflows
6363

clingo/Dockerfile.manylinux2014

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,32 @@
1-
FROM ghcr.io/spack/manylinux2014:v2023-10-03
1+
FROM ghcr.io/spack/manylinux2014:v2024-10-16
22

3-
RUN cd /opt/_internal && tar xvf static-libs-for-embedding-only.tar.xz && cd -
3+
RUN tar -C /opt/_internal -xvf /opt/_internal/static-libs-for-embedding-only.tar.xz
44

5-
RUN adduser -m spack
6-
7-
# Switch to a non-root user
8-
USER spack
9-
ENV SPACK_CMD="/opt/python/cp311-cp311/bin/python /home/spack/spack/bin/spack"
10-
WORKDIR /home/spack
5+
WORKDIR /root
6+
ENV PATH="/root/spack/bin/:$PATH" \
7+
SPACK_BACKTRACE=please \
8+
SPACK_COLOR=always \
9+
SPACK_PYTHON=/opt/python/cp311-cp311/bin/python \
10+
PYTHONUNBUFFERED=1
1111

1212
# Clone the repo and install Spack
13-
RUN git clone https://www.github.com/spack/spack.git && \
14-
cd spack && \
15-
git checkout -b docker-reference 08da9a854a53542e1f71d30ed8d14d6b7d18119f && \
16-
cd ..
13+
RUN git clone https://github.com/spack/spack.git && \
14+
git -C spack checkout -b docker-reference c710a1597f3566ab850d0ee8c82e71af04a08f9e
1715

1816
# Set externals, locate compilers
19-
RUN ${SPACK_CMD} external find -j 1 --not-buildable bison cmake
20-
RUN ${SPACK_CMD} compiler find
21-
RUN ${SPACK_CMD} config add "config:concretizer:original"
22-
RUN ${SPACK_CMD} config add "config:install_tree:padded_length:256"
23-
24-
# Run a script to build all the versions of clingo we could
25-
COPY --chown=spack:spack clingo/scripts/bootstrap_clingo_manylinux2014.sh /home/spack/bootstrap_clingo2014.sh
26-
COPY --chown=spack:spack clingo/scripts/install_clingo.py /home/spack/install_clingo.py
27-
28-
RUN ${HOME}/bootstrap_clingo2014.sh 36
29-
RUN ${HOME}/bootstrap_clingo2014.sh 37
30-
RUN ${HOME}/bootstrap_clingo2014.sh 38
31-
RUN ${HOME}/bootstrap_clingo2014.sh 39
32-
RUN ${HOME}/bootstrap_clingo2014.sh 310
33-
RUN ${HOME}/bootstrap_clingo2014.sh 311
34-
RUN ${HOME}/bootstrap_clingo2014.sh 312
35-
36-
COPY --chown=spack:spack clingo/scripts/create_binary_mirror.sh /home/spack/create_binary_mirror.sh
37-
RUN ${HOME}/create_binary_mirror.sh
17+
RUN spack external find -j 1 --not-buildable bison cmake
18+
RUN spack compiler find
19+
RUN spack config add "config:install_tree:padded_length:256"
20+
21+
COPY clingo/scripts/install_clingo.py /root/install_clingo.py
22+
23+
RUN SPACK_PYTHON=/opt/python/cp313-cp313/bin/python3 spack python install_clingo.py
24+
RUN SPACK_PYTHON=/opt/python/cp312-cp312/bin/python3 spack python install_clingo.py
25+
RUN SPACK_PYTHON=/opt/python/cp311-cp311/bin/python3 spack python install_clingo.py
26+
RUN SPACK_PYTHON=/opt/python/cp310-cp310/bin/python3 spack python install_clingo.py
27+
RUN SPACK_PYTHON=/opt/python/cp39-cp39/bin/python3 spack python install_clingo.py
28+
RUN SPACK_PYTHON=/opt/python/cp38-cp38/bin/python3 spack python install_clingo.py
29+
RUN SPACK_PYTHON=/opt/python/cp37-cp37m/bin/python3 spack python install_clingo.py
30+
RUN SPACK_PYTHON=/opt/python/cp36-cp36m/bin/python3 spack python install_clingo.py
31+
32+
RUN spack buildcache push --unsigned ./binary-mirror $(spack --color=never find --hashes clingo-bootstrap)

clingo/packages.yaml

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)