Skip to content

Commit 67888d0

Browse files
committed
scripts
1 parent e4fa578 commit 67888d0

File tree

3 files changed

+66
-27
lines changed

3 files changed

+66
-27
lines changed

scripts/Dockerfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ RUN apt-get update && \
55
apt-get install -y vim curl wget sudo sqlite3 vim && \
66
apt-get install -y build-essential cmake gdb python3-full python3-numpy python3-tabulate python3-click && \
77
apt-get install -y clang llvm && \
8-
# seems to be mandatory/useful to compile Python 3.x
9-
apt-get install -y libssl-dev liblzma-dev libreadline-dev libncursesw5-dev libsqlite3-dev tk-dev libgdbm-dev libgdbm-compat-dev libbz2-dev libffi-dev zlib1g-dev && \
108
# dependency for some puzzles
119
apt-get install -y z3 && \
1210
# required to build shapely and numpy, if needed
@@ -21,12 +19,12 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
2119
rustup component add rust-src && \
2220
chmod -R 777 /usr/local/cargo
2321

24-
# Python 3.13
22+
# Python 3.12
2523
COPY allpython.sh /
26-
RUN /allpython.sh 3.13.1
24+
RUN /allpython.sh 3.12.12
2725

2826
COPY requirements.txt /
29-
RUN /opt/python/Python-3.13.1/bin/python3.13 -mvenv /venv/python && \
27+
RUN /opt/python/Python-3.12.12/bin/python3.12 -mvenv /venv/python && \
3028
/venv/python/bin/pip install -r /requirements.txt
3129

3230
# Golang

scripts/allpython.sh

Lines changed: 56 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,85 @@
22

33
set -euo pipefail
44

5-
# Requirements:
6-
# macOS
7-
#
8-
# Debian
9-
# apt-get install -y libssl-dev liblzma-dev libreadline-dev libncursesw5-dev libsqlite3-dev tk-dev libgdbm-dev libgdbm-compat-dev libbz2-dev libffi-dev zlib1g-dev
10-
# Fedora
11-
# dnf install -y openssl-devel libuuid-devel sqlite-devel ncurses-devel bzip2-devel gdbm-devel libffi-devel readline-devel tk-devel
12-
135
script_dir=$(realpath $(dirname $0))
146

157
mkdir -p /opt/python
168

9+
prerequesites()
10+
{
11+
case $(uname -s) in
12+
Darwin)
13+
# TODO
14+
brew install --quiet tcl-tk
15+
;;
16+
Linux)
17+
if [[ ! -f /.dockerenv ]] ; then
18+
return
19+
fi
20+
21+
if [[ -f /etc/os-release ]] ; then
22+
source /etc/os-release
23+
case $ID in
24+
debian|ubuntu)
25+
apt-get install -y curl gcc libssl-dev liblzma-dev libreadline-dev libncursesw5-dev libsqlite3-dev tk-dev libgdbm-dev libgdbm-compat-dev libbz2-dev libffi-dev zlib1g-dev libzstd-dev
26+
;;
27+
fedora)
28+
dnf install -y curl gcc openssl-devel libuuid-devel sqlite-devel ncurses-devel bzip2-devel gdbm-devel libffi-devel readline-devel tk-devel libzstd-devel mpdecimal-devel
29+
;;
30+
*)
31+
echo "Unknown Linux distro $ID"
32+
exit 1
33+
;;
34+
esac
35+
else
36+
echo "Unknown Linux distro"
37+
exit 1
38+
fi
39+
;;
40+
*)
41+
echo "Unknown system: $(uname -s)"
42+
exit 1
43+
;;
44+
esac
45+
46+
}
47+
1748
i()
1849
{
1950
local v=$1
20-
2151
local b=$(echo $v | cut -f1 -d'a') # major.minor.micro
2252
local m=$(echo $v | cut -f1-2 -d'.') # major.minor
2353
local url=https://www.python.org/ftp/python/$b/Python-$v.tar.xz
2454

55+
prerequesites
56+
2557
rm -rf /tmp/Python-$v /opt/python/Python-$v
2658
curl -sL $url | tar -C /tmp -xJ
2759
cd /tmp/Python-$v
28-
./configure --prefix=/opt/python/Python-$v --enable-optimizations
60+
61+
./configure --prefix=/opt/python/Python-$(sed -E '/\bPY_VERSION\b/s/.*"([0-9.a-z]+)".*/\1/p;d' Include/patchlevel.h) --enable-optimizations
62+
echo
63+
echo "********************************"
64+
cat config.log | grep "^py_cv_module_" | grep -Ev "=yes$"
65+
echo "********************************"
66+
echo
2967
! cat config.log | grep "^py_cv_module_" | grep -Ev "=(yes|n/a)$" | grep -q ^
68+
3069
make -j$(nproc --ignore=1)
3170
make altinstall
32-
# /opt/python/Python-$v/bin/python$m -mensurepip
71+
3372
cd /tmp
3473
rm -rf /tmp/Python-$v
35-
36-
if [ -f $script_dir/runall.py ] ; then
37-
$script_dir/runall.py --venv /opt/python/Python-$v/bin/python$m
38-
fi
3974
}
4075

4176
a()
4277
{
43-
i 3.10.16
44-
i 3.11.11
45-
i 3.12.8
46-
i 3.13.1
78+
# i 3.10.18
79+
# i 3.11.14
80+
i 3.12.12
81+
i 3.13.9
82+
i 3.14.0
83+
# i 3.15.0a1
4784
}
4885

4986
if [ ${1-} ]; then

scripts/runall.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"Py3.11": ".venv/py3.11/bin/python3",
6262
"Py3.12": ".venv/py3.12/bin/python3",
6363
"Py3.13": ".venv/py3.13/bin/python3",
64+
"Py3.14": ".venv/py3.14/bin/python3",
6465
},
6566
"JavaScript": {
6667
"NodeJS": "node",
@@ -665,8 +666,8 @@ def main():
665666
parser.add_argument("--cache", type=Path, help="cache database")
666667
parser.add_argument("--working-dir", type=Path, help=argparse.SUPPRESS)
667668

668-
parser.add_argument("--venv", type=Path, help="create and install virtual environment")
669-
parser.add_argument("--reqs", action="store_true", help="install requirements into virtual environments")
669+
# parser.add_argument("--venv", type=Path, help="create and install virtual environment")
670+
# parser.add_argument("--reqs", action="store_true", help="install requirements into virtual environments")
670671
parser.add_argument("-c", "--consistency", action="store_true", help="verify duration consistency")
671672

672673
parser.add_argument("-u", "--user", dest="filter_user", metavar="USER", type=str, help="filter by user id")
@@ -895,7 +896,10 @@ def main():
895896
for lang1, lang2 in itertools.combinations(languages, 2):
896897
n, t1, t2 = 0, 0, 0
897898
for y, d in puzzles:
898-
t = dict((lang, t) for (yy, dd, lang), (t, _) in stats_elapsed.items() if (yy, dd) == (y, d))
899+
900+
t = dict(
901+
(lang, t) for (yy, dd, dd_str, lang), (t, _) in stats_elapsed.items() if (yy, dd) == (y, d)
902+
)
899903
if lang1 in t and lang2 in t:
900904
n += 1
901905
t1 += t[lang1]

0 commit comments

Comments
 (0)