def list_direct_traces(self, item_file_path): """ For item, return direct traces to and from (i.e. indirect traces are not shown) """ repo_dir = get_repo_dir() traces = None # If not absolute path, add repo dir if item_file_path.startswith(os.sep) == False: item_file_path = os.path.join(repo_dir, item_file_path) # If package, add attributes.pkg if os.path.isdir(item_file_path): item_file_path = os.path.join(item_file_path, 'attributes.pkg') # Check item exists in tree if self.is_item(item_file_path) == False: report_error(1, 'The item "%s" was not found in the repository' % item_file_path) # Loop over dependencies and compile list of dependencies to and from item # List direct traces to the item traces = { 'to': [], 'from': [] } for item in self.get_dependencies(): if item[0]._file_path == item_file_path: traces['to'].append(item[1]) elif item[1]._file_path == item_file_path: traces['from'].append(item[0]) return traces
def __init__(self): project = ProjectConfig() project.load_config_from_file(os.path.join(get_repo_dir(), 'project.conf')) self._children = [] self._file_name = 'root' self._pretty_name = project.name self._short_name = project.short_name self._file_path = None self._dependencies_from_to = None self._node_list = None