Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions marimo/_server/export/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@ def export_assets(self, directory: Path) -> None:
if not dirpath.exists():
dirpath.mkdir(parents=True, exist_ok=True)

import os
import shutil

shutil.copytree(
Expand All @@ -743,6 +744,12 @@ def export_assets(self, directory: Path) -> None:
dirs_exist_ok=True,
ignore=(shutil.ignore_patterns("index.html")),
)
# Ensure output is writable (source may be read-only, e.g. nix store)
for root, _dirs, files in os.walk(dirpath):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we not just bail if RO? This attempts to modify the permissions- which I don't think will solve your Nix issue

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does solve the issue I reported. It only modifies permissions of copied files, not in nix store. I dont love this solution either but could not think of much cleaner solution. Ideally python should have a function like shutil.copytree but ignored copied from permissions and always makes destination files writable.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os.chmod(root, os.stat(root).st_mode | 0o755)
for f in files:
fp = os.path.join(root, f)
os.chmod(fp, os.stat(fp).st_mode | 0o644)

def export_public_folder(
self, directory: Path, marimo_file: MarimoPath
Expand Down
Loading