@@ -173,6 +173,7 @@ def nativeclean(args):
173
173
174
174
175
175
def python3_unittests (args ):
176
+ """run the cPython stdlib unittests"""
176
177
mx .run (["python3" , "graalpython/com.oracle.graal.python.test/src/python_unittests.py" , "-v" ] + args )
177
178
178
179
@@ -189,9 +190,10 @@ class GraalPythonTags(object):
189
190
cpyext_managed = 'python-cpyext-managed'
190
191
cpyext_sandboxed = 'python-cpyext-sandboxed'
191
192
svmunit = 'python-svm-unittest'
192
- downstream = 'python-downstream'
193
193
graalvm = 'python-graalvm'
194
194
license = 'python-license'
195
+ so = 'python-so'
196
+ svm = 'python-svm'
195
197
196
198
197
199
def python_gate (args ):
@@ -204,6 +206,9 @@ def python_gate(args):
204
206
return mx .command_function ("gate" )(args )
205
207
206
208
209
+ python_gate .__doc__ = 'Custom gates are %s' % ", " .join ([getattr (GraalPythonTags , t ) for t in dir (GraalPythonTags ) if not t .startswith ("__" )])
210
+
211
+
207
212
def find_jdt ():
208
213
pardir = os .path .abspath (os .path .join (SUITE .dir , ".." ))
209
214
for f in [os .path .join (SUITE .dir , f ) for f in os .listdir (SUITE .dir )] + [os .path .join (pardir , f ) for f in os .listdir (pardir )]:
@@ -243,6 +248,7 @@ def python_svm(args):
243
248
out = mx .OutputCapture ()
244
249
mx .run_mx (_SVM_ARGS + ["graalvm-home" ], out = mx .TeeOutputCapture (out ))
245
250
svm_image = os .path .join (out .data .strip (), "bin" , "graalpython" )
251
+ print (svm_image )
246
252
mx .run ([svm_image ] + args )
247
253
return svm_image
248
254
@@ -342,13 +348,13 @@ def graalpython_gate_runner(args, tasks):
342
348
343
349
with Task ('GraalPython license header update' , tasks , tags = [GraalPythonTags .license ]) as task :
344
350
if task :
345
- python_checkcopyrights ([])
351
+ python_checkcopyrights (["--fix" ])
346
352
347
- with Task ('GraalPython GraalVM shared-library build' , tasks , tags = [GraalPythonTags .downstream , GraalPythonTags .graalvm ]) as task :
353
+ with Task ('GraalPython GraalVM shared-library build' , tasks , tags = [GraalPythonTags .so , GraalPythonTags .graalvm ]) as task :
348
354
if task :
349
355
run_shared_lib_test ()
350
356
351
- with Task ('GraalPython GraalVM build' , tasks , tags = [GraalPythonTags .downstream , GraalPythonTags .graalvm ]) as task :
357
+ with Task ('GraalPython GraalVM build' , tasks , tags = [GraalPythonTags .svm , GraalPythonTags .graalvm ]) as task :
352
358
if task :
353
359
svm_image = python_svm (["--version" ])
354
360
benchmark = os .path .join (PATH_MESO , "image-magix.py" )
@@ -603,25 +609,37 @@ def update_import(name, rev="origin/master", callback=None):
603
609
604
610
605
611
def update_import_cmd (args ):
612
+ """Update our mx imports"""
613
+ if "sulong" in args or "regex" in args or "truffle" in args :
614
+ join = os .path .join
615
+ callback = lambda : shutil .copy (
616
+ join (SUITE_SULONG .dir , "include" , "truffle.h" ),
617
+ join (SUITE .dir , "graalpython" , "com.oracle.graal.python.cext" , "include" , "truffle.h" )
618
+ ) and shutil .copy (
619
+ join (mx .dependency ("SULONG_LIBS" ).output , "polyglot.h" ),
620
+ join (SUITE .dir , "graalpython" , "com.oracle.graal.python.cext" , "include" , "polyglot.h" )
621
+ )
622
+ update_import ("sulong" , callback = callback )
623
+ update_import ("regex" )
624
+ try : args .remove ("sulong" )
625
+ except ValueError : pass
626
+ try : args .remove ("truffle" )
627
+ except ValueError : pass
628
+ try : args .remove ("regex" )
629
+ except ValueError : pass
630
+
606
631
for name in args :
607
- callback = None
608
- if name == "sulong" :
609
- join = os .path .join
610
- callback = lambda : shutil .copy (
611
- join (SUITE_SULONG .dir , "include" , "truffle.h" ),
612
- join (SUITE .dir , "graalpython" , "com.oracle.graal.python.cext" , "include" , "truffle.h" )
613
- ) and shutil .copy (
614
- join (mx .dependency ("SULONG_LIBS" ).output , "polyglot.h" ),
615
- join (SUITE .dir , "graalpython" , "com.oracle.graal.python.cext" , "include" , "polyglot.h" )
616
- )
617
- # make sure that sulong and regex are the same version
618
- if name == "regex" :
619
- update_import ("sulong" , callback = callback )
620
- elif name == "sulong" :
621
- update_import ("regex" , callback = callback )
622
632
update_import (name , callback = callback )
623
633
624
634
635
+ def python_style_checks (args ):
636
+ python_checkcopyrights (["--fix" ])
637
+ if not os .environ .get ("ECLIPSE_EXE" ):
638
+ find_eclipse ()
639
+ mx .command_function ("eclipseformat" )()
640
+ mx .command_function ("spotbugs" )()
641
+
642
+
625
643
def python_checkcopyrights (args ):
626
644
# we wan't to ignore lib-python/3, because that's just crazy
627
645
listfilename = tempfile .mktemp ()
@@ -860,7 +878,7 @@ def mx_post_parse_cmd_line(namespace):
860
878
861
879
862
880
def python_coverage (args ):
863
- mx .run_mx (['--jacoco-whitelist-package' , 'com.oracle.graal.python' , '--primary' , 'gate' , '--tags' , 'python-junit' , '--jacocout' , 'html' ])
881
+ mx .run_mx (['--jacoco-whitelist-package' , 'com.oracle.graal.python' , '--primary' , 'gate' , '--tags' , args [ 0 ] if args else 'python-junit' , '--jacocout' , 'html' ])
864
882
865
883
866
884
# ----------------------------------------------------------------------------------------------------------------------
@@ -872,19 +890,13 @@ def python_coverage(args):
872
890
'python' : [python , '[Python args|@VM options]' ],
873
891
'python3' : [python , '[Python args|@VM options]' ],
874
892
'deploy-binary-if-master' : [deploy_binary_if_master , '' ],
875
- 'python-gate' : [python_gate , '' ],
876
- 'python-update-import' : [update_import_cmd , 'import name' ],
877
- 'delete-graalpython-if-testdownstream' : [delete_self_if_testdownstream , '' ],
878
- 'python-checkcopyrights' : [python_checkcopyrights , 'Make sure code files have copyright notices' ],
879
- 'python-build-svm' : [python_build_svm , 'build svm image if it is outdated' ],
880
- 'python-svm' : [python_svm , 'run python svm image (building it if it is outdated' ],
881
- 'punittest' : [punittest , '' ],
882
- 'python3-unittests' : [python3_unittests , 'run the cPython stdlib unittests' ],
883
- 'python-unittests' : [python3_unittests , 'run the cPython stdlib unittests' ],
884
- 'python-gate-unittests' : [gate_unittests , '' ],
893
+ 'python-gate' : [python_gate , '--tags [gates]' ],
894
+ 'python-update-import' : [update_import_cmd , '[import-name, default: truffle]' ],
895
+ 'python-style' : [python_style_checks , '' ],
896
+ 'python-svm' : [python_svm , '' ],
897
+ 'python-unittests' : [python3_unittests , '' ],
885
898
'nativebuild' : [nativebuild , '' ],
886
899
'nativeclean' : [nativeclean , '' ],
887
- 'python-so-test' : [run_shared_lib_test , '' ],
888
- 'python-src-import' : [import_python_sources , '' ],
889
- 'python-coverage' : [python_coverage , '' ],
900
+ 'python-src-import' : [import_python_sources , 'Update the inlined files from PyPy and CPython' ],
901
+ 'python-coverage' : [python_coverage , 'Generate coverage report either running python-junit gate or the gate passed as argument' ],
890
902
})
0 commit comments