Ejemplo n.º 1
0
 def _get_dest_module_path(self, curr_module_dir: str,
                           dest_module_source: str,
                           dest_module_version: str) -> str:
     """
     :param curr_module_dir: current source directory
     :param dest_module_source: the value of module.source
     :return: the real path in the local file system of the dest module
     """
     dest_module_path = Path()
     if is_local_path(curr_module_dir, dest_module_source):
         dest_module_path = Path(curr_module_dir) / dest_module_source
     elif (dest_module_source,
           dest_module_version) in self.module.external_modules_source_map:
         return self.module.external_modules_source_map[(
             dest_module_source, dest_module_version)]
     else:
         try:
             if dest_module_source not in self.relative_paths_cache:
                 self.relative_paths_cache[dest_module_source] = list(
                     Path(self.module.source_dir).rglob(dest_module_source))
             dest_module_path = next(
                 (path for path in self.relative_paths_cache.get(
                     dest_module_source)), dest_module_path)
         except NotImplementedError as e:
             if 'Non-relative patterns are unsupported' in str(e):
                 return ""
             raise e
     return os.path.realpath(dest_module_path)
Ejemplo n.º 2
0
 def _get_dest_module_path(self, curr_module_dir, dest_module_source):
     """
     :param curr_module_dir: current source directory
     :param dest_module_source: the value of module.source
     :return: the real path in the local file system of the dest module
     """
     dest_module_path = ''
     if is_local_path(curr_module_dir, dest_module_source):
         dest_module_path = os.path.join(curr_module_dir, dest_module_source)
     else:
         for root, d_names, f_names in os.walk(self.module.source_dir):
             dest_module_path = os.path.join(root, dest_module_source)
             if os.path.exists(dest_module_path):
                 break
     return os.path.realpath(dest_module_path)
Ejemplo n.º 3
0
 def _get_dest_module_path(self, curr_module_dir: str,
                           dest_module_source: str) -> str:
     """
     :param curr_module_dir: current source directory
     :param dest_module_source: the value of module.source
     :return: the real path in the local file system of the dest module
     """
     dest_module_path = Path()
     if is_local_path(curr_module_dir, dest_module_source):
         dest_module_path = Path(curr_module_dir) / dest_module_source
     else:
         dest_module_path = next((path for path in Path(
             self.module.source_dir).rglob(dest_module_source)),
                                 dest_module_path)
     return os.path.realpath(dest_module_path)