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
2121import os
2222
2323from 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 ]
0 commit comments