fix(sphinx): recursive dir copy (#4231) The fix prevents recursive directories copy if `srcdir = pathlib.Path(args[1])` at https://github.com/bazel-contrib/rules_python/blob/278664d7/sphinxdocs/sphinxdocs/private/sphinx_build.py#L555 is '.'. which results to ``` raise DirectorySyncerError(list(self._errors)) DirectorySyncerError: Encountered 1 error(s) during sync: - [Errno 36] File name too long: '.worker-in.d/.worker-in.d/.worker-in.d/.worker-in.d/<repeated many times> ```
diff --git a/sphinxdocs/sphinxdocs/private/sphinx_build.py b/sphinxdocs/sphinxdocs/private/sphinx_build.py index f20fbd6..b01db53 100644 --- a/sphinxdocs/sphinxdocs/private/sphinx_build.py +++ b/sphinxdocs/sphinxdocs/private/sphinx_build.py
@@ -225,8 +225,11 @@ """Recursively creates destination directory and submits tasks for its entries.""" try: dest.mkdir(parents=True, exist_ok=True) + dest_path = dest.resolve() with os.scandir(src) as scanner: for entry in scanner: + if pathlib.Path(entry.path).resolve() == dest_path: + continue c_dest = dest / entry.name c_src = pathlib.Path(entry.path) if entry.is_dir():