pygame / config /

import subprocess
from config import msys, helpers
    msys_obj = msys.Msys (require_mingw=False)
    msys_obj = None

def run_command (cmd):
        if msys.is_msys():
            return msys_obj.run_shell_command (cmd)
            p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
            output = p.communicate()[0]
            if helpers.getversion()[0] >= 3:
                output = str (output, "ascii")
            return p.returncode, output
    except OSError:
        return -1, None

def exec_pkgconfig (package, flags, repl=None):
    cmd = ["pkg-config", flags, package]
    data = run_command (cmd)[1]
    if data and repl:
        return data.replace (repl, "").split ()
    return data.split ()

def get_incdirs (package):
    return exec_pkgconfig (package, "--cflags-only-I", "-I")

def get_cflags (package):
    return exec_pkgconfig (package, "--cflags-only-other")

def get_libdirs (package):
    return exec_pkgconfig (package, "--libs-only-L", "-L")

def get_libs (package):
    return exec_pkgconfig (package, "--libs-only-l", "-l")

def get_lflags (package):
    return exec_pkgconfig (package, "--libs-only-other")

def get_version (package):
    return exec_pkgconfig (package, "--modversion")

def exists (package):
    cmd = ["pkg-config", "--exists", package]
    return run_command (cmd)[0] in (None, 0)

def has_pkgconfig ():
    cmd = ["pkg-config", "--version"]
    return run_command (cmd)[0] == 0
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.