def _install(artifacts, exclusions=[], options={}): dryrun = options.get("dry-run", False) _exclusions = options.get('exclude', []) if _exclusions: _exclusions = map(lambda x: Artifact(*(x.split(":"))), _exclusions) exclusions.extend(_exclusions) download_list = _resolve_artifacts(artifacts, exclusions) if not dryrun: ## download to cache first for artifact in download_list: if artifact.repos != cache_manager.as_repos(): artifact.repos.download_jar(artifact, cache_manager.get_jar_path(artifact)) pool.join() for artifact in download_list: cache_manager.get_artifact_jar(artifact, get_lib_path()) index_manager.commit() logger.info("[Finished] dependencies resolved") else: logger.info("[Install] Artifacts to install:") for artifact in download_list: print artifact
def _install(artifacts, exclusions=[], options={}): dryrun = options.get("dry-run", False) verify = not options.get("insecure", True) _exclusions = options.get('exclude', []) copy_pom = options.get('copy-pom', False) if _exclusions: _exclusions = map(lambda x: Artifact(*(x.split(":"))), _exclusions) exclusions.extend(_exclusions) download_list = _resolve_artifacts(artifacts, exclusions, verify) if not dryrun: ## download to cache first for artifact in download_list: if artifact.repos != cache_manager.as_repos(): artifact.repos.download_jar( artifact, cache_manager.get_jar_path(artifact), verify) pool.join() for artifact in download_list: cache_manager.get_artifact_jar(artifact, get_lib_path()) if copy_pom: cache_manager.get_artifact_pom(artifact, get_lib_path()) index_manager.commit() logger.info("[Finished] dependencies resolved") else: logger.info("[Install] Artifacts to install:") for artifact in download_list: logger.info(artifact)
def _find_pom(artifact): """ find pom and repos contains pom """ ## lookup cache first if cache_manager.is_artifact_in_cache(artifact): pom = cache_manager.get_artifact_pom(artifact) return (pom, cache_manager.as_repos()) else: for repos in repos_manager.repos: pom = repos.download_pom(artifact) ## find the artifact if pom is not None: cache_manager.put_artifact_pom(artifact, pom) return (pom, repos) return None
def _find_pom(artifact, verify=True): """ find pom and repos contains pom """ ## lookup cache first if cache_manager.is_artifact_in_cache(artifact): pom = cache_manager.get_artifact_pom(artifact) return (pom, cache_manager.as_repos()) else: for repos in repos_manager.repos: pom = repos.download_pom(artifact, verify) ## find the artifact if pom is not None: cache_manager.put_artifact_pom(artifact, pom) return (pom, repos) return None
def require(artifact_id): _prepare() artifact = Artifact.from_id(artifact_id) artifact_set = _resolve_artifacts([artifact]) ## download to cache first for artifact in artifact_set: if artifact.repos != cache_manager.as_repos(): artifact.repos.download_jar(artifact, cache_manager.get_jar_path(artifact)) pool.join() ## append jars to path for artifact in artifact_set: sys.path.append(cache_manager.get_jar_path(artifact, filepath=True))