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)
| 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: |
no test coverage detected