Skip to content

Commit 47277d5

Browse files
committed
Remove dependencies on python2, move to python3
Also replace libmozjs with nodejs.
1 parent 307bcbf commit 47277d5

File tree

28 files changed

+84
-72
lines changed

28 files changed

+84
-72
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
language: python
22
python:
3-
- 2.7
43
- 3.7
54

65
script: py.test

Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:18.04
1+
FROM ubuntu:20.04
22

33
44

@@ -14,10 +14,10 @@ RUN apt-get update && \
1414
libgmp10 \
1515
libgmpxx4ldbl \
1616
openjdk-8-jdk \
17-
python-minimal \
18-
python-pip \
19-
python-plastex \
20-
python-yaml \
17+
python3-minimal \
18+
python3-pip \
19+
python3-plastex \
20+
python3-yaml \
2121
sudo \
2222
texlive-fonts-recommended \
2323
texlive-lang-cyrillic \
@@ -26,4 +26,4 @@ RUN apt-get update && \
2626
tidy \
2727
vim
2828

29-
RUN pip install git+https://github.com/kattis/problemtools
29+
RUN pip3 install git+https://github.com/ghamerly/problemtools@move-to-py3

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ There are four recommended ways of installing and running problemtools.
3535

3636
Run
3737
```
38-
pip install git+https://github.com/kattis/problemtools
38+
pip3 install git+https://github.com/kattis/problemtools
3939
```
4040

4141
Or if you don't want a system-wide installation,
4242
```
43-
pip install --user git+https://github.com/kattis/problemtools
43+
pip3 install --user git+https://github.com/kattis/problemtools
4444
```
4545
With this second option, in order to get the command line scripts, you need
4646
to make sure that the local user bin path used (e.g., on Linux,
@@ -153,18 +153,18 @@ problemtools' configuration:
153153
154154
1. `languages.yaml`. Use it to override problemtools' default
155155
programming language configuration. For instance, while the
156-
problemtools default is to use the CPython `/usr/bin/python2`
157-
interpreter for Python 2, many contests, as well as the Kattis
158-
online judge, use Pypy as the interpreter for Python 2. To change
156+
problemtools default is to use the CPython `/usr/bin/python3`
157+
interpreter for Python 3, many contests, as well as the Kattis
158+
online judge, use Pypy as the interpreter for Python 3. To change
159159
this on your machine, you can simply place a file
160160
`/etc/kattis/problemtools/languages.yaml` (or
161161
`~/.config/problemtools/languages.yaml` if you only want to make the
162162
change for your user) containing the following:
163163
164164
```yaml
165-
python2:
166-
name: 'Python 2 w/Pypy'
167-
run: '/usr/bin/pypy "{mainfile}"'
165+
python3:
166+
name: 'Python 3 w/Pypy'
167+
run: '/usr/bin/pypy3 "{mainfile}"'
168168
```
169169
Here, overriding the name of the language is not strictly
170170
necessary, but it is often helpful to clearly indicate that Pypy is
@@ -196,14 +196,14 @@ problemtools' configuration:
196196
197197
## Requirements and compatibility
198198
199-
To build and run the tools, you need Python 2 with the YAML and PlasTeX libraries,
199+
To build and run the tools, you need Python 3 with the YAML and PlasTeX libraries,
200200
and a LaTeX installation.
201201
202202
### Ubuntu
203203
204204
The dependencies needed to *build/install* problemtools can be installed with:
205205
206-
sudo apt install automake g++ make libboost-regex-dev libgmp-dev libgmp10 libgmpxx4ldbl python python-pytest python-setuptools python-yaml
206+
sudo apt install automake g++ make libboost-regex-dev libgmp-dev libgmp10 libgmpxx4ldbl python3 python3-pytest python3-setuptools python3-yaml python3-plastex
207207
208208
And the dependencies needed to *run* problemtools can be installed with:
209209
@@ -213,11 +213,11 @@ And the dependencies needed to *run* problemtools can be installed with:
213213
214214
On Fedora, these dependencies can be installed with:
215215
216-
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
216+
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
217217
218218
Followed by:
219219
220-
pip2 install --user plastex
220+
pip3 install --user plastex
221221
222222
### Other platforms
223223

admin/docker/Dockerfile.build

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# version of problemtools to be built (default is latest version of
66
# develop branch on GitHub)
77

8-
FROM ubuntu:18.04
8+
FROM ubuntu:20.04
99

1010
LABEL maintainer="[email protected]"
1111

@@ -29,10 +29,7 @@ RUN apt update && \
2929
python3-pytest \
3030
python3-setuptools \
3131
python3-yaml \
32-
python \
33-
python-pytest \
34-
python-setuptools \
35-
python-yaml
32+
python3-setuptools
3633

3734
RUN mkdir -p /usr/local/problemtools_build
3835

admin/docker/Dockerfile.full

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ RUN apt-get update && \
2020
swi-prolog \
2121
scala \
2222
sbcl \
23+
nodejs \
2324
ocaml-nox \
2425
rustc \
25-
;
26+
;

admin/docker/Dockerfile.icpc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RUN apt update && \
1818
g++ \
1919
openjdk-11-jdk \
2020
pypy \
21-
python3
21+
pypy3
2222

2323
# Install Kotlin
2424
WORKDIR /usr/local
@@ -28,15 +28,20 @@ RUN ln -s /usr/local/kotlinc/bin/* bin/
2828

2929
# Reconfigure problemtools:
3030
# - Use PyPy for Python 2
31+
# - Use PyPy for Python 3
3132
# - Use /usr/local/bin rather than /usr/bin for Kotlin
3233
RUN mkdir -p /etc/kattis/problemtools
3334
RUN echo " \n\
3435
python2: \n\
3536
name: 'Python 2 w/PyPy'\n\
3637
run: '/usr/bin/pypy \"{mainfile}\"'\n\
3738
\n\
39+
python3: \n\
40+
name: 'Python 3 w/PyPy'\n\
41+
run: '/usr/bin/pypy3 \"{mainfile}\"'\n\
42+
\n\
3843
kotlin: \n\
3944
compile: '/usr/local/bin/kotlinc -d {path}/ -- {files}' \n\
4045
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
4146

42-
WORKDIR /
47+
WORKDIR /

admin/docker/Dockerfile.minimal

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Minimalistic problemtools docker image, containing only problemtools
22
# and its dependencies, no languages (except whichever are
3-
# dependencies of problemtools, e.g. Python 2)
3+
# dependencies of problemtools, e.g. Python 3)
44
#
55
# Build requirements:
66
# - The problemtools .deb package must be available from the host file
@@ -10,7 +10,7 @@
1010
# PROBLEMTOOLS_VERSION but this is not checked.)
1111

1212
ARG PROBLEMTOOLS_VERSION=develop
13-
FROM ubuntu:18.04
13+
FROM ubuntu:20.04
1414

1515
LABEL maintainer="[email protected]"
1616

@@ -20,12 +20,10 @@ RUN apt update && \
2020
apt install -y \
2121
ghostscript \
2222
libgmpxx4ldbl \
23-
python-minimal \
2423
python-pkg-resources \
25-
python-plastex \
26-
python-yaml \
2724
python3-minimal \
2825
python3-yaml \
26+
python3-plastex \
2927
texlive-fonts-recommended \
3028
texlive-lang-cyrillic \
3129
texlive-latex-extra \

bin/problem2html.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77

88
export PYTHONPATH
99
PYTHONPATH="$(dirname "$(dirname "$(readlink -f "$0")")"):$PYTHONPATH"
10-
exec python2 -m problemtools.problem2html "$@"
10+
exec python3 -m problemtools.problem2html "$@"

bin/problem2pdf.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77

88
export PYTHONPATH
99
PYTHONPATH="$(dirname "$(dirname "$(readlink -f "$0")")"):$PYTHONPATH"
10-
exec python2 -m problemtools.problem2pdf "$@"
10+
exec python3 -m problemtools.problem2pdf "$@"

bin/verifyproblem.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77

88
export PYTHONPATH
99
PYTHONPATH="$(dirname "$(dirname "$(readlink -f "$0")")"):$PYTHONPATH"
10-
exec python2 -m problemtools.verifyproblem "$@"
10+
exec python3 -m problemtools.verifyproblem "$@"

0 commit comments

Comments
 (0)