当前位置: 首页>>代码示例>>Python>>正文


Python test_common.my_print函数代码示例

本文整理汇总了Python中test_common.my_print函数的典型用法代码示例。如果您正苦于以下问题:Python my_print函数的具体用法?Python my_print怎么用?Python my_print使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了my_print函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: executePASS5

def executePASS5():
    my_print(
        "PASS 5: Compiling the compiler 'nuitka' package to single '.so' file."
    )

    path = os.path.join("..", "..", "nuitka")

    command = [
        os.environ["PYTHON"],
        nuitka_main_path,
        path,
        "--plugin-enable=pylint-warnings",
        "--output-dir=%s" % tmp_dir,
        "--recurse-all",
        "--recurse-not-to=PyQt4",
        "--recurse-not-to=nuitka.build.inline_copy",
        "--recurse-dir=%s" % path,
        "--module",
        path

    ]
    result = subprocess.call(
        command
    )

    if result != 0:
        sys.exit(result)

    os.unlink(os.path.join(tmp_dir, "nuitka.so"))
    shutil.rmtree(os.path.join(tmp_dir, "nuitka.build"))
开发者ID:gitter-badger,项目名称:Nuitka,代码行数:30,代码来源:compile_itself.py

示例2: runValgrind

def runValgrind(descr, test_case, args):
    my_print(descr, file = sys.stderr, end = "... ")

    log_base = test_case[:-3] if test_case.endswith(".py") else test_case
    log_file = log_base + ".log"

    valgrind_options = "-q --tool=callgrind --callgrind-out-file=%s" % log_file

    command = ["valgrind"] + valgrind_options.split() + list(args)

    process = subprocess.Popen(
        args   = command,
        stdout = subprocess.PIPE,
        stderr = subprocess.PIPE
    )

    _stdout_valgrind, stderr_valgrind = process.communicate()
    exit_valgrind = process.returncode

    assert exit_valgrind == 0, stderr_valgrind
    my_print("OK", file = sys.stderr)
    try:
        for line in open(log_file):
            if line.startswith("summary:"):
                return int(line.split()[1])

        else:
            assert False
    finally:
        os.unlink(log_file)
开发者ID:gitter-badger,项目名称:Nuitka,代码行数:30,代码来源:run_construct.py

示例3: executePASS4

def executePASS4():
    my_print("PASS 4: Compiling the compiler running from single exe.")

    exe_path = os.path.join(tmp_dir, "nuitka.exe")

    compileAndCompareWith(exe_path)

    my_print("OK.")
开发者ID:gitter-badger,项目名称:Nuitka,代码行数:8,代码来源:compile_itself.py

示例4: diffRecursive

def diffRecursive(dir1, dir2):
    done = set()

    for filename in os.listdir(dir1):
        path1 = os.path.join(dir1, filename)
        path2 = os.path.join(dir2, filename)

        done.add(path1)

        # Skip these binary files of course.
        if filename.endswith(".o") or \
           filename.endswith(".os") or \
           filename.endswith(".obj"):
            continue

        # Skip scons build database
        if filename == ".sconsign.dblite":
            continue

        if not os.path.exists(path2):
            sys.exit("Only in %s: %s" % (dir1, filename))

        if os.path.isdir(path1):
            diffRecursive(path1, path2)
        elif os.path.isfile(path1):
            fromdate = time.ctime(os.stat(path1).st_mtime)
            todate = time.ctime(os.stat(path2).st_mtime)

            diff = difflib.unified_diff(
                a            = readSource(path1).splitlines(),
                b            = readSource(path2).splitlines(),
                fromfile     = path1,
                tofile       = path2,
                fromfiledate = fromdate,
                tofiledate   = todate,
                n            = 3
            )

            result = list(diff)

            if result:
                for line in result:
                    my_print(line)

                sys.exit(1)
        else:
            assert False, path1

    for filename in os.listdir(dir2):
        path1 = os.path.join(dir1, filename)
        path2 = os.path.join(dir2, filename)

        if path1 in done:
            continue

        if not os.path.exists(path1):
            sys.exit("Only in %s: %s" % (dir2, filename))
开发者ID:gitter-badger,项目名称:Nuitka,代码行数:57,代码来源:compile_itself.py

示例5: compileAndCompareWith

def compileAndCompareWith(nuitka):
    base_dir = os.path.join("..", "..")

    for package in PACKAGE_LIST:
        package = package.replace('/', os.path.sep)

        source_dir = os.path.join(base_dir, package)

        for filename in sorted(os.listdir(source_dir)):
            if not filename.endswith(".py"):
                continue

            if filename.startswith(".#"):
                continue

            path = os.path.join(source_dir, filename)

            if filename != "__init__.py":
                my_print("Compiling", path)

                target = filename.replace(".py", ".build")

                target_dir = os.path.join(tmp_dir, target)

                if os.path.exists(target_dir):
                    shutil.rmtree(target_dir)

                command = [
                    nuitka,
                    "--module",
                    "--recurse-none",
                    "--plugin-enable=pylint-warnings",
                    "--output-dir=%s"% tmp_dir,
                    path
                ]
                command += os.environ.get("NUITKA_EXTRA_OPTIONS", "").split()

                result = subprocess.call(
                    command
                )

                if result != 0:
                    sys.exit(result)

                diffRecursive(os.path.join(package, target), target_dir)

                shutil.rmtree(target_dir)

                if os.name == "nt":
                    target_filename = filename.replace(".py", ".pyd")
                else:
                    target_filename = filename.replace(".py", ".so")

                os.unlink(os.path.join(tmp_dir, target_filename))
开发者ID:gitter-badger,项目名称:Nuitka,代码行数:54,代码来源:compile_itself.py

示例6: executePASS2

def executePASS2():
    my_print( "PASS 2: Compiling from compiler running from .exe and many .so files." )

    # Windows will load the compiled modules (pyd) only from PYTHONPATH, so we
    # have to add it.
    if os.name == "nt":
        os.environ[ "PYTHONPATH" ] = ":".join( PACKAGE_LIST )

    compileAndCompareWith( os.path.join( ".", "nuitka.exe" ) )

    # Undo the damage from above.
    if os.name == "nt":
        del os.environ[ "PYTHONPATH" ]

    my_print( "OK." )
开发者ID:TheKK,项目名称:Nuitka,代码行数:15,代码来源:compile_itself.py

示例7: action

def action(stage_dir, root, path):
    command = [
        sys.executable,
        os.path.join(
            "..",
            "..",
            "bin",
            "nuitka"
        ),
        "--stand",
        "--run",
        "--output-dir",
        stage_dir,
        "--remove-output"
    ]

    filename = os.path.join(stage_dir, "importer.py")

    assert path.startswith(root)

    module_name = path[len(root)+1:]
    module_name = module_name.split(".")[0]
    module_name = module_name.replace(os.path.sep, ".")

    with open(filename, "w") as output:
        output.write("import " + module_name + "\n")
        output.write("print('OK')")

    command += os.environ.get("NUITKA_EXTRA_OPTIONS", "").split()

    command.append(filename)

    try:
        output = subprocess.check_output(command).splitlines()
        assert output[-1] == "OK", output
    except Exception as e:
        print(e)
        sys.exit(1)
    else:
        my_print("OK")

        shutil.rmtree(filename[:-3] + ".dist")
开发者ID:mohamedhagag,项目名称:Nuitka,代码行数:42,代码来源:compile_extension_modules.py

示例8: executePASS3

def executePASS3():
    my_print( "PASS 3: Compiling from compiler running from .py files to single .exe." )

    exe_path = os.path.join( tmp_dir, "nuitka.exe" )

    if os.path.exists( exe_path ):
        os.unlink( exe_path )

    build_path = os.path.join( tmp_dir, "nuitka.build" )

    if os.path.exists( build_path ):
        shutil.rmtree( build_path )

    path = os.path.join( "..", "..", "bin", "nuitka" )

    my_print( "Compiling", path )

    command = [
        os.environ[ "PYTHON" ],
        nuitka_main_path,
        path,
        "--output-dir=%s" % tmp_dir,
        "--exe",
        "--recurse-all"
    ]
    result = subprocess.call(
        command
    )

    if result != 0:
        sys.exit( result )

    shutil.rmtree( build_path )

    my_print( "OK." )
开发者ID:TheKK,项目名称:Nuitka,代码行数:35,代码来源:compile_itself.py

示例9: executePASS1

def executePASS1():
    my_print("PASS 1: Compiling from compiler running from .py files.")

    base_dir = os.path.join("..", "..")

    for package in PACKAGE_LIST:
        package = package.replace('/', os.path.sep)

        source_dir = os.path.join(base_dir, package)
        target_dir = package

        if os.path.exists(target_dir):
            shutil.rmtree(target_dir)

        os.mkdir(target_dir)

        for filename in os.listdir(target_dir):
            if filename.endswith(".so"):
                path = os.path.join(target_dir, filename)

                os.unlink(path)

        for filename in sorted(os.listdir(source_dir)):
            if not filename.endswith(".py"):
                continue

            if filename.startswith(".#"):
                continue

            path = os.path.join(source_dir, filename)

            if filename != "__init__.py":
                my_print("Compiling", path)

                command = [
                    os.environ["PYTHON"],
                    nuitka_main_path,
                    "--module",
                    "--recurse-none",
                    "--plugin-enable=pylint-warnings",
                    "--output-dir=%s" % target_dir,
                    path
                ]
                command += os.environ.get("NUITKA_EXTRA_OPTIONS", "").split()

                result = subprocess.call(
                    command
                )

                if result != 0:
                    sys.exit(result)
            else:
                shutil.copyfile(path, os.path.join(target_dir, filename))


    my_print("Compiling", nuitka_main_path)

    shutil.copyfile(nuitka_main_path, "nuitka.py")

    command = [
        os.environ["PYTHON"],
        nuitka_main_path,
        "--recurse-none",
        "--output-dir=.",
        "--python-flag=-S",
        "nuitka.py"
    ]
    command += os.environ.get("NUITKA_EXTRA_OPTIONS", "").split()

    result = subprocess.call(
        command
    )

    if result != 0:
        sys.exit(result)

    scons_inline_copy_path = os.path.join(
        base_dir,
        "nuitka",
        "build",
        "inline_copy"
    )

    if os.path.exists(scons_inline_copy_path):
        shutil.copytree(
            scons_inline_copy_path,
            os.path.join("nuitka", "build", "inline_copy")
        )

    shutil.copy(
        os.path.join(base_dir, "nuitka", "build", "SingleExe.scons"),
        os.path.join("nuitka", "build", "SingleExe.scons")
    )
    shutil.copytree(
        os.path.join(base_dir, "nuitka", "build", "static_src"),
        os.path.join("nuitka", "build", "static_src")
    )
    shutil.copytree(
        os.path.join(base_dir, "nuitka", "build", "include"),
        os.path.join("nuitka", "build", "include")
#.........这里部分代码省略.........
开发者ID:gitter-badger,项目名称:Nuitka,代码行数:101,代码来源:compile_itself.py

示例10: sorted

    "PySideUsing.py"
)

for filename in sorted(os.listdir('.')):
    if not filename.endswith(".py"):
        continue

    if not decideFilenameVersionSkip(filename):
        continue

    path = os.path.relpath(filename)

    active = search_mode.consider(dirname = None, filename = filename)

    if not active:
        my_print("Skipping", filename)
        continue

    extra_flags = [
        "expect_success",
        "standalone",
        "remove_output"
    ]

    if filename == "PySideUsing.py":
        # Don't test on platforms not supported by current Debian testing, and
        # which should be considered irrelevant by now.
        if python_version.startswith("2.6") or \
           python_version.startswith("3.2"):
            my_print("Skipping", filename, "not relevant.")
            continue
开发者ID:shenglinmei,项目名称:Nuitka,代码行数:31,代码来源:run_all.py

示例11: convertUsing2to3

    active = search_mode.consider(
        dirname  = None,
        filename = filename
    )

    extra_flags = ["expect_success"]

    if active:
        # Apply 2to3 conversion if necessary.
        if python_version.startswith('3'):
            filename, changed = convertUsing2to3(filename)
        else:
            changed = False

        my_print("Consider", filename, end = ' ')

        command = [
            os.environ["PYTHON"],
            os.path.abspath(os.path.join("..", "..", "bin", "nuitka")),
            "--dump-xml",
            "--module",
            filename
        ]


        if search_mode.isCoverage():
            # To avoid re-execution, which is not acceptable to coverage.
            if "PYTHONHASHSEED" not in os.environ:
                os.environ["PYTHONHASHSEED"] = '0'
开发者ID:justus922,项目名称:Nuitka,代码行数:29,代码来源:run_all.py

示例12: setup

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"]

        compareWithCPython(
            dirname     = None,
            filename    = filename,
            extra_flags = extra_flags,
            search_mode = search_mode,
            needs_2to3  = False
        )
    else:
        my_print("Skipping", filename)

search_mode.finish()
开发者ID:justus922,项目名称:Nuitka,代码行数:30,代码来源:run_all.py

示例13: compilePath

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
                    )
                )
开发者ID:shenglinmei,项目名称:Nuitka,代码行数:77,代码来源:compile_library.py

示例14: setup

)

python_version = setup(needs_io_encoding = True)

search_mode = createSearchMode()

start_at = sys.argv[2] if len(sys.argv) > 2 else None

if start_at:
    active = False
else:
    active = True

os_path = os.path.normcase(os.path.dirname(os.__file__))

my_print("Using standard library path", os_path)

try:
    import numpy

    extra_path = os.path.normcase(
        os.path.dirname(
            os.path.dirname(
                numpy.__file__
            )
        )
    )

    my_print("Using extra library path", extra_path)
except ImportError:
    extra_path = os_path
开发者ID:shenglinmei,项目名称:Nuitka,代码行数:31,代码来源:compile_library.py

示例15: in

    if not active and start_at in ( filename, path ):
        active = True

    extra_flags = [
        "expect_success",
        "remove_output",
        "module_mode",
        "two_step_execution"
    ]

    # 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)
开发者ID:TheKK,项目名称:Nuitka,代码行数:31,代码来源:run_all.py


注:本文中的test_common.my_print函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。