Skip to content

Commit 648fecd

Browse files
authored
Merge branch 'master' into dependabot/pip/patool-gte-1.12-and-lt-3.1
2 parents 9b9c342 + 39d272b commit 648fecd

File tree

47 files changed

+406
-170
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+406
-170
lines changed

.github/workflows/main.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@ jobs:
2525
run: |
2626
docker compose -p cms -f docker-compose.test.yml run --rm testcms
2727
28-
- uses: codecov/codecov-action@v3
28+
- uses: codecov/codecov-action@v4
29+
env:
30+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2931
with:
3032
files: ./codecov/unittests.xml
3133
flags: unittests
3234

33-
- uses: codecov/codecov-action@v3
35+
- uses: codecov/codecov-action@v4
36+
env:
37+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
3438
with:
3539
files: ./codecov/functionaltests.xml
3640
flags: functionaltests

Dockerfile

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
# syntax=docker/dockerfile:1
2-
FROM ubuntu:20.04
2+
FROM ubuntu:24.04
33

44
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
55
build-essential \
66
cgroup-lite \
77
cppreference-doc-en-html \
88
fp-compiler \
99
git \
10-
haskell-platform \
10+
ghc \
1111
libcap-dev \
1212
libcups2-dev \
1313
libffi-dev \
1414
libpq-dev \
1515
libyaml-dev \
1616
mono-mcs \
1717
openjdk-8-jdk-headless \
18-
php7.4-cli \
18+
php-cli \
1919
postgresql-client \
20-
python2 \
20+
pypy3 \
2121
python3-pip \
22-
python3.8 \
23-
python3.8-dev \
22+
python3.12 \
23+
python3.12-dev \
2424
rustc \
25+
shared-mime-info \
2526
sudo \
2627
wait-for-it \
2728
zip
@@ -39,8 +40,8 @@ COPY --chown=cmsuser:cmsuser requirements.txt dev-requirements.txt /home/cmsuser
3940

4041
WORKDIR /home/cmsuser/cms
4142

42-
RUN sudo pip3 install -r requirements.txt
43-
RUN sudo pip3 install -r dev-requirements.txt
43+
RUN sudo pip3 install --break-system-packages -r requirements.txt
44+
RUN sudo pip3 install --break-system-packages -r dev-requirements.txt
4445

4546
COPY --chown=cmsuser:cmsuser . /home/cmsuser/cms
4647

_cms-test-internal.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
3+
sudo chown cmsuser:cmsuser ./codecov
4+
5+
dropdb --host=testdb --username=postgres cmsdbfortesting
6+
createdb --host=testdb --username=postgres cmsdbfortesting
7+
cmsInitDB
8+
9+
pytest --cov . --cov-report xml:codecov/unittests.xml
10+
UNIT=$?
11+
12+
dropdb --host=testdb --username=postgres cmsdbfortesting
13+
createdb --host=testdb --username=postgres cmsdbfortesting
14+
cmsInitDB
15+
16+
cmsRunFunctionalTests -v --coverage codecov/functionaltests.xml
17+
FUNC=$?
18+
19+
# This check is needed because otherwise failing unit tests aren't reported in
20+
# the CI as long as the functional tests are passing. Ideally we should get rid
21+
# of `cmsRunFunctionalTests` and make those tests work with pytest so they can
22+
# be auto-discovered and run in a single command.
23+
if [ $UNIT -ne 0 ] || [ $FUNC -ne 0 ]
24+
then
25+
exit 1
26+
else
27+
exit 0
28+
fi

cms/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def __init__(self):
167167
# the prefix (or real_prefix to accommodate virtualenvs).
168168
bin_path = os.path.join(os.getcwd(), sys.argv[0])
169169
bin_name = os.path.basename(bin_path)
170-
bin_is_python = bin_name in ["ipython", "python", "python2", "python3"]
170+
bin_is_python = bin_name in ["ipython", "python", "python3"]
171171
bin_in_installed_path = bin_path.startswith(sys.prefix) or (
172172
hasattr(sys, 'real_prefix')
173173
and bin_path.startswith(sys.real_prefix))

cms/db/contest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class Contest(Base):
7979
languages = Column(
8080
ARRAY(String),
8181
nullable=False,
82-
default=["C11 / gcc", "C++17 / g++", "Pascal / fpc"])
82+
default=["C11 / gcc", "C++20 / g++", "Pascal / fpc"])
8383

8484
# Whether contestants allowed to download their submissions.
8585
submissions_download_allowed = Column(

cms/grading/languages/cpp20_gpp.py

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/env python3
2+
3+
# Contest Management System - http://cms-dev.github.io/
4+
# Copyright © 2024 Filippo Casarin <[email protected]>
5+
#
6+
# This program is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU Affero General Public License as
8+
# published by the Free Software Foundation, either version 3 of the
9+
# License, or (at your option) any later version.
10+
#
11+
# This program is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU Affero General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU Affero General Public License
17+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
19+
"""C++20 programming language definition."""
20+
21+
from cms.grading import CompiledLanguage
22+
23+
24+
__all__ = ["Cpp20Gpp"]
25+
26+
27+
class Cpp20Gpp(CompiledLanguage):
28+
"""This defines the C++ programming language, compiled with g++ (the
29+
version available on the system) using the C++20 standard.
30+
31+
"""
32+
33+
@property
34+
def name(self):
35+
"""See Language.name."""
36+
return "C++20 / g++"
37+
38+
@property
39+
def source_extensions(self):
40+
"""See Language.source_extensions."""
41+
return [".cpp", ".cc", ".cxx", ".c++", ".C"]
42+
43+
@property
44+
def header_extensions(self):
45+
"""See Language.header_extensions."""
46+
return [".h"]
47+
48+
@property
49+
def object_extensions(self):
50+
"""See Language.object_extensions."""
51+
return [".o"]
52+
53+
def get_compilation_commands(self,
54+
source_filenames, executable_filename,
55+
for_evaluation=True):
56+
"""See Language.get_compilation_commands."""
57+
command = ["/usr/bin/g++"]
58+
if for_evaluation:
59+
command += ["-DEVAL"]
60+
command += ["-std=gnu++20", "-O2", "-pipe", "-static",
61+
"-s", "-o", executable_filename]
62+
command += source_filenames
63+
return [command]
Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@
1616
# You should have received a copy of the GNU Affero General Public License
1717
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1818

19-
"""Python programming language, version 2, definition."""
19+
"""Python programming language, version 3, definition."""
2020

2121
import os
2222

2323
from cms.grading import CompiledLanguage
2424

2525

26-
__all__ = ["Python2CPython"]
26+
__all__ = ["Python3PyPy"]
2727

2828

29-
class Python2CPython(CompiledLanguage):
30-
"""This defines the Python programming language, version 2 (more
31-
precisely, the subversion of Python 2 available on the system,
32-
usually 2.7) using the default interpeter in the system.
29+
class Python3PyPy(CompiledLanguage):
30+
"""This defines the Python programming language, version 3 (more
31+
precisely, the subversion of Python 3 available on the system)
32+
using the default PyPy interpeter in the system.
3333
3434
"""
3535

@@ -38,7 +38,7 @@ class Python2CPython(CompiledLanguage):
3838
@property
3939
def name(self):
4040
"""See Language.name."""
41-
return "Python 2 / CPython"
41+
return "Python 3 / PyPy"
4242

4343
@property
4444
def source_extensions(self):
@@ -47,8 +47,9 @@ def source_extensions(self):
4747

4848
@property
4949
def executable_extension(self):
50-
"""See Language.executable_extension."""
51-
return ".zip"
50+
"""See Language.executable.extension."""
51+
# Defined in PEP 441 (https://www.python.org/dev/peps/pep-0441/).
52+
return ".pyz"
5253

5354
def get_compilation_commands(self,
5455
source_filenames, executable_filename,
@@ -57,7 +58,7 @@ def get_compilation_commands(self,
5758

5859
commands = []
5960
files_to_package = []
60-
commands.append(["/usr/bin/python2", "-m", "compileall", "."])
61+
commands.append(["/usr/bin/pypy3", "-m", "compileall", "-b", "."])
6162
for idx, source_filename in enumerate(source_filenames):
6263
basename = os.path.splitext(os.path.basename(source_filename))[0]
6364
pyc_filename = "%s.pyc" % basename
@@ -77,4 +78,4 @@ def get_evaluation_commands(
7778
self, executable_filename, main=None, args=None):
7879
"""See Language.get_evaluation_commands."""
7980
args = args if args is not None else []
80-
return [["/usr/bin/python2", executable_filename] + args]
81+
return [["/usr/bin/pypy3", executable_filename] + args]

cms/io/web_service.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@
2121

2222
import logging
2323

24+
import collections
25+
try:
26+
collections.MutableMapping
27+
except:
28+
# Monkey-patch: Tornado 4.5.3 does not work on Python 3.11 by default
29+
collections.MutableMapping = collections.abc.MutableMapping
30+
2431
try:
2532
import tornado4.wsgi as tornado_wsgi
2633
except ImportError:

cms/server/admin/handlers/base.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@
3434
from datetime import datetime, timedelta
3535
from functools import wraps
3636

37+
import collections
38+
try:
39+
collections.MutableMapping
40+
except:
41+
# Monkey-patch: Tornado 4.5.3 does not work on Python 3.11 by default
42+
collections.MutableMapping = collections.abc.MutableMapping
43+
3744
try:
3845
import tornado4.web as tornado_web
3946
except ImportError:

cms/server/admin/handlers/contestannouncement.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
2727
"""
2828

29+
import collections
30+
try:
31+
collections.MutableMapping
32+
except:
33+
# Monkey-patch: Tornado 4.5.3 does not work on Python 3.11 by default
34+
collections.MutableMapping = collections.abc.MutableMapping
35+
2936
try:
3037
import tornado4.web as tornado_web
3138
except ImportError:

0 commit comments

Comments
 (0)