5353 " which is unavailable, please install `pip install "
5454 "bioblend`" )
5555
56+ REPO_TYPE_UNRESTRICTED = "unrestricted"
57+ REPO_TYPE_TOOL_DEP = "tool_dependency_definition"
58+ REPO_TYPE_SUITE = "repository_suite_definition"
59+
5660
5761def shed_repo_config (path ):
5862 shed_yaml_path = os .path .join (path , SHED_CONFIG_NAME )
@@ -189,7 +193,7 @@ def download_tarball(ctx, tsi, path, **kwds):
189193 os .remove (archival_file )
190194
191195
192- def build_tarball (tool_path ):
196+ def build_tarball (tool_path , ** kwds ):
193197 """Build a tool-shed tar ball for the specified path, caller is
194198 responsible for deleting this file.
195199 """
@@ -198,7 +202,8 @@ def build_tarball(tool_path):
198202 # It should be pushed up a level into the thing that is uploading tar
199203 # balls to iterate over them - but placing it here for now because
200204 # it address some bugs.
201- for realized_repository in realize_effective_repositories (tool_path ):
205+ effective_repositories = realize_effective_repositories (tool_path , ** kwds )
206+ for realized_repository in effective_repositories :
202207 fd , temp_path = mkstemp ()
203208 try :
204209 tar = tarfile .open (temp_path , "w:gz" )
@@ -252,11 +257,11 @@ def path_to_repo_name(path):
252257def shed_repo_type (config , name ):
253258 repo_type = config .get ("type" , None )
254259 if repo_type is None and name .startswith ("package_" ):
255- repo_type = "tool_dependency_definition"
260+ repo_type = REPO_TYPE_TOOL_DEP
256261 elif repo_type is None and name .startswith ("suite_" ):
257- repo_type = "repository_suite_definition"
262+ repo_type = REPO_TYPE_SUITE
258263 elif repo_type is None :
259- repo_type = "unrestricted"
264+ repo_type = REPO_TYPE_UNRESTRICTED
260265 return repo_type
261266
262267
@@ -302,7 +307,7 @@ def _find_raw_repositories(path, **kwds):
302307 config = shed_repo_config (shed_file_dirs [0 ])
303308 config_name = config .get ("name" , None )
304309
305- if len (shed_file_dirs ) < 2 and config_name is None :
310+ if len (shed_file_dirs ) < 2 and config_name is None and name is None :
306311 name = path_to_repo_name (path )
307312
308313 if len (shed_file_dirs ) > 1 and name is not None :
@@ -348,13 +353,14 @@ def __init__(self, path, config):
348353 self .path = path
349354 self .config = config
350355 self .name = config ["name" ]
356+ self .type = shed_repo_type (config , self .name )
351357
352358 @property
353359 def _hash (self ):
354360 return hashlib .md5 (self .name .encode ('utf-8' )).hexdigest ()
355361
356362 def realize_to (self , parent_directory ):
357- directory = os .path .join (parent_directory , self ._hash )
363+ directory = os .path .join (parent_directory , self ._hash , self . name )
358364 if not os .path .exists (directory ):
359365 os .makedirs (directory )
360366
@@ -385,6 +391,16 @@ def _realize_file(self, relative_path, directory):
385391 os .symlink (source_path , target_path )
386392
387393 def _implicit_ignores (self , relative_path ):
394+ # Filter out "unwanted files" :) like READMEs for special
395+ # repository types.
396+ if self .type == REPO_TYPE_TOOL_DEP :
397+ if relative_path != "tool_dependencies.xml" :
398+ return True
399+
400+ if self .type == REPO_TYPE_SUITE :
401+ if relative_path != "repository_dependencies.xml" :
402+ return True
403+
388404 name = os .path .basename (relative_path )
389405 if relative_path .startswith (".git" ):
390406 return True
0 commit comments