-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip! Introduce workdir portability to all workflows
XXX FIXME: rationale, relationship to "workflows as programs" XXX FIXME: alternatives considered (but declined) for path-in-config-value handling XXX FIXME: document layout/structure of workdir
- Loading branch information
Showing
16 changed files
with
119 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Shared | ||
|
||
> **Warning** | ||
> Please be aware of the multiple workflows that will be affected when editing files in this directory! | ||
This directory that holds files that are shared across multiple workflows. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import os.path | ||
|
||
def resolve_config_path(path): | ||
""" | ||
Resolve a relative *path* given in a configuration value. | ||
Resolves *path* as relative to the workflow's ``defaults/`` directory (i.e. | ||
``os.path.join(workflow.basedir, "defaults", path)``) if it doesn't exist | ||
in the workflow's analysis directory (i.e. the current working | ||
directory, or workdir, usually given by ``--directory`` (``-d``)). | ||
This behaviour allows a default configuration value to point to a default | ||
auxiliary file while also letting the file used be overridden either by | ||
setting an alternate file path in the configuration or by creating a file | ||
with the conventional name in the workflow's analysis directory. | ||
""" | ||
global workflow | ||
|
||
if not os.path.exists(path): | ||
# Special-case defaults/… for backwards compatibility with older | ||
# configs. We could achieve the same behaviour with a symlink | ||
# (defaults/defaults → .) but that seems less clear. | ||
if path.startswith("defaults/"): | ||
defaults_path = os.path.join(workflow.basedir, path) | ||
else: | ||
defaults_path = os.path.join(workflow.basedir, "defaults", path) | ||
|
||
if os.path.exists(defaults_path): | ||
return defaults_path | ||
|
||
return path |