simonw / datasette-publish-fly

Datasette plugin for publishing data using Fly
Apache License 2.0
20 stars 7 forks source link

`--generate-dir` works confusingly #18

Closed stefanw closed 1 year ago

stefanw commented 2 years ago

I tried out --generate-dir and ran into two problems with the code that's responsible:

https://github.com/simonw/datasette-publish-fly/blob/564a216508466b9cb1d0b30fe90199fc8546df46/datasette_publish_fly/__init__.py#L313-L322

As a workaround I had to give an absolute path, but that was after some confusion and digging into the code.

simonw commented 1 year ago

Yeah that's a good call: generate_dir being resolved relative to that temporary directory is most definitely a bug!

simonw commented 1 year ago

Replicated that other bug locally:

datasette publish fly github.db -a wat --generate-dir foop --plugins plugins

Which does this:

  File "/Users/simon/.pyenv/versions/3.10.0/lib/python3.10/shutil.py", line 417, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/Users/simon/.pyenv/versions/3.10.0/lib/python3.10/shutil.py", line 254, in copyfile
    with open(src, 'rb') as fsrc:
IsADirectoryError: [Errno 21] Is a directory: 'plugins'

Code at fault is:

https://github.com/simonw/datasette-publish-fly/blob/68b809fe6abb6dd9aa076106ccfe824f0ccea1da/datasette_publish_fly/__init__.py#L390-L394

simonw commented 1 year ago

Used ChatGPT:

image