Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove python2. #1272

Merged
merged 1 commit into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
openjdk-8-jdk-headless \
php7.4-cli \
postgresql-client \
python2 \
python3-pip \
python3.8 \
python3.8-dev \
Expand Down
2 changes: 1 addition & 1 deletion cms/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def __init__(self):
# the prefix (or real_prefix to accommodate virtualenvs).
bin_path = os.path.join(os.getcwd(), sys.argv[0])
bin_name = os.path.basename(bin_path)
bin_is_python = bin_name in ["ipython", "python", "python2", "python3"]
bin_is_python = bin_name in ["ipython", "python", "python3"]
bin_in_installed_path = bin_path.startswith(sys.prefix) or (
hasattr(sys, 'real_prefix')
and bin_path.startswith(sys.real_prefix))
Expand Down
80 changes: 0 additions & 80 deletions cms/grading/languages/python2_cpython.py

This file was deleted.

2 changes: 1 addition & 1 deletion cmsranking/Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(self):
# TODO: move to cmscommon as it is used both here and in cms/conf.py
bin_path = os.path.join(os.getcwd(), sys.argv[0])
bin_name = os.path.basename(bin_path)
bin_is_python = bin_name in ["ipython", "python", "python2", "python3"]
bin_is_python = bin_name in ["ipython", "python", "python3"]
bin_in_installed_path = bin_path.startswith(sys.prefix) or (
hasattr(sys, 'real_prefix')
and bin_path.startswith(sys.real_prefix))
Expand Down
5 changes: 2 additions & 3 deletions cmstestsuite/Tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,19 @@
LANG_JAVA = "Java / JDK"
LANG_PASCAL = "Pascal / fpc"
LANG_PHP = "PHP"
LANG_PYTHON = "Python 2 / CPython"
LANG_PYTHON3 = "Python 3 / CPython"
LANG_RUST = "Rust"
LANG_C_SHARP = "C# / Mono"
ALL_LANGUAGES = (
LANG_CPP, LANG_CPP14, LANG_CPP17, LANG_C, LANG_HS, LANG_JAVA, LANG_PASCAL,
LANG_PHP, LANG_PYTHON, LANG_PYTHON3, LANG_RUST, LANG_C_SHARP
LANG_PHP, LANG_PYTHON3, LANG_RUST, LANG_C_SHARP
)
NON_INTERPRETED_LANGUAGES = (
LANG_C, LANG_CPP, LANG_CPP14, LANG_CPP17, LANG_PASCAL
)
COMPILED_LANGUAGES = (
LANG_C, LANG_CPP, LANG_CPP14, LANG_CPP17, LANG_PASCAL, LANG_JAVA,
LANG_PYTHON, LANG_PYTHON3, LANG_HS, LANG_RUST, LANG_C_SHARP
LANG_PYTHON3, LANG_HS, LANG_RUST, LANG_C_SHARP
)

ALL_TESTS = [
Expand Down
7 changes: 3 additions & 4 deletions cmstestsuite/tasks/batch_fileio_managed/code/checker
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/python2 -sS
#!/usr/bin/python3 -sS

from __future__ import print_function

import io
import sys
Expand All @@ -17,11 +16,11 @@ try:
f = io.open(output_file, 'rb')
line = f.readline().strip()
more = f.readline()
if line == '%s %d' % (solution_word, number) and more == '':
if line == b'%s %d' % (solution_word, number) and more == b'':
print("1.0")
print("Correcto", file=sys.stderr)
else:
assert more == ''
assert more == b''
print("0.0")
print("Plain wrong", file=sys.stderr)
except:
Expand Down
15 changes: 7 additions & 8 deletions cmstestsuite/tasks/communication_fifoio_stubbed/code/manager
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/python2 -sS
#!/usr/bin/python3 -sS

from __future__ import print_function

import io
import sys
Expand All @@ -17,28 +16,28 @@ correct = True

# Speak the to program a few times, check what it does, and output the last
# line.
for i in range(10,20) + [0]:
for i in list(range(10, 20)) + [0]:
x = i + input_value
# Write a question to the candidate executable.
fifo_to_user.write("%d\n" % x)
fifo_to_user.write(b"%d\n" % x)
# Read their response.
l = fifo_from_user.readline()
# EOF?
if l == '':
if l == b'':
correct = False
break
# These are the only things we expect from our stub.
if l.strip() != 'correct %d' % x:
if l.strip() != b'correct %d' % x:
correct = False
break

correct = correct and (int(l.split()[1]) == x)
else:
# Tell stub to exit.
fifo_to_user.write("0\n")
fifo_to_user.write(b"0\n")

# This file exists just for convenience.
io.open("output.txt", "wb").write(l + "\n")
io.open("output.txt", "wb").write(l + b"\n")

# This is the final score.
if correct:
Expand Down
23 changes: 11 additions & 12 deletions cmstestsuite/tasks/communication_many_fifoio_stubbed/code/manager
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/python2 -sS
#!/usr/bin/python3 -sS

from __future__ import print_function

import io
import sys
Expand All @@ -20,44 +19,44 @@ correct = True

# Speak the to program a few times, check what it does, and output the last
# line.
for i in range(10, 20) + [0]:
for i in list(range(10, 20)) + [0]:
x = i + input_value
# Write a question to the candidate executable.
fifo_to_user1.write("%d\n" % x)
fifo_to_user1.write(b"%d\n" % x)
# Read their response.
l = fifo_from_user1.readline()
# EOF?
if l == '':
if l == b'':
correct = False
break
# These are the only things we expect from our stub.
if l.strip() != 'correct %d' % x:
if l.strip() != b'correct %d' % x:
correct = False
break

correct = correct and (int(l.split()[1]) == x)

# Write a question to the candidate executable.
fifo_to_user2.write("%d\n" % x)
fifo_to_user2.write(b"%d\n" % x)
# Read their response.
l = fifo_from_user2.readline()
# EOF?
if l == '':
if l == b'':
correct = False
break
# These are the only things we expect from our stub.
if l.strip() != 'correct %d' % (-x):
if l.strip() != b'correct %d' % (-x):
correct = False
break

correct = correct and (int(l.split()[1]) == -x)
else:
# Tell stub to exit.
fifo_to_user1.write("0\n")
fifo_to_user2.write("0\n")
fifo_to_user1.write(b"0\n")
fifo_to_user2.write(b"0\n")

# This file exists just for convenience.
io.open("output.txt", "wb").write(l + "\n")
io.open("output.txt", "wb").write(l + b"\n")

# This is the final score.
if correct:
Expand Down
23 changes: 11 additions & 12 deletions cmstestsuite/tasks/communication_many_stdio_stubbed/code/manager
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/python2 -sS
#!/usr/bin/python3 -sS

from __future__ import print_function

import io
import sys
Expand All @@ -22,44 +21,44 @@ correct = True

# Speak the to program a few times, check what it does, and output the last
# line.
for i in range(10, 20) + [0]:
for i in list(range(10, 20)) + [0]:
x = i + input_value
# Write a question to the candidate executable.
fifo_to_user1.write("%d\n" % x)
fifo_to_user1.write(b"%d\n" % x)
# Read their response.
l = fifo_from_user1.readline()
# EOF?
if l == '':
if l == b'':
correct = False
break
# These are the only things we expect from our stub.
if l.strip() != 'correct %d' % x:
if l.strip() != b'correct %d' % x:
correct = False
break

correct = correct and (int(l.split()[1]) == x)

# Write a question to the candidate executable.
fifo_to_user2.write("%d\n" % x)
fifo_to_user2.write(b"%d\n" % x)
# Read their response.
l = fifo_from_user2.readline()
# EOF?
if l == '':
if l == b'':
correct = False
break
# These are the only things we expect from our stub.
if l.strip() != 'correct %d' % (-x):
if l.strip() != b'correct %d' % (-x):
correct = False
break

correct = correct and (int(l.split()[1]) == -x)
else:
# Tell stub to exit.
fifo_to_user1.write("0\n")
fifo_to_user2.write("0\n")
fifo_to_user1.write(b"0\n")
fifo_to_user2.write(b"0\n")

# This file exists just for convenience.
io.open("output.txt", "wb").write(l + "\n")
io.open("output.txt", "wb").write(l + b"\n")

# This is the final score.
if correct:
Expand Down
15 changes: 7 additions & 8 deletions cmstestsuite/tasks/communication_stdio/code/manager
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/python2 -sS
#!/usr/bin/python3 -sS

from __future__ import print_function

import io
import sys
Expand All @@ -19,28 +18,28 @@ correct = True

# Speak the to program a few times, check what it does, and output the last
# line.
for i in range(10,20) + [0]:
for i in list(range(10, 20)) + [0]:
x = i + input_value
# Write a question to the candidate executable.
fifo_to_user.write("%d\n" % x)
fifo_to_user.write(b"%d\n" % x)
# Read their response.
l = fifo_from_user.readline()
# EOF?
if l == '':
if l == b'':
correct = False
break
# These are the only things we expect from our stub.
if l.strip() != 'correct %d' % x:
if l.strip() != b'correct %d' % x:
correct = False
break

correct = correct and (int(l.split()[1]) == x)
else:
# Tell stub to exit.
fifo_to_user.write("0\n")
fifo_to_user.write(b"0\n")

# This file exists just for convenience.
io.open("output.txt", "wb").write(l + "\n")
io.open("output.txt", "wb").write(l + b"\n")

# This is the final score.
if correct:
Expand Down
Loading
Loading