MCPcopy Index your code
hub / github.com/nodejs/node / LocalPathify

Method LocalPathify

tools/gyp/pylib/gyp/generator/android.py:988–1005  ·  view source on GitHub ↗

Convert a subdirectory-relative path into a normalized path which starts with the make variable $(LOCAL_PATH) (i.e. the top of the project tree). Absolute paths, or paths that contain variables, are just normalized.

(self, path)

Source from the content-addressed store, hash-verified

986 self.fp.write(text + "\n")
987
988 def LocalPathify(self, path):
989 """Convert a subdirectory-relative path into a normalized path which starts
990 with the make variable $(LOCAL_PATH) (i.e. the top of the project tree).
991 Absolute paths, or paths that contain variables, are just normalized."""
992 if "$(" in path or os.path.isabs(path):
993 # path is not a file in the project tree in this case, but calling
994 # normpath is still important for trimming trailing slashes.
995 return os.path.normpath(path)
996 local_path = os.path.join("$(LOCAL_PATH)", self.path, path)
997 local_path = os.path.normpath(local_path)
998 # Check that normalizing the path didn't ../ itself out of $(LOCAL_PATH)
999 # - i.e. that the resulting path is still inside the project tree. The
1000 # path may legitimately have ended up containing just $(LOCAL_PATH), though,
1001 # so we don't look for a slash.
1002 assert local_path.startswith("$(LOCAL_PATH)"), (
1003 f"Path {path} attempts to escape from gyp path {self.path} !)"
1004 )
1005 return local_path
1006
1007 def ExpandInputRoot(self, template, expansion, dirname):
1008 if "%(INPUT_ROOT)s" not in template and "%(INPUT_DIRNAME)s" not in template:

Callers 5

WriteActionsMethod · 0.95
WriteRulesMethod · 0.95
WriteCopiesMethod · 0.95
WriteSourcesMethod · 0.95
WriteListMethod · 0.95

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected