Home | History | Annotate | Download | only in gyp

Lines Matching full:path

10 import os.path
89 # If a relative path, parsed_build_file is relative to the directory
91 # parsed_build_file is not a usable path as-is. Resolve it by
93 # absolute, it is usable as a path regardless of the current directory,
94 # and os.path.join will return it as-is.
95 build_file = os.path.normpath(os.path.join(os.path.dirname(build_file),
98 if not os.path.isabs(build_file):
126 # /path/to/file.gyp:target_name#toolset
134 def RelativePath(path, relative_to, follow_path_symlink=True):
135 # Assuming both |path| and |relative_to| are relative to the current
136 # directory, returns a relative path that identifies path relative to
138 # If |follow_symlink_path| is true (default) and |path| is a symlink, then
139 # this method returns a path to the real file represented by |path|. If it is
140 # false, this method returns a path to the symlink. If |path| is not a
145 path = os.path.realpath(path)
147 path = os.path.abspath(path)
148 relative_to = os.path.realpath(relative_to)
150 # On Windows, we can't create a relative path to a different drive, so just
151 # use the absolute path.
153 if (os.path.splitdrive(path)[0].lower() !=
154 os.path.splitdrive(relative_to)[0].lower()):
155 return path
158 path_split = path.split(os.path.sep)
159 relative_to_split = relative_to.split(os.path.sep)
162 prefix_len = len(os.path.commonprefix([path_split, relative_to_split]))
166 relative_split = [os.path.pardir] * (len(relative_to_split) - prefix_len) + \
174 return os.path.join(*relative_split)
178 def InvertRelativePath(path, toplevel_dir=None):
179 """Given a path like foo/bar that is relative to toplevel_dir, return
180 the inverse relative path back to the toplevel_dir.
182 E.g. os.path.normpath(os.path.join(path, InvertRelativePath(path)))
183 should always produce the empty string, unless the path contains symlinks.
185 if not path:
186 return path
188 return RelativePath(toplevel_dir, os.path.join(toplevel_dir, path))
191 def FixIfRelativePath(path, relative_to):
192 # Like RelativePath but returns |path| unchanged if it is absolute.
193 if os.path.isabs(path):
194 return path
195 return RelativePath(path, relative_to)
198 def UnrelativePath(path, relative_to):
199 # Assuming that |relative_to| is relative to the current directory, and |path|
200 # is a path relative to the dirname of |relative_to|, returns a path that
201 # identifies |path| relative to the current directory.
202 rel_dir = os.path.dirname(relative_to)
203 return os.path.normpath(os.path.join(rel_dir, path))
345 prefix=os.path.split(filename)[1] + '.gyp.',
346 dir=os.path.split(filename)[0])
388 if sys.platform == 'win32' and os.path.exists(filename):
402 def EnsureDirExists(path):
403 """Make sure the directory for |path| exists."""
405 os.makedirs(os.path.dirname(path))
451 source_path = os.path.join(
452 os.path.dirname(os.path.abspath(__file__)), '%s_tool.py' % prefix)
464 tool_path = os.path.join(out_path, 'gyp-%s-tool' % prefix)