Commit 646df2b9 authored by Mike Hommey's avatar Mike Hommey
Browse files

Bug 1253203 - Use mozpath functions for sandboxed os.path in configure.py....

Bug 1253203 - Use mozpath functions for sandboxed os.path in configure.py. r=nalexander,r=chmanchester

Generally speaking, the configuration needs forward-slashes in paths.
We might as well make it hard(er) to set configuration items with
backslash separators on Windows by exposing mozpath.* functions in place
of os.path functions. The downside is that functions explicitly
importing os will still get the real os.path functions.
parent 3b780471
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -98,17 +98,17 @@ class ConfigureSandbox(dict):

    # Expose a limited set of functions from os.path
    OS = ReadOnlyNamespace(path=ReadOnlyNamespace(
        abspath=os.path.abspath,
        basename=os.path.basename,
        dirname=os.path.dirname,
        abspath=mozpath.abspath,
        basename=mozpath.basename,
        dirname=mozpath.dirname,
        exists=os.path.exists,
        isabs=os.path.isabs,
        isdir=os.path.isdir,
        isfile=os.path.isfile,
        join=os.path.join,
        normpath=os.path.normpath,
        realpath=os.path.realpath,
        relpath=os.path.relpath,
        join=mozpath.join,
        normpath=mozpath.normpath,
        realpath=mozpath.realpath,
        relpath=mozpath.relpath,
    ))

    def __init__(self, config, environ=os.environ, argv=sys.argv,
+4 −0
Original line number Diff line number Diff line
@@ -30,6 +30,10 @@ def relpath(path, start):
    return '' if rel == '.' else rel


def realpath(path):
    return normsep(os.path.realpath(path))


def abspath(path):
    return normsep(os.path.abspath(path))