diff options
author | Wojtek Kosior <koszko@koszko.org> | 2022-10-11 10:26:55 +0200 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2022-10-11 13:12:11 +0200 |
commit | 0c8d70daae4c4dfc989edad465db94ffc665416d (patch) | |
tree | 86f1b23e863b2dae1efd00686d46890b4b72ccb2 /src/hydrilla/builder/piggybacking.py | |
parent | 9074d98f711b6ccc099df8bccb1ed28390bcf0da (diff) | |
download | haketilo-hydrilla-0c8d70daae4c4dfc989edad465db94ffc665416d.tar.gz haketilo-hydrilla-0c8d70daae4c4dfc989edad465db94ffc665416d.zip |
[builder][server] restore compatibility with python 3.7
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 |