diff --git a/poetry_multiproject_plugin/components/project/packages.py b/poetry_multiproject_plugin/components/project/packages.py index b216094..543fe73 100644 --- a/poetry_multiproject_plugin/components/project/packages.py +++ b/poetry_multiproject_plugin/components/project/packages.py @@ -6,26 +6,30 @@ from poetry_multiproject_plugin.components.toml.packages import packages_to_paths +def is_relative_path(path: str) -> bool: + return str(path).startswith("..") + + def copy_packages( project_file: Path, destination: Path, top_ns: Union[str, None] = None ) -> None: content = read.toml(project_file) package_paths = packages_to_paths(content) - for p in package_paths: + relative_package_paths = [p for p in package_paths if is_relative_path(p["from"])] + + for p in relative_package_paths: p_from = p["from"] p_to = p["to"] source = Path(project_file.parent / p_from) - is_relative_path = str(p_from).startswith("..") - - to = f"{top_ns}/{p_to}" if top_ns and is_relative_path else p_to + to = f"{top_ns}/{p_to}" if top_ns else p_to - to = Path(destination / to) + to_path = Path(destination / to) shutil.copytree( source, - to, + to_path, ignore=shutil.ignore_patterns( "__pycache__", ".venv", ".mypy_cache", ".git" ), diff --git a/pyproject.toml b/pyproject.toml index dbcc339..c5dda5a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "poetry-multiproject-plugin" -version = "1.4.1" +version = "1.5.0" description = "A Poetry plugin that makes it possible to use relative package includes." authors = ["David Vujic"] license = "MIT"