def remove(artifact_id): """ Remove an artifact from library path """ logger.info('[Checking] %s in library index' % artifact_id) artifact = Artifact.from_id(artifact_id) artifact_path = os.path.join(get_lib_path(), artifact.to_jip_name()) if index_manager.is_installed(artifact) and os.path.exists(artifact_path): os.remove(artifact_path) index_manager.remove_artifact(artifact) index_manager.commit() logger.info('[Finished] %s removed from library path' % artifact_id) else: logger.error('[Error] %s not installed' % artifact_id) sys.exit(1)
def _resolve_artifacts(artifacts, exclusions=[]): ## download queue download_list = [] ## dependency_set contains artifact objects to resolve dependency_set = set() for a in artifacts: dependency_set.add(a) while len(dependency_set) > 0: artifact = dependency_set.pop() ## to prevent multiple version installed ## TODO we need a better strategy to resolve this if index_manager.is_same_installed(artifact)\ and artifact not in download_list: continue pominfo = _find_pom(artifact) if pominfo is None: logger.error("[Error] Artifact not found: %s", artifact) sys.exit(1) if not index_manager.is_installed(artifact): pom, repos = pominfo # repos.download_jar(artifact, get_lib_path()) artifact.repos = repos # skip excluded artifact if not any(map(artifact.is_same_artifact, exclusions)): download_list.append(artifact) index_manager.add_artifact(artifact) pom_obj = Pom(pom) for r in pom_obj.get_repositories(): repos_manager.add_repos(*r) more_dependencies = pom_obj.get_dependencies() for d in more_dependencies: d.exclusions.extend(artifact.exclusions) if not index_manager.is_same_installed(d): dependency_set.add(d) return download_list
def _resolve_artifacts(artifacts, exclusions=[], verify=True): ## download queue download_list = [] ## dependency_set contains artifact objects to resolve dependency_set = set() for a in artifacts: dependency_set.add(a) while len(dependency_set) > 0: artifact = dependency_set.pop() ## to prevent multiple version installed ## TODO we need a better strategy to resolve this if index_manager.is_same_installed(artifact)\ and artifact not in download_list: continue pominfo = _find_pom(artifact, verify) if pominfo is None: logger.error("[Error] Artifact not found: %s", artifact) sys.exit(1) if not index_manager.is_installed(artifact): pom, repos = pominfo # repos.download_jar(artifact, get_lib_path()) artifact.repos = repos # skip excluded artifact if not any(map(artifact.is_same_artifact, exclusions)): download_list.append(artifact) index_manager.add_artifact(artifact) pom_obj = Pom(pom) for r in pom_obj.get_repositories(): repos_manager.add_repos(*r) more_dependencies = pom_obj.get_dependencies(verify) for d in more_dependencies: d.exclusions.extend(artifact.exclusions) if not index_manager.is_same_installed(d): dependency_set.add(d) return download_list