diff options
Diffstat (limited to 'src/hydrilla/builder/piggybacking.py')
-rw-r--r-- | src/hydrilla/builder/piggybacking.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/hydrilla/builder/piggybacking.py b/src/hydrilla/builder/piggybacking.py index 3e4084f..c152135 100644 --- a/src/hydrilla/builder/piggybacking.py +++ b/src/hydrilla/builder/piggybacking.py @@ -52,10 +52,10 @@ class Piggybacked: """ def __init__( self, - archives: dict[str, Path] = {}, - roots: dict[str, Path] = {}, - package_license_files: list[PurePosixPath] = [], - resource_must_depend: list[dict] = [] + archives: t.Dict[str, Path] = {}, + roots: t.Dict[str, Path] = {}, + package_license_files: t.List[PurePosixPath] = [], + resource_must_depend: t.List[dict] = [] ) -> None: """ Initialize this Piggybacked object. @@ -106,13 +106,15 @@ class Piggybacked: path = path.resolve() - if not path.is_relative_to(root_path): + try: + path.relative_to(root_path) + except ValueError: raise FileReferenceError(_('loading_{}_outside_piggybacked_dir') .format(file_ref_name)) return path - def archive_files(self) -> t.Iterator[tuple[PurePosixPath, Path]]: + def archive_files(self) -> t.Iterator[t.Tuple[PurePosixPath, Path]]: """ Yield all archive files in use. Each yielded tuple holds file's desired path relative to the piggybacked archives directory to be created and |