Skip to content

Commit

Permalink
Enable setting root directory path for Julia Tools and Executable Too…
Browse files Browse the repository at this point in the history
…l specs that don't have a main program
  • Loading branch information
ptsavol committed Dec 19, 2024
1 parent 48b8b53 commit 1a7eb49
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion spine_items/tool/tool_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,12 @@ def make_julia_commands(self, cmdline_args):
list of str: Commands to execute in the Julia Console
"""
mod_work_dir = escape_backward_slashes(self.basedir)
mod_main_prgm = escape_backward_slashes(self.tool_specification.main_prgm)
cmds = [f'cd("{mod_work_dir}");']
if cmdline_args:
fmt_cmdline_args = '["' + escape_backward_slashes('", "'.join(cmdline_args)) + '"]'
cmds += [f"empty!(ARGS); append!(ARGS, {fmt_cmdline_args});"]
cmds += [f'include("{self.tool_specification.main_prgm}")']
cmds += [f'include("{mod_main_prgm}")']
return cmds

def make_sysimage_arg(self):
Expand Down
5 changes: 4 additions & 1 deletion spine_items/tool/widgets/tool_specification_editor_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,10 @@ def _make_new_specification(self, spec_name):
new_spec_dict = {"name": spec_name, "description": self._spec_toolbar.description(), "tooltype": toolspectype}
if not main_program_file:
main_prgm_file_name = ""

Check warning on line 259 in spine_items/tool/widgets/tool_specification_editor_window.py

View check run for this annotation

Codecov / codecov/patch

spine_items/tool/widgets/tool_specification_editor_window.py#L259

Added line #L259 was not covered by tests
self.includes_main_path = None
if self.has_root_directory():
self.includes_main_path = self.item.root_dir

Check warning on line 261 in spine_items/tool/widgets/tool_specification_editor_window.py

View check run for this annotation

Codecov / codecov/patch

spine_items/tool/widgets/tool_specification_editor_window.py#L261

Added line #L261 was not covered by tests
else:
self.includes_main_path = None

Check warning on line 263 in spine_items/tool/widgets/tool_specification_editor_window.py

View check run for this annotation

Codecov / codecov/patch

spine_items/tool/widgets/tool_specification_editor_window.py#L263

Added line #L263 was not covered by tests
elif self.has_root_directory():
main_prgm_file_name = os.path.relpath(main_program_file, self.item.root_dir)
self.includes_main_path = self.item.root_dir

Check warning on line 266 in spine_items/tool/widgets/tool_specification_editor_window.py

View check run for this annotation

Codecov / codecov/patch

spine_items/tool/widgets/tool_specification_editor_window.py#L265-L266

Added lines #L265 - L266 were not covered by tests
Expand Down

0 comments on commit 1a7eb49

Please sign in to comment.