From ab4d4022f96cb8c6cb86ceed187db810935ba454 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Thu, 11 Feb 2016 23:00:03 +0000 Subject: [PATCH] Add Python 3 --- MANIFEST | 2 ++ gruntmaster-compile | 3 ++- lib/Gruntmaster/Daemon.pm | 1 + t/problems/hello/tests/python3/meta.yml | 7 +++++++ t/problems/hello/tests/python3/prog.py | 2 ++ 5 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 t/problems/hello/tests/python3/meta.yml create mode 100755 t/problems/hello/tests/python3/prog.py diff --git a/MANIFEST b/MANIFEST index 7b10ffa..cd07003 100644 --- a/MANIFEST +++ b/MANIFEST @@ -128,6 +128,8 @@ t/problems/hello/tests/php/meta.yml t/problems/hello/tests/php/prog.php t/problems/hello/tests/python/meta.yml t/problems/hello/tests/python/prog.py +t/problems/hello/tests/python3/meta.yml +t/problems/hello/tests/python3/prog.py t/problems/hello/tests/ruby/meta.yml t/problems/hello/tests/ruby/prog.rb t/problems/hello/tests/rust/meta.yml diff --git a/gruntmaster-compile b/gruntmaster-compile index adf2149..3be2013 100755 --- a/gruntmaster-compile +++ b/gruntmaster-compile @@ -41,7 +41,7 @@ given ($format){ exit } - when ([qw/GOLFSCRIPT JULIA PERL PHP PYTHON RUBY SBCL/]){ + when ([qw/GOLFSCRIPT JULIA PERL PHP PYTHON PYTHON3 RUBY SBCL/]){ open IN, '<', $name; open OUT, '>', $basename; print OUT "#!/usr/bin/golfscript\n" if $_ eq 'GOLFSCRIPT'; @@ -49,6 +49,7 @@ given ($format){ print OUT "#!/usr/bin/perl\n" if $_ eq 'PERL'; print OUT "#!/usr/bin/php -d ONLINE_JUDGE=true\n" if $_ eq 'PHP'; print OUT "#!/usr/bin/python2.7\n" if $_ eq 'PYTHON'; + print OUT "#!/usr/bin/python3\n" if $_ eq 'PYTHON3'; print OUT "#!/usr/bin/ruby\n" if $_ eq 'RUBY'; print OUT "#!/usr/bin/sbcl --script\n" if $_ eq 'SBCL'; print OUT while ; diff --git a/lib/Gruntmaster/Daemon.pm b/lib/Gruntmaster/Daemon.pm index 2af9b53..7a9dea6 100644 --- a/lib/Gruntmaster/Daemon.pm +++ b/lib/Gruntmaster/Daemon.pm @@ -34,6 +34,7 @@ use constant FORMAT_EXTENSION => { PERL => 'pl', PHP => 'php', PYTHON => 'py', + PYTHON3 => 'py', RUBY => 'rb', RUST => 'rs', SBCL => 'l', diff --git a/t/problems/hello/tests/python3/meta.yml b/t/problems/hello/tests/python3/meta.yml new file mode 100644 index 0000000..bd3603d --- /dev/null +++ b/t/problems/hello/tests/python3/meta.yml @@ -0,0 +1,7 @@ +test_name: Python3 +test_description: Hello world in Python3 +problem: hello +files: + prog: + format: PYTHON3 + name: prog.py diff --git a/t/problems/hello/tests/python3/prog.py b/t/problems/hello/tests/python3/prog.py new file mode 100755 index 0000000..2378708 --- /dev/null +++ b/t/problems/hello/tests/python3/prog.py @@ -0,0 +1,2 @@ +#!/usr/bin/python3 +print('Hello World!') -- 2.39.2