def test_cache_fn_url(self): url = "http://repo.continuum.io/pkgs/pro/osx-64/" # implicit repodata.json self.assertEqual(cache_fn_url(url), '7618c8b6.json') # explicit repodata.json self.assertEqual(cache_fn_url(url, 'repodata.json'), '7618c8b6.json') # explicit current_repodata.json self.assertEqual(cache_fn_url(url, "current_repodata.json"), '8be5dc16.json') url = "http://repo.anaconda.com/pkgs/pro/osx-64/" self.assertEqual(cache_fn_url(url), 'e42afea8.json')
def get_index(channel_urls=(), prepend=True, platform=None, use_local=False, use_cache=False, unknown=None, prefix=None, repodata_fn="repodata.json"): real_urls = calculate_channel_urls(channel_urls, prepend, platform, use_local) check_whitelist(real_urls) dlist = api.DownloadTargetList() sddata = [] index = [] for idx, url in enumerate(real_urls): channel = Channel(url) full_url = channel.url(with_credentials=True) + '/' + repodata_fn full_path_cache = os.path.join( create_cache_dir(), cache_fn_url(full_url, repodata_fn)) sd = api.SubdirData(channel.name + '/' + channel.subdir, full_url, full_path_cache) sd.load() index.append((sd, channel)) dlist.add(sd) is_downloaded = dlist.download(True) if not is_downloaded: raise RuntimeError("Error downloading repodata.") return index
def get_index( channel_urls=(), prepend=True, platform=None, use_local=False, use_cache=False, unknown=None, prefix=None, repodata_fn="repodata.json", ): """Get an index? Function from @wolfv here: https://gist.github.com/wolfv/cd12bd4a448c77ff02368e97ffdf495a. """ real_urls = calculate_channel_urls(channel_urls, prepend, platform, use_local) check_whitelist(real_urls) dlist = api.DownloadTargetList() index = [] for idx, url in enumerate(real_urls): channel = Channel(url) full_url = channel.url(with_credentials=True) + "/" + repodata_fn full_path_cache = os.path.join( create_cache_dir(), cache_fn_url(full_url, repodata_fn), ) sd = api.SubdirData( channel.name + "/" + channel.subdir, full_url, full_path_cache, ) sd.load() index.append((sd, channel)) dlist.add(sd) is_downloaded = dlist.download(True) if not is_downloaded: raise RuntimeError("Error downloading repodata.") return index
def test_cache_fn_url_repo_anaconda_com(self): hash1 = cache_fn_url("http://repo.anaconda.com/pkgs/free/osx-64/") hash2 = cache_fn_url("http://repo.anaconda.com/pkgs/free/osx-64") assert "1e817819.json" == hash1 == hash2 hash3 = cache_fn_url("https://repo.anaconda.com/pkgs/free/osx-64/") hash4 = cache_fn_url("https://repo.anaconda.com/pkgs/free/osx-64") assert "3ce78580.json" == hash3 == hash4 != hash1 hash5 = cache_fn_url("https://repo.anaconda.com/pkgs/free/linux-64/") assert hash4 != hash5 hash6 = cache_fn_url("https://repo.anaconda.com/pkgs/r/osx-64") assert hash4 != hash6
def test_cache_fn_url_repo_continuum_io(self): hash1 = cache_fn_url("http://repo.continuum.io/pkgs/free/osx-64/") hash2 = cache_fn_url("http://repo.continuum.io/pkgs/free/osx-64") assert "aa99d924.json" == hash1 == hash2 hash3 = cache_fn_url("https://repo.continuum.io/pkgs/free/osx-64/") hash4 = cache_fn_url("https://repo.continuum.io/pkgs/free/osx-64") assert "d85a531e.json" == hash3 == hash4 != hash1 hash5 = cache_fn_url("https://repo.continuum.io/pkgs/free/linux-64/") assert hash4 != hash5 hash6 = cache_fn_url("https://repo.continuum.io/pkgs/r/osx-64") assert hash4 != hash6
def test_cache_fn_url_repo_anaconda_com(self): hash1 = cache_fn_url("http://repo.anaconda.com/pkgs/free/osx-64/") hash2 = cache_fn_url("http://repo.anaconda.com/pkgs/free/osx-64") assert "1e817819.json" == hash1 == hash2 hash3 = cache_fn_url("https://repo.anaconda.com/pkgs/free/osx-64/") hash4 = cache_fn_url("https://repo.anaconda.com/pkgs/free/osx-64") assert "3ce78580.json" == hash3 == hash4 != hash1 hash5 = cache_fn_url("https://repo.anaconda.com/pkgs/free/linux-64/") assert hash4 != hash5 hash6 = cache_fn_url("https://repo.anaconda.com/pkgs/r/osx-64") assert hash4 != hash6
def test_cache_fn_url_repo_continuum_io(self): hash1 = cache_fn_url("http://repo.continuum.io/pkgs/free/osx-64/") hash2 = cache_fn_url("http://repo.continuum.io/pkgs/free/osx-64") assert "aa99d924.json" == hash1 == hash2 hash3 = cache_fn_url("https://repo.continuum.io/pkgs/free/osx-64/") hash4 = cache_fn_url("https://repo.continuum.io/pkgs/free/osx-64") assert "d85a531e.json" == hash3 == hash4 != hash1 hash5 = cache_fn_url("https://repo.continuum.io/pkgs/free/linux-64/") assert hash4 != hash5 hash6 = cache_fn_url("https://repo.continuum.io/pkgs/r/osx-64") assert hash4 != hash6
def test_cache_fn_url_repo_anaconda_com(self): hash1 = cache_fn_url("http://repo.anaconda.com/pkgs/free/osx-64/") hash2 = cache_fn_url("http://repo.anaconda.com/pkgs/free/osx-64") assert "e52e9094.json" == hash1 == hash2 hash3 = cache_fn_url("https://repo.anaconda.com/pkgs/free/osx-64/") hash4 = cache_fn_url("https://repo.anaconda.com/pkgs/free/osx-64") assert "f58e011b.json" == hash3 == hash4 != hash1 hash5 = cache_fn_url("https://repo.anaconda.com/pkgs/free/linux-64/") assert hash4 != hash5 hash6 = cache_fn_url("https://repo.anaconda.com/pkgs/r/osx-64") assert hash4 != hash6
def test_cache_fn_url(self): url = "http://repo.continuum.io/pkgs/pro/osx-64/" self.assertEqual(cache_fn_url(url), '7618c8b6.json') url = "http://repo.anaconda.com/pkgs/pro/osx-64/" self.assertEqual(cache_fn_url(url), 'e42afea8.json')
def test_cache_fn_url(self): url = "http://repo.continuum.io/pkgs/pro/osx-64/" self.assertEqual(cache_fn_url(url), '7618c8b6.json') url = "http://repo.anaconda.com/pkgs/pro/osx-64/" self.assertEqual(cache_fn_url(url), 'e42afea8.json')