Return the file names for the cache files. Args: id: module ID path: module path options: build options Returns: A tuple with the file names to be used for the meta file, the data file, and the fine-grained deps JSON, respectively.
(id: str, path: str, options: Options)
| 1931 | |
| 1932 | |
| 1933 | def get_cache_names(id: str, path: str, options: Options) -> tuple[str, str, str | None]: |
| 1934 | """Return the file names for the cache files. |
| 1935 | |
| 1936 | Args: |
| 1937 | id: module ID |
| 1938 | path: module path |
| 1939 | options: build options |
| 1940 | |
| 1941 | Returns: |
| 1942 | A tuple with the file names to be used for the meta file, the |
| 1943 | data file, and the fine-grained deps JSON, respectively. |
| 1944 | """ |
| 1945 | if options.cache_map: |
| 1946 | pair = options.cache_map.get(normpath(path, options)) |
| 1947 | else: |
| 1948 | pair = None |
| 1949 | if pair is not None: |
| 1950 | # The cache map paths were specified relative to the base directory, |
| 1951 | # but the filesystem metastore APIs operates relative to the cache |
| 1952 | # prefix directory. |
| 1953 | # Solve this by rewriting the paths as relative to the root dir. |
| 1954 | # This only makes sense when using the filesystem backed cache. |
| 1955 | root = _cache_dir_prefix(options) |
| 1956 | return os.path.relpath(pair[0], root), os.path.relpath(pair[1], root), None |
| 1957 | prefix = os.path.join(*id.split(".")) |
| 1958 | is_package = os.path.basename(path).startswith("__init__.py") |
| 1959 | if is_package: |
| 1960 | prefix = os_path_join(prefix, "__init__") |
| 1961 | |
| 1962 | deps_json = None |
| 1963 | if options.cache_fine_grained: |
| 1964 | deps_json = prefix + ".deps.json" |
| 1965 | if options.fixed_format_cache: |
| 1966 | data_suffix = ".data.ff" |
| 1967 | meta_suffix = ".meta.ff" |
| 1968 | else: |
| 1969 | data_suffix = ".data.json" |
| 1970 | meta_suffix = ".meta.json" |
| 1971 | return prefix + meta_suffix, prefix + data_suffix, deps_json |
| 1972 | |
| 1973 | |
| 1974 | def options_snapshot(id: str, manager: BuildManager) -> dict[str, object]: |
no test coverage detected
searching dependent graphs…