Ejemplo n.º 1
0
    def _download_package(self, class_id, package_version):
        zip_fpath = os.path.join(get_tmp_dir(), get_random_name())

        try:
            CLIENT.repo_uri = self.uri
            CLIENT.download(zip_fpath, class_id, package_version)
            
            repo_dirpath = self._get_repo_dir()
            package_id = self._get_package_id(class_id, package_version)
            package_home = '.'.join(package_id.split('.')[:-1])

            add_package(zip_fpath, package_home, repo_dirpath)

        finally:
            if os.path.exists(zip_fpath):
                os.remove(zip_fpath)
Ejemplo n.º 2
0
 def _get_package_id(self, gen_id, version):
     CLIENT.repo_uri = self.uri
     gen_id = gen_id + '-' + version if version is not None else gen_id
     generator = CLIENT.generator(gen_id)
     package_id = generator['package_id']
     package_id = package_id.rsplit('-', 1)[0] # remove version part
     return package_id