MCPcopy Create free account
hub / github.com/StackStorm/st2 / get_pack_directory

Function get_pack_directory

st2common/st2common/content/utils.py:186–209  ·  view source on GitHub ↗

Retrieve a directory for the provided pack. If a directory for the provided pack doesn't exist in any of the search paths, None is returned instead. Note: If same pack exists in multiple search path, path to the first one is returned. :param pack_name: Pack name. :type pa

(pack_name)

Source from the content-addressed store, hash-verified

184
185
186def get_pack_directory(pack_name):
187 """
188 Retrieve a directory for the provided pack.
189
190 If a directory for the provided pack doesn't exist in any of the search paths, None
191 is returned instead.
192
193 Note: If same pack exists in multiple search path, path to the first one is returned.
194
195 :param pack_name: Pack name.
196 :type pack_name: ``str``
197
198 :return: Pack to the pack directory.
199 :rtype: ``str`` or ``None``
200 """
201 packs_base_paths = get_packs_base_paths()
202 for packs_base_path in packs_base_paths:
203 pack_base_path = os.path.join(packs_base_path, quote_unix(pack_name))
204 pack_base_path = os.path.abspath(pack_base_path)
205
206 if os.path.isdir(pack_base_path):
207 return pack_base_path
208
209 return None
210
211
212def get_entry_point_abs_path(pack=None, entry_point=None, use_pack_cache=False):

Callers 2

create_git_worktreeMethod · 0.90
setup_pack_virtualenvFunction · 0.90

Calls 2

quote_unixFunction · 0.90
get_packs_base_pathsFunction · 0.85

Tested by

no test coverage detected