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
27 changes: 13 additions & 14 deletions rsconnect/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1396,17 +1396,15 @@ def make_quarto_manifest(
"""
if environment:
extra_files = list(extra_files or [])

base_dir = file_or_directory
if isdir(file_or_directory):
# Directory as a Quarto project.
excludes = list(excludes or []) + [".quarto"]

project_config = quarto_inspection.get("config", {}).get("project", {})
output_dir = cast(Union[str, None], project_config.get("output-dir", None))
if output_dir:
excludes = excludes + [output_dir]

files_data = quarto_inspection.get("files", {})
files_input_data = files_data.get("input", [])
# files.input is a list of absolute paths to input (rendered)
Expand All @@ -1419,19 +1417,23 @@ def make_quarto_manifest(
for each in files_input_data:
t, _ = splitext(os.path.relpath(each, file_or_directory))
excludes = excludes + [t + ".html", t + "_files/**/*"]

# relevant files don't need to include requirements.txt file because it is
# always added to the manifest (as a buffer) from the environment contents
if environment:
excludes.append(environment.filename)

relevant_files = _create_quarto_file_list(base_dir, extra_files, excludes)
else:
# Standalone Quarto document
base_dir = dirname(file_or_directory)
file_name = basename(file_or_directory)
relevant_files = [file_name] + list(extra_files or [])

# Use the common directory of the qmd and any extra files as base_dir.
# This avoids having the subfolder appear in both base_dir and rel_path.
all_files = [file_or_directory] + extra_files

abs_paths = [os.path.abspath(p) for p in all_files]
base_dir = os.path.commonpath(abs_paths)

# Store paths relative to base_dir
relevant_files = [os.path.relpath(p, base_dir) for p in abs_paths]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Am I reading this correctly that this is using absolute paths at first then shifts them to relative paths (relative to the base_dir)? Is there a way to avoid that back and forth and just go directly to paths relative to the base_dir? It's not the end of the world if not, just seems like a bit of extra back and forth that is slightly distracting.


manifest = make_source_manifest(
app_mode,
environment,
Expand All @@ -1441,13 +1443,10 @@ def make_quarto_manifest(
env_management_py,
env_management_r,
)

if environment:
manifest_add_buffer(manifest, environment.filename, environment.contents)

manifest_add_buffer(manifest, environment.filename, environment.contents)
for rel_path in relevant_files:
manifest_add_file(manifest, rel_path, base_dir)

manifest_add_file(manifest, rel_path, base_dir)
Comment on lines -1446 to +1449
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

These are just whitespace changes, yeah?

return manifest, relevant_files


Expand Down