Skip to content

Commit

Permalink
Allow include source to be a list of filenames/patterns.
Browse files Browse the repository at this point in the history
This allows nesting within the include setting of .shed.yml
for example if you have a batch of files with the same
strip_components setting. See GitHub issue galaxyproject#180.
  • Loading branch information
peterjc committed May 6, 2015
1 parent c870d2a commit f93e0c7
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions planemo/shed/__init__.py
Expand Up @@ -802,12 +802,20 @@ 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"]:
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 +880,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

0 comments on commit f93e0c7

Please sign in to comment.