Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow include source to be a list of filenames/patterns. #185

Merged
merged 2 commits into from
May 6, 2015
Merged
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
26 changes: 20 additions & 6 deletions planemo/shed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,12 +802,22 @@ def _realized_files(self, name):
config = self._realize_config(name)
realized_files = []
missing = []
for include in config["include"]:
included = RealizedFile.realized_files_for(self.path, include)
if not included:
missing.append(include)
else:
realized_files.extend(included)
for include_info in config["include"]:
if not isinstance(include_info, dict):
include_info = {"source": include_info}
source_list = include_info.get("source")
if not isinstance(source_list, list):
source_list = [source_list]
# Preprocess any entries with a source list into copies
# with a single source entry:
for source in source_list:
include = include_info.copy()
include["source"] = source
included = RealizedFile.realized_files_for(self.path, include)
if not included:
missing.append(include)
else:
realized_files.extend(included)
return RealizedFiles(realized_files, missing)

def _realize_config(self, name):
Expand Down Expand Up @@ -872,6 +882,10 @@ def realize_to(self, directory):
if os.path.islink(source_path):
source_path = os.path.realpath(source_path)
relative_dest = self.relative_dest
if relative_dest == ".":
# The target folder likely exists,
# but would still want to make symlink...
relative_dest = os.path.split(source_path)[1]
target_path = os.path.join(directory, relative_dest)
target_exists = os.path.exists(target_path)
if not target_exists:
Expand Down