def action(stage_dir, root, path): command = [ sys.executable, os.path.join("..", "..", "bin", "nuitka"), "--module", "--output-dir", stage_dir, "--recurse-none", "--remove-output" ] command += os.environ.get("NUITKA_EXTRA_OPTIONS", "").split() command.append(path) try: subprocess.check_call(command) except subprocess.CalledProcessError: my_print("Falling back to full comparison due to error exit.") compareWithCPython(dirname=None, filename=path, extra_flags=["expect_failure"], search_mode=search_mode, needs_2to3=False) else: my_print("OK") if os.name == "nt": suffix = "pyd" else: suffix = "so" target_filename = os.path.basename(path).replace(".py", '.' + suffix) target_filename = target_filename.replace('(', "").replace(')', "") os.unlink(os.path.join(stage_dir, target_filename))
def action(stage_dir, root, path): command = [ sys.executable, os.path.join( "..", "..", "bin", "nuitka" ), "--module", "--output-dir", stage_dir, "--recurse-none", "--remove-output" ] command += os.environ.get("NUITKA_EXTRA_OPTIONS", "").split() command.append(path) try: subprocess.check_call(command) except subprocess.CalledProcessError: my_print("Falling back to full comparison due to error exit.") compareWithCPython( dirname = None, filename = path, extra_flags = ["expect_failure"], search_mode = search_mode, needs_2to3 = False ) else: my_print("OK") if os.name == "nt": suffix = "pyd" else: suffix = "so" target_filename = os.path.basename(path).replace(".py",'.'+suffix) target_filename = target_filename.replace('(',"").replace(')',"") os.unlink( os.path.join( stage_dir, target_filename ) )
if start_at: active = False else: active = True for filename in sorted(os.listdir(".")): if not filename.endswith(".py") or filename == "run_all.py": continue path = filename if not active and start_at in (filename, path): active = True # Some syntax errors are for Python3 only. if filename == "Importing2.py" and python_version < "3": extra_flags = ["remove_output"] elif filename == "GeneratorReturn2.py" and python_version >= "3.3": extra_flags = ["remove_output"] else: extra_flags = ["expect_failure", "remove_output"] if active: compareWithCPython(path=path, extra_flags=extra_flags, search_mode=search_mode, needs_2to3=False) else: my_print("Skipping", filename)
# The use of "__main__" in the test package gives a warning. if filename == "sub_package": extra_flags.append("ignore_warnings") if active: my_print("Consider output of recursively compiled program:", path) for filename_main in os.listdir(filename): if not os.path.isdir(os.path.join(filename, filename_main)): continue if filename_main not in ("..", "."): break else: sys.exit("""\ Error, no package in dir '%s' found, incomplete test case.""" % filename) os.environ[ "NUITKA_EXTRA_OPTIONS" ] = \ "--recurse-to=%s" % os.path.basename(filename_main) os.environ[ "NUITKA_EXTRA_OPTIONS" ] += \ " --output-dir=%s" % getTempDir() compareWithCPython(path=os.path.join(filename, filename_main), extra_flags=extra_flags, search_mode=search_mode, needs_2to3=False) else: my_print("Skipping", filename)
my_print("Skipping", filename, "lxml.etree not installed for", python_version, "but test needs it.") continue if filename not in ("PySideUsing.py", "PyQtUsing.py", "GtkUsing.py", "LxmlUsing.py"): extra_flags += ["no_site"] if active: my_print("Consider output of recursively compiled program:", filename) # First compare so we know the program behaves identical. compareWithCPython( path=filename, extra_flags=extra_flags, # Do not expect PySide to work yet, because it has that bug still # where it won't call compiled functions as slots. search_mode=search_mode and not filename == "PySideUsing.py", needs_2to3=False) # Second use strace on the result. loaded_filenames = getRuntimeTraceOfLoadedFiles( path=os.path.join(filename[:-3] + ".dist", filename[:-3] + ".exe")) current_dir = os.path.normpath(os.getcwd()) current_dir = os.path.normcase(current_dir) illegal_access = False for loaded_filename in loaded_filenames: loaded_filename = os.path.normpath(loaded_filename)
# For the warnings. extra_flags.append( "ignore_stderr" ) if filename not in ("PySideUsing.py", "PyQtUsing.py", "GtkUsing.py"): extra_flags += [ "no_site" ] if active: my_print("Consider output of recursively compiled program:", filename) # First compare so we know the program behaves identical. compareWithCPython( path = filename, extra_flags = extra_flags, # Do not expect PySide to work yet, because it has that bug still # where it won't call compiled functions as slots. search_mode = search_mode and not filename == "PySideUsing.py", needs_2to3 = False ) # Second use strace on the result. loaded_filenames = getRuntimeTraceOfLoadedFiles( path = os.path.join( filename[:-3] + ".dist", filename[:-3] + ".exe" ) ) current_dir = os.path.normpath(os.getcwd()) current_dir = os.path.normcase(current_dir)
if filename not in ("PySideUsing.py", "PyQt4Using.py", "PyQt5Using.py", "PyQt4Plugins.py", "PyQt5Plugins.py", "GtkUsing.py", "LxmlUsing.py", "Win32ComUsing.py", "IdnaUsing.py", "NumpyUsing.py", "FlaskUsing.py"): extra_flags += [ "no_site" ] my_print("Consider output of recursively compiled program:", filename) # First compare so we know the program behaves identical. compareWithCPython( dirname = None, filename = filename, extra_flags = extra_flags, search_mode = search_mode, needs_2to3 = False ) # Second use "strace" on the result. loaded_filenames = getRuntimeTraceOfLoadedFiles( path = os.path.join( filename[:-3] + ".dist", filename[:-3] + ".exe" ) ) current_dir = os.path.normpath(os.getcwd()) current_dir = os.path.normcase(current_dir)
os.path.normpath( os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))) from test_common import (my_print, setup, compareWithCPython, createSearchMode, decideFilenameVersionSkip) python_version = setup(needs_io_encoding=True) search_mode = createSearchMode() for filename in sorted(os.listdir('.')): if not filename.endswith(".py"): continue if not decideFilenameVersionSkip(filename): continue active = search_mode.consider(dirname=None, filename=filename) if active: extra_flags = ["expect_failure", "remove_output", "syntax_errors"] compareWithCPython(dirname=None, filename=filename, extra_flags=extra_flags, search_mode=search_mode, needs_2to3=False) else: my_print("Skipping", filename) search_mode.finish()
if active: my_print( "Consider output of recursively compiled program:", path ) for filename_main in os.listdir( filename ): if not os.path.isdir(os.path.join(filename,filename_main)): continue if filename_main not in ( "..", "." ): break else: sys.exit( """\ Error, no package in dir '%s' found, incomplete test case.""" % filename ) os.environ[ "NUITKA_EXTRA_OPTIONS" ] = \ "--recurse-to=%s" % os.path.basename(filename_main) os.environ[ "NUITKA_EXTRA_OPTIONS" ] += \ " --output-dir=%s" % getTempDir() compareWithCPython( path = os.path.join( filename, filename_main ), extra_flags = extra_flags, search_mode = search_mode, needs_2to3 = False ) else: my_print( "Skipping", filename )
# Too little attributes for generator objects, "__del__" is missing it # seems. "GeneratorExpressions.py", # Order change for dictionary contraction" "ListContractions.py", # Prepared dictionaries of "enum.Enums" are not used early enough "Classes34.py", ) if active: if filename.startswith("Referencing") and not hasDebugPython(): my_print("Skipped (no debug Python)") continue needs_2to3 = python_version.startswith("3") and \ not filename.endswith("32.py") and \ not filename.endswith("33.py") compareWithCPython( path = path, extra_flags = extra_flags, search_mode = search_mode and not ( filename in skips_34 and python_version.startswith("3.4") ), needs_2to3 = needs_2to3 ) else: my_print("Skipping", filename)
def compilePath(path): global active for root, dirnames, filenames in os.walk(path): dirnames.sort() filenames = [ filename for filename in filenames if filename.endswith(".py") if filename not in blacklist ] for filename in sorted(filenames): if '(' in filename: continue # Avoid too complex code for main program. if filename == "idnadata.py": continue path = os.path.join(root, filename) if not active and start_at in (filename, path): active = True if not active: continue command = [ sys.executable, os.path.join( "..", "..", "bin", "nuitka" ), "--module", "--output-dir", stage_dir, "--recurse-none", "--remove-output" ] command += os.environ.get("NUITKA_EXTRA_OPTIONS", "").split() command.append(path) my_print(path, ':', end = ' ') sys.stdout.flush() try: subprocess.check_call(command) except subprocess.CalledProcessError: my_print("Falling back to full comparison due to error exit.") compareWithCPython( dirname = None, filename = path, extra_flags = ["expect_failure"], search_mode = search_mode, needs_2to3 = False ) else: my_print("OK") if os.name == "nt": suffix = "pyd" else: suffix = "so" target_filename = os.path.basename(path).replace(".py",'.'+suffix) target_filename = target_filename.replace('(',"").replace(')',"") os.unlink( os.path.join( stage_dir, target_filename ) )
def compilePath(path): global active for root, dirnames, filenames in os.walk(path): dirnames.sort() filenames = [ filename for filename in filenames if filename.endswith(".py") if filename not in blacklist ] for filename in sorted(filenames): if '(' in filename: continue # Avoid too complex code for main program. if filename == "idnadata.py": continue path = os.path.join(root, filename) if not active and start_at in (filename, path): active = True if not active: continue command = [ sys.executable, os.path.join("..", "..", "bin", "nuitka"), "--module", "--output-dir", stage_dir, "--recurse-none", "--remove-output" ] command += os.environ.get("NUITKA_EXTRA_OPTIONS", "").split() command.append(path) my_print(path, ':', end=' ') sys.stdout.flush() try: subprocess.check_call(command) except subprocess.CalledProcessError: my_print("Falling back to full comparison due to error exit.") compareWithCPython(dirname=None, filename=path, extra_flags=["expect_failure"], search_mode=search_mode, needs_2to3=False) else: my_print("OK") if os.name == "nt": suffix = "pyd" else: suffix = "so" target_filename = os.path.basename(path).replace( ".py", '.' + suffix) target_filename = target_filename.replace('(', "").replace(')', "") os.unlink(os.path.join(stage_dir, target_filename))
if start_at: active = False else: active = True for filename in sorted( os.listdir( "." ) ): if not filename.endswith( ".py" ): continue if not decideFilenameVersionSkip(filename): continue path = filename if not active and start_at in ( filename, path ): active = True # Some syntax errors are for Python3 only. extra_flags = ["expect_failure", "remove_output"] if active: compareWithCPython( path = path, extra_flags = extra_flags, search_mode = search_mode, needs_2to3 = False ) else: my_print("Skipping", filename)
"Constants.py", # Too little attributes for generator objects, "__del__" is missing it # seems. "GeneratorExpressions.py", # Order change for dictionary contraction" "ListContractions.py", # Prepared dictionaries of "enum.Enums" are not used early enough "Classes34.py", ) if active: if filename.startswith("Referencing") and not hasDebugPython(): my_print("Skipped (no debug Python)") continue needs_2to3 = python_version.startswith("3") and \ not filename.endswith("32.py") and \ not filename.endswith("33.py") compareWithCPython( path=path, extra_flags=extra_flags, search_mode=search_mode and not (filename in skips_34 and python_version.startswith("3.4")), needs_2to3=needs_2to3) else: my_print("Skipping", filename)