Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug when using the symlink driver #22

Open
n-burger opened this issue Mar 23, 2023 · 2 comments · May be fixed by #23
Open

Bug when using the symlink driver #22

n-burger opened this issue Mar 23, 2023 · 2 comments · May be fixed by #23

Comments

@n-burger
Copy link

n-burger commented Mar 23, 2023

Thanks for the great work. I think this extension is very helpful! Unfortunately, the symlink driver is not usable at the moment.

The function Collections:init (collections.py, line 101), creates a directory for every collection. Subsequently, the symlink driver fails to create a symlink, because a directory under the same name exists already:

Executing collections ...
  external_folder: (SymlinkDriver) Creating symlink...
Traceback (most recent call last):
  File "***/sphinxcontrib/collections/drivers/symlink.py", line 54, in run
    os.symlink(source, target)
FileExistsError: [Errno 17] File exists: ***/doc/external_folder' -> '***/doc/_collections/external_folder'

Configuration used:

collections = {
    "external_folder": {
        "driver": "symlink",
        "source": str(PROJECT_BASE / "external_folder"),
        "target": "external_folder",
    },
}
@n-burger
Copy link
Author

Adding the following lines to the SymlinkDriver:run() fixes the issue:

        if os.path.exists(target):
            self.info("Removing already existing directory...")
            os.unlink(target)

@jgarte
Copy link
Contributor

jgarte commented Mar 29, 2023

@n-burger Hi, can you make a PR for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants