Exemplo n.º 1
0
def run_command (cmd):
    try:
        retcode, output = 0, None
        if msys.is_msys():
            retcode, output = msys_obj.run_shell_command (cmd)
        else:
            p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
            output = p.communicate()[0]
            retcode = p.returncode
        if helpers.getversion()[0] >= 3:
            output = str (output, "utf-8")
        return retcode, output
    except OSError:
        return -1, None
Exemplo n.º 2
0
def run_checks ():
    # Python version check.
    if helpers.getversion () < PYTHON_MINIMUM: # major, minor check
        raise Exception ("You should have at least Python >= %d.%d.x "
                         "installed." % PYTHON_MINIMUM)

    buildsystem = None
    builddefines = []
    defcompiler = ''
    if sys.platform == "win32":
        if msys.is_msys ():
            buildsystem = "msys"
            builddefines.append (("IS_MSYS", None))
            defcompiler = "mingw32"
        else:
            buildsystem = "win"
            builddefines.append (("IS_WIN32", None))
            builddefines.append (("WIN32", None))
            defcompiler = "msvc"
    elif sys.platform == "darwin":
        buildsystem = "darwin"
        builddefines.append (("IS_DARWIN", None))
        defcompiler = "unix"
    else:
        buildsystem = "unix"
        defcompiler = "unix"
        builddefines.append (("IS_UNIX", None))

    if cfg.build['SDL']:
        sdlversion = config_modules.sdl_get_version (buildsystem)
    compiler = get_compiler (sys.argv) or defcompiler

    print ("\nThe following information will be used to build Pygame:")
    print ("\t System:   %s" % buildsystem)
    print ("\t Python:   %d.%d.%d" % helpers.getversion ())
    print ("\t Compiler: %s" % compiler)
    if cfg.build['SDL']:
        print ("\t SDL:      %s" % sdlversion)
    return buildsystem, builddefines, compiler