示例#1
0
def runScons(options, quiet):
    with _setupSconsEnvironment():
        if Options.shallCompileWithoutBuildDirectory():
            # Make sure we become non-local, by changing all paths to be
            # absolute, but ones that can be resolved by any program
            # externally, as the Python of Scons may not be good at unicode.

            options = copy.deepcopy(options)
            source_dir = options["source_dir"]
            options["source_dir"] = "."
            options["result_name"] = getExternalUsePath(
                options["result_name"], only_dirname=True
            )
            options["nuitka_src"] = getExternalUsePath(options["nuitka_src"])
            if "result_exe" in options:
                options["result_exe"] = getExternalUsePath(
                    options["result_exe"], only_dirname=True
                )
            if "icon_path" in options:
                options["icon_path"] = getExternalUsePath(
                    options["icon_path"], only_dirname=True
                )
        else:
            source_dir = None

        scons_command = _buildSconsCommand(quiet, options)

        if Options.isShowScons():
            Tracing.printLine("Scons command:", " ".join(scons_command))

        Tracing.flushStdout()
        return subprocess.call(scons_command, shell=False, cwd=source_dir) == 0
示例#2
0
def runScons(options, quiet):
    with _setupSconsEnvironment():
        scons_command = _buildSconsCommand(quiet, options)

        if Options.isShowScons():
            Tracing.printLine("Scons command:", ' '.join(scons_command))

        Tracing.flushStdout()
        return subprocess.call(scons_command, shell = False) == 0
示例#3
0
def runScons(options, quiet):
    with _setupSconsEnvironment():
        scons_command = _buildSconsCommand(quiet, options)

        if Options.isShowScons():
            Tracing.printLine("Scons command:", " ".join(scons_command))

        Tracing.flushStdout()
        return subprocess.call(scons_command, shell=False) == 0
示例#4
0
def getDependsExePath():
    """ Return the path of depends.exe (for Windows).

        Will prompt the user to download if not already cached in AppData
        directory for Nuitka.
    """
    if Utils.getArchitecture() == "x86":
        depends_url = "http://dependencywalker.com/depends22_x86.zip"
    else:
        depends_url = "http://dependencywalker.com/depends22_x64.zip"

    nuitka_app_dir = getAppDir()

    nuitka_depends_dir = os.path.join(nuitka_app_dir, Utils.getArchitecture())
    nuitka_depends_zip = os.path.join(nuitka_depends_dir,
                                      os.path.basename(depends_url))
    depends_exe = os.path.join(nuitka_depends_dir, "depends.exe")
    makePath(nuitka_depends_dir)

    if not os.path.isfile(nuitka_depends_zip) and not os.path.isfile(
            depends_exe):
        if assumeYesForDownloads():
            reply = "y"
        else:
            Tracing.printLine("""\
Nuitka will make use of Dependency Walker (http://dependencywalker.com) tool
to analyze the dependencies of Python extension modules. Is it OK to download
and put it in "%s".
No installer needed, cached, one time question.

Proceed and download? [Yes]/No """ % (nuitka_app_dir))
            Tracing.flushStdout()

            reply = raw_input()

        if reply.lower() in ("no", "n"):
            sys.exit(
                "Nuitka does not work in --standalone on Windows without.")

        info("Downloading '%s'" % depends_url)

        try:
            urlretrieve(depends_url, nuitka_depends_zip)
        except Exception:  # Any kind of error, pylint: disable=broad-except
            sys.exit("""Failed to download '%s'.\
Contents should manually be extracted to '%s'.""" %
                     (depends_url, nuitka_depends_dir))

    if not os.path.isfile(depends_exe):
        info("Extracting to '%s'" % depends_exe)

        import zipfile

        try:
            depends_zip = zipfile.ZipFile(nuitka_depends_zip)
            depends_zip.extractall(nuitka_depends_dir)
        except Exception:  # Catching anything zip throws, pylint: disable=broad-except
            info("Problem with the downloaded zip file, deleting it.")

            deleteFile(depends_exe, must_exist=False)
            deleteFile(nuitka_depends_zip, must_exist=True)

            sys.exit("Error, need '%s' as extracted from '%s'." %
                     (depends_exe, depends_url))

    assert os.path.isfile(depends_exe)

    return depends_exe
示例#5
0
def getDependsExePath():
    """ Return the path of depends.exe (for Windows).

        Will prompt the user to download if not already cached in AppData
        directory for Nuitka.
    """
    if Utils.getArchitecture() == "x86":
        depends_url = "http://dependencywalker.com/depends22_x86.zip"
    else:
        depends_url = "http://dependencywalker.com/depends22_x64.zip"

    nuitka_app_dir = getAppDir()

    nuitka_depends_dir = os.path.join(nuitka_app_dir, Utils.getArchitecture())
    nuitka_depends_zip = os.path.join(nuitka_depends_dir, os.path.basename(depends_url))
    depends_exe = os.path.join(nuitka_depends_dir, "depends.exe")
    makePath(nuitka_depends_dir)

    if not os.path.isfile(nuitka_depends_zip) and not os.path.isfile(depends_exe):
        if assumeYesForDownloads():
            reply = "y"
        else:
            Tracing.printLine(
                """\
Nuitka will make use of Dependency Walker (http://dependencywalker.com) tool
to analyze the dependencies of Python extension modules. Is it OK to download
and put it in "%s".
No installer needed, cached, one time question.

Proceed and download? [Yes]/No """
                % (nuitka_app_dir)
            )
            Tracing.flushStdout()

            reply = raw_input()

        if reply.lower() in ("no", "n"):
            sys.exit("Nuitka does not work in --standalone on Windows without.")

        info("Downloading '%s'" % depends_url)

        try:
            urlretrieve(depends_url, nuitka_depends_zip)
        except Exception:  # Any kind of error, pylint: disable=broad-except
            sys.exit(
                """Failed to download '%s'.\
Contents should manually be extracted to '%s'."""
                % (depends_url, nuitka_depends_dir)
            )

    if not os.path.isfile(depends_exe):
        info("Extracting to '%s'" % depends_exe)

        import zipfile

        try:
            depends_zip = zipfile.ZipFile(nuitka_depends_zip)
            depends_zip.extractall(nuitka_depends_dir)
        except Exception:  # Catching anything zip throws, pylint:disable=W0703
            info("Problem with the downloaded zip file, deleting it.")

            deleteFile(depends_exe, must_exist=False)
            deleteFile(nuitka_depends_zip, must_exist=True)

            sys.exit(
                "Error, need '%s' as extracted from '%s'." % (depends_exe, depends_url)
            )

    assert os.path.isfile(depends_exe)

    return depends_exe