Esempio n. 1
0
 def test_AppendPathPreserveOld(self):
     """Test appending to a path while preserving old paths"""
     p1 = r'C:\dir\num\one;C:\dir\num\two'
     # have to include the pathsep here so that the test will work on UNIX too.
     p1 = AppendPath(p1, r'C:\dir\num\one', sep=';', delete_existing=0)
     p1 = AppendPath(p1, r'C:\dir\num\three', sep=';')
     assert (p1 == r'C:\dir\num\one;C:\dir\num\two;C:\dir\num\three')
Esempio n. 2
0
 def test_AppendPath(self):
     """Test appending to a path."""
     p1 = r'C:\dir\num\one;C:\dir\num\two'
     p2 = r'C:\mydir\num\one;C:\mydir\num\two'
     # have to include the pathsep here so that the test will work on UNIX too.
     p1 = AppendPath(p1, r'C:\dir\num\two', sep=';')
     p1 = AppendPath(p1, r'C:\dir\num\three', sep=';')
     p2 = AppendPath(p2, r'C:\mydir\num\three', sep=';')
     p2 = AppendPath(p2, r'C:\mydir\num\one', sep=';')
     assert (p1 == r'C:\dir\num\one;C:\dir\num\two;C:\dir\num\three')
     assert (p2 == r'C:\mydir\num\two;C:\mydir\num\three;C:\mydir\num\one')
Esempio n. 3
0
    def test_AppendPath(self):
        """Test appending to a path."""
        p1 = r'C:\dir\num\one;C:\dir\num\two'
        p2 = r'C:\mydir\num\one;C:\mydir\num\two'
        # have to include the pathsep here so that the test will work on UNIX too.
        p1 = AppendPath(p1, r'C:\dir\num\two', sep=';')
        p1 = AppendPath(p1, r'C:\dir\num\three', sep=';')
        assert p1 == r'C:\dir\num\one;C:\dir\num\two;C:\dir\num\three', p1

        p2 = AppendPath(p2, r'C:\mydir\num\three', sep=';')
        p2 = AppendPath(p2, r'C:\mydir\num\one', sep=';')
        assert p2 == r'C:\mydir\num\two;C:\mydir\num\three;C:\mydir\num\one', p2

        # check (only) last one is kept if there are dupes in new
        p3 = r'C:\dir\num\one'
        p3 = AppendPath(p3,
                        r'C:\dir\num\two;C:\dir\num\three;C:\dir\num\two',
                        sep=';')
        assert p3 == r'C:\dir\num\one;C:\dir\num\three;C:\dir\num\two', p3
Esempio n. 4
0
def CheckPango(context, backend):
    context.Message("Checking for Pango with " + backend + " backend... ")
    env = context.env
    gtkdir = env.get("gtkdir", os.environ.get("GTK_BASEPATH"))
    if gtkdir:
        environ["PATH"] = AppendPath(environ["PATH"], join(gtkdir, "bin"))
        environ["PKG_CONFIG_PATH"] = AppendPath(
            environ.get("PKG_CONFIG_PATH", ""), join(gtkdir, "lib/pkgconfig"))
        if sys.platform != "win32":
            env["PKGCONFIG_FLAGS"] = "--define-variable=prefix=" + gtkdir

    try:
        env["ENV"]["PKG_CONFIG_PATH"] = environ.get("PKG_CONFIG_PATH")
        env.ParseConfig("pkg-config --libs --cflags $PKGCONFIG_FLAGS pango" +
                        backend)
        context.Result("yes")
        return True
    except OSError:
        context.Result("no")
        return False
Esempio n. 5
0
def CheckCairo(context, min_version):
    context.Message("Checking for Cairo... ")
    env = context.env

    gtkdir = env.get("gtkdir", environ.get("GTK_BASEPATH"))
    if gtkdir:
        environ["PATH"] = AppendPath(environ["PATH"], join(gtkdir, "bin"))
        environ["PKG_CONFIG_PATH"] = AppendPath(
            environ.get("PKG_CONFIG_PATH", ""), join(gtkdir, "lib/pkgconfig"))
        if sys.platform != "win32":
            env["PKGCONFIG_FLAGS"] = "--define-variable=prefix=" + gtkdir

    try:
        env["ENV"]["PKG_CONFIG_PATH"] = environ.get("PKG_CONFIG_PATH", "")
        version_arg = env["ESCAPE"](" >= ") + min_version
        env.ParseConfig("pkg-config --libs --cflags $PKGCONFIG_FLAGS cairo" +
                        version_arg)
        context.Result("yes")
        return True
    except OSError:
        context.Result("no")
        return False
Esempio n. 6
0
def CheckPango(context, backend, require_version=None):
    if require_version:
        version_string = " >= " + require_version
    else:
        version_string = ""
    context.Message("Checking for Pango" + version_string + " with " +
                    backend + " backend... ")
    version_string = version_string.replace(">=", "'>='")
    env = context.env
    gtkdir = env.get("GTKDIR", os.environ.get("GTK_BASEPATH"))
    if gtkdir:
        environ["PATH"] = AppendPath(environ["PATH"], join(gtkdir, "bin"))
        environ["PKG_CONFIG_PATH"] = AppendPath(
            environ.get("PKG_CONFIG_PATH", ""), join(gtkdir, "lib/pkgconfig"))

    try:
        env.ParseConfig("pkg-config --libs --cflags pango" + backend +
                        version_string)
        context.Result("yes")
        return True
    except OSError:
        context.Result("no")
        return False