2121# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
2222# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
2323# OF THE POSSIBILITY OF SUCH DAMAGE.
24+ from __future__ import print_function
25+
2426import os
2527import platform
2628import re
3436import mx_gate
3537import mx_sdk
3638import mx_subst
37- import mx_urlrewrites
3839from mx_gate import Task
3940from mx_graalpython_bench_param import PATH_MESO , BENCHMARKS
4041from mx_graalpython_benchmark import PythonBenchmarkSuite , python_vm_registry , CPythonVm , PyPyVm , GraalPythonVm , \
41- CONFIGURATION_DEFAULT , CONFIGURATION_EXPERIMENTAL_SPLITTING , CONFIGURATION_SANDBOXED
42+ CONFIGURATION_DEFAULT , CONFIG_EXPERIMENTAL_SPLITTING , CONFIGURATION_SANDBOXED
4243from mx_unittest import unittest
4344
4445SUITE = mx .suite ('graalpython' )
@@ -161,7 +162,7 @@ def punittest(args):
161162 # IMPORTANT! This must not be --suite graalpython, because a
162163 # --dynamicimports sulong will otherwise not put sulong.jar on the
163164 # classpath, which means we cannot run our C extension tests!
164- unittest (args + ['--regex' , '(graal\.python)|(com\.oracle\.truffle\.tck\.tests)' , "-Dgraal.TraceTruffleCompilation=true" ])
165+ unittest (args + ['--regex' , r '(graal\.python)|(com\.oracle\.truffle\.tck\.tests)' , "-Dgraal.TraceTruffleCompilation=true" ])
165166
166167
167168def nativebuild (args ):
@@ -247,7 +248,8 @@ def python_svm(args):
247248 return svm_image
248249
249250
250- def gate_unittests (args = [], subdir = "" ):
251+ def gate_unittests (args = None , subdir = "" ):
252+ args = args or []
251253 _graalpytest_driver = "graalpython/com.oracle.graal.python.test/src/graalpytest.py"
252254 _test_project = "graalpython/com.oracle.graal.python.test/"
253255 for idx , arg in enumerate (args ):
@@ -273,7 +275,9 @@ def gate_unittests(args=[], subdir=""):
273275 mx .command_function ("python" )(["--python.CatchAllExceptions=true" , "--python.OpaqueFilesystem" ] + pre_args + test_args + post_args )
274276
275277
276- def run_python_unittests (python_binary , args = [], aot_compatible = True , exclude = []):
278+ def run_python_unittests (python_binary , args = None , aot_compatible = True , exclude = None ):
279+ args = args or []
280+ exclude = exclude or []
277281 # tests root directory
278282 tests_folder = os .path .join (SUITE .dir , "graalpython" , "com.oracle.graal.python.test" , "src" , "tests" )
279283
@@ -602,7 +606,7 @@ def update_import(name, rev="origin/master", callback=None):
602606 suitefile = os .path .join (primary .dir , "mx." + primary .name , "suite.py" )
603607 with open (suitefile , 'r' ) as f :
604608 contents = f .read ()
605- dep_re = re .compile ("['\" ]name['\" ]:\s+['\" ]%s['\" ],\s+['\" ]version['\" ]:\s+['\" ]([a-z0-9]+)['\" ]" % name , re .MULTILINE )
609+ dep_re = re .compile (r "['\"]name['\"]:\s+['\"]%s['\"],\s+['\"]version['\"]:\s+['\"]([a-z0-9]+)['\"]" % name , re .MULTILINE )
606610 dep_match = dep_re .search (contents )
607611 if dep_match :
608612 start = dep_match .start (1 )
@@ -620,7 +624,7 @@ def update_import_cmd(args):
620624 callback = None
621625 if name == "sulong" :
622626 join = os .path .join
623- callback = lambda : shutil .copy (
627+ callback = lambda : shutil .copy (
624628 join (SUITE_SULONG .dir , "include" , "truffle.h" ),
625629 join (SUITE .dir , "graalpython" , "com.oracle.graal.python.cext" , "include" , "truffle.h" )
626630 ) and shutil .copy (
@@ -676,7 +680,7 @@ def import_python_sources(args):
676680 pypy_sources = args .pypy
677681 import_version = args .msg
678682
679- print """
683+ print ( """
680684 So you think you want to update the inlined sources? Here is how it will go:
681685
682686 1. We'll first check the copyrights check overrides file to identify the
@@ -717,7 +721,7 @@ def import_python_sources(args):
717721 python-import.
718722
719723 7. Run the tests and fix any remaining issues.
720- """ .format (mapping )
724+ """ .format (mapping ))
721725 raw_input ("Got it?" )
722726
723727 cpy_files = []
@@ -743,7 +747,7 @@ def import_python_sources(args):
743747 if name .startswith ("test_" ) or name .endswith ("_tests.py" ):
744748 original_file = inlined_file
745749 else :
746- for root , dirs , files in os .walk (pypy_sources ):
750+ for root , _ , files in os .walk (pypy_sources ):
747751 if os .path .basename (name ) in files :
748752 original_file = os .path .join (root , name )
749753 try :
@@ -761,7 +765,7 @@ def import_python_sources(args):
761765 name = os .path .basename (inlined_file )
762766 name = mapping .get (name , name )
763767 if inlined_file .endswith (".h" ) or inlined_file .endswith (".c" ):
764- for root , dirs , files in os .walk (python_sources ):
768+ for root , _ , files in os .walk (python_sources ):
765769 if os .path .basename (name ) in files :
766770 original_file = os .path .join (root , name )
767771 try :
@@ -846,7 +850,7 @@ def _register_vms(namespace):
846850 python_vm_registry .add_vm (CPythonVm (CONFIGURATION_DEFAULT ), SUITE )
847851 python_vm_registry .add_vm (PyPyVm (CONFIGURATION_DEFAULT ), SUITE )
848852 python_vm_registry .add_vm (GraalPythonVm (config_name = CONFIGURATION_DEFAULT ), SUITE , 10 )
849- python_vm_registry .add_vm (GraalPythonVm (config_name = CONFIGURATION_EXPERIMENTAL_SPLITTING , extra_vm_args = [
853+ python_vm_registry .add_vm (GraalPythonVm (config_name = CONFIG_EXPERIMENTAL_SPLITTING , extra_vm_args = [
850854 '-Dgraal.TruffleExperimentalSplitting=true' ,
851855 '-Dgraal.TruffleExperimentalSplittingAllowForcedSplits=false'
852856 ]), SUITE , 10 )
0 commit comments