Skip to content

Commit

Permalink
Merge branch 'release/1.20231016'
Browse files Browse the repository at this point in the history
  • Loading branch information
austrin committed Oct 16, 2023
2 parents 876690a + 32a6874 commit 449d853
Show file tree
Hide file tree
Showing 102 changed files with 1,979 additions and 510 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: python
python:
- 2.7
- 3.7

script: py.test
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:18.04
FROM ubuntu:20.04

MAINTAINER [email protected]

Expand All @@ -14,16 +14,16 @@ RUN apt-get update && \
libgmp10 \
libgmpxx4ldbl \
openjdk-8-jdk \
python-minimal \
python-pip \
python-plastex \
python-yaml \
python3-minimal \
python3-pip \
python3-plastex \
python3-yaml \
sudo \
texlive-fonts-recommended \
texlive-lang-cyrillic \
texlive-latex-extra \
texlive-latex-recommended \
texlive-plain-generic \
tidy \
vim

RUN pip install git+https://github.com/kattis/problemtools
RUN pip3 install git+https://github.com/kattis/problemtools
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
all:
all: checktestdata
make -C support

builddeb:
builddeb: checktestdata
dpkg-buildpackage -us -uc -tc -b

checktestdata: support/checktestdata/bootstrap

support/checktestdata/bootstrap:
git submodule update --init
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ A few examples of problem packages can be found in [examples](examples).

## Installing problemtools

There are four recommended ways of installing and running problemtools.
There are four supported ways of installing and running problemtools.
(For non-Linux users, "Method 2" below, to use Docker, is probably the least painful.)

### Method 1: Install the Python package

Run
```
pip install git+https://github.com/kattis/problemtools
pip3 install git+https://github.com/kattis/problemtools
```

Or if you don't want a system-wide installation,
```
pip install --user git+https://github.com/kattis/problemtools
pip3 install --user git+https://github.com/kattis/problemtools
```
With this second option, in order to get the command line scripts, you need
to make sure that the local user bin path used (e.g., on Linux,
Expand Down Expand Up @@ -153,18 +153,18 @@ problemtools' configuration:

1. `languages.yaml`. Use it to override problemtools' default
programming language configuration. For instance, while the
problemtools default is to use the CPython `/usr/bin/python2`
interpreter for Python 2, many contests, as well as the Kattis
online judge, use Pypy as the interpreter for Python 2. To change
problemtools default is to use the CPython `/usr/bin/python3`
interpreter for Python 3, many contests, as well as the Kattis
online judge, use Pypy as the interpreter for Python 3. To change
this on your machine, you can simply place a file
`/etc/kattis/problemtools/languages.yaml` (or
`~/.config/problemtools/languages.yaml` if you only want to make the
change for your user) containing the following:

```yaml
python2:
name: 'Python 2 w/Pypy'
run: '/usr/bin/pypy "{mainfile}"'
python3:
name: 'Python 3 w/Pypy'
run: '/usr/bin/pypy3 "{mainfile}"'
```
Here, overriding the name of the language is not strictly
necessary, but it is often helpful to clearly indicate that Pypy is
Expand Down Expand Up @@ -196,28 +196,28 @@ problemtools' configuration:

## Requirements and compatibility

To build and run the tools, you need Python 2 with the YAML and PlasTeX libraries,
To build and run the tools, you need Python 3 with the YAML and PlasTeX libraries,
and a LaTeX installation.

### Ubuntu

The dependencies needed to *build/install* problemtools can be installed with:

sudo apt install automake g++ make libboost-regex-dev libgmp-dev libgmp10 libgmpxx4ldbl python python-pytest python-setuptools python-yaml
sudo apt install automake g++ make libboost-regex-dev libgmp-dev libgmp10 libgmpxx4ldbl python3 python3-pytest python3-setuptools python3-yaml python3-plastex

And the dependencies needed to *run* problemtools can be installed with:

sudo apt install ghostscript libgmpxx4ldbl python-minimal python-pkg-resources python-plastex python-yaml texlive-fonts-recommended texlive-generic-recommended texlive-lang-cyrillic texlive-latex-extra texlive-latex-recommended tidy
sudo apt install ghostscript libgmpxx4ldbl python3-minimal python-pkg-resources python3-plastex python3-yaml texlive-fonts-recommended texlive-lang-cyrillic texlive-latex-extra texlive-plain-generic tidy

### Fedora

On Fedora, these dependencies can be installed with:

sudo dnf install boost-regex gcc gmp-devel gmp-c++ python2 python2-pyyaml texlive-latex texlive-collection-fontsrecommended texlive-fancyhdr texlive-subfigure texlive-wrapfig texlive-import texlive-ulem texlive-xifthen texlive-overpic texlive-pbox tidy ghostscript
sudo dnf install boost-regex gcc gmp-devel gmp-c++ python3 python3-pyyaml texlive-latex texlive-collection-fontsrecommended texlive-fancyhdr texlive-subfigure texlive-wrapfig texlive-import texlive-ulem texlive-xifthen texlive-overpic texlive-pbox tidy ghostscript

Followed by:

pip2 install --user plastex
pip3 install --user plastex

### Other platforms

Expand Down
7 changes: 2 additions & 5 deletions admin/docker/Dockerfile.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# version of problemtools to be built (default is latest version of
# develop branch on GitHub)

FROM ubuntu:18.04
FROM ubuntu:22.04

LABEL maintainer="[email protected]"

Expand All @@ -29,10 +29,7 @@ RUN apt update && \
python3-pytest \
python3-setuptools \
python3-yaml \
python \
python-pytest \
python-setuptools \
python-yaml
python3-setuptools

RUN mkdir -p /usr/local/problemtools_build

Expand Down
25 changes: 16 additions & 9 deletions admin/docker/Dockerfile.full
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,22 @@ ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get install -y \
mono-complete \
ghc haskell-platform \
libmozjs-52-dev \
gccgo \
fp-compiler \
php-cli \
swi-prolog \
scala \
sbcl \
gfortran \
gnucobol \
gccgo \
ghc haskell-platform \
gnustep-devel gnustep gnustep-make gnustep-common gobjc \
libgmp3-dev \
libmozjs-78-dev \
lua5.4 \
mono-complete \
nodejs \
ocaml-nox \
php-cli \
pypy \
rustc \
;
sbcl \
scala \
swi-prolog \
;
37 changes: 16 additions & 21 deletions admin/docker/Dockerfile.icpc
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Basic problemtools docker image, containing problemtools and the
# "ICPC languages" (C, C++, Java, Python 2, Python 3, and Kotlin)
# "ICPC languages" (C, C++, Java, Kotlin, and Python 3)
#
# Build requirements:
# - Kotlin must be available from the host file system under
# artifacts/kotlin/kotlinc.zip

ARG PROBLEMTOOLS_VERSION=develop
FROM problemtools/minimal:${PROBLEMTOOLS_VERSION}
Expand All @@ -12,31 +9,29 @@ LABEL maintainer="[email protected]"

ENV DEBIAN_FRONTEND=noninteractive

# Install C++, Java, PyPy and Python 3
# Install C++, Java, Kotlin, and PyPy 3 via their ppa repository
RUN apt update && \
apt install -y software-properties-common && \
add-apt-repository ppa:pypy/ppa && \
apt update && \
apt install -y \
g++ \
openjdk-11-jdk \
pypy \
python3

# Install Kotlin
WORKDIR /usr/local
COPY artifacts/kotlin/kotlinc.zip /tmp
RUN unzip /tmp/kotlinc.zip
RUN ln -s /usr/local/kotlinc/bin/* bin/
gcc g++ \
openjdk-11-jdk openjdk-11-jre \
kotlin \
pypy3

# Reconfigure problemtools:
# - Use PyPy for Python 2
# - Use /usr/local/bin rather than /usr/bin for Kotlin
# - Use PyPy for Python 2 (not available in this image but in the full one)
# - Use PyPy for Python 3
RUN mkdir -p /etc/kattis/problemtools
RUN echo " \n\
python2: \n\
name: 'Python 2 w/PyPy'\n\
run: '/usr/bin/pypy \"{mainfile}\"'\n\
\n\
kotlin: \n\
compile: '/usr/local/bin/kotlinc -d {path}/ -- {files}' \n\
run: '/usr/local/bin/kotlin -Dfile.encoding=UTF-8 -J-XX:+UseSerialGC -J-Xss64m -J-Xms{memlim}m -J-Xmx{memlim}m -cp {path}/ {Mainclass}Kt' " > /etc/kattis/problemtools/languages.yaml
python3: \n\
name: 'Python 3 w/PyPy'\n\
run: '/usr/bin/pypy3 \"{mainfile}\"'\n\
\n" > /etc/kattis/problemtools/languages.yaml

WORKDIR /
WORKDIR /
11 changes: 4 additions & 7 deletions admin/docker/Dockerfile.minimal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Minimalistic problemtools docker image, containing only problemtools
# and its dependencies, no languages (except whichever are
# dependencies of problemtools, e.g. Python 2)
# dependencies of problemtools, e.g. Python 3)
#
# Build requirements:
# - The problemtools .deb package must be available from the host file
Expand All @@ -10,7 +10,7 @@
# PROBLEMTOOLS_VERSION but this is not checked.)

ARG PROBLEMTOOLS_VERSION=develop
FROM ubuntu:18.04
FROM ubuntu:22.04

LABEL maintainer="[email protected]"

Expand All @@ -20,17 +20,14 @@ RUN apt update && \
apt install -y \
ghostscript \
libgmpxx4ldbl \
python-minimal \
python-pkg-resources \
python-plastex \
python-yaml \
python3-minimal \
python3-yaml \
python3-plastex \
texlive-fonts-recommended \
texlive-generic-recommended \
texlive-lang-cyrillic \
texlive-latex-extra \
texlive-latex-recommended \
texlive-plain-generic \
tidy

RUN mkdir -p /usr/local/artifacts
Expand Down
14 changes: 1 addition & 13 deletions admin/update_docker.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#!/bin/bash
set -e

KOTLIN_VERSION=1.3.50


TAG=develop
UPDATE_LATEST=false
if [ "$1" != "" ]; then
Expand All @@ -28,16 +25,6 @@ rm -rf artifacts/deb/*
sudo docker run --rm -v "$(pwd)/artifacts/:/artifacts" problemtools/build:${TAG} cp -r /usr/local/problemtools_build/deb /artifacts
sudo chown -R $USER:$USER artifacts/

# Get Kotlin since it is not available through apt
# ===============================================
mkdir -p artifacts/kotlin
curl -L -o artifacts/kotlin/kotlinc.zip https://github.com/JetBrains/kotlin/releases/download/v${KOTLIN_VERSION}/kotlin-compiler-${KOTLIN_VERSION}.zip

# FIXME(?): The "-linux-x64" version sounds correct but seems broken
#curl -L -o artifacts/kotlin/kotlinc.zip https://github.com/JetBrains/kotlin/releases/download/v${KOTLIN_VERSION}/kotlin-compiler-${KOTLIN_VERSION}-linux-x64.zip

# ===============================================


# Build the actual problemtools images
# ===============================================
Expand All @@ -52,6 +39,7 @@ for IMAGE in minimal icpc full; do
fi
done


# Push to Docker Hub
# ===============================================
sudo docker login
Expand Down
2 changes: 1 addition & 1 deletion admin/update_version.py.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ else
# remove leading 'v' from git tag
VERSION=${VERSION:1}
# PEP440 compliance: change "-{#commits}-{last commit ID}" suffix to ".dev{#commits}"
VERSION=$(echo $VERSION | sed -r "s/-(.*)-.*$/.dev\1/g")
VERSION=$(echo $VERSION | sed -r "s/-([^-]*)-[^-]*$/.dev\1/g")
fi

cat <<EOF > $ROOT/problemtools/_version.py
Expand Down
4 changes: 2 additions & 2 deletions bin/problem2html.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
# not be used.

export PYTHONPATH
PYTHONPATH="$(dirname "$(dirname "$(readlink -f "$0")")"):$PYTHONPATH"
exec python2 -m problemtools.problem2html "$@"
PYTHONPATH="$(dirname "$(dirname "$(readlink -f "$0")")")${PYTHONPATH:+:}$PYTHONPATH"
exec python3 -m problemtools.problem2html "$@"
4 changes: 2 additions & 2 deletions bin/problem2pdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
# not be used.

export PYTHONPATH
PYTHONPATH="$(dirname "$(dirname "$(readlink -f "$0")")"):$PYTHONPATH"
exec python2 -m problemtools.problem2pdf "$@"
PYTHONPATH="$(dirname "$(dirname "$(readlink -f "$0")")")${PYTHONPATH:+:}$PYTHONPATH"
exec python3 -m problemtools.problem2pdf "$@"
4 changes: 2 additions & 2 deletions bin/verifyproblem.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
# not be used.

export PYTHONPATH
PYTHONPATH="$(dirname "$(dirname "$(readlink -f "$0")")"):$PYTHONPATH"
exec python2 -m problemtools.verifyproblem "$@"
PYTHONPATH="$(dirname "$(dirname "$(readlink -f "$0")")")${PYTHONPATH:+:}$PYTHONPATH"
exec python3 -m problemtools.verifyproblem "$@"
Loading

0 comments on commit 449d853

Please sign in to comment.