def test_combining_of_source_same_level_identical_packages(self): # a is in both ab and cd, and they produce the same level. a, b, c, d = [self.pkgs[name] for name in 'abcd'] src_indices = {'ab': self.pkg_index([a, b], source='ab'), 'cd': self.pkg_index([a, c, d], source='cd')} with self.assertRaises(ValueError): resolve_index(src_indices, env_sources=[['ab', 'cd']])
def test_combining_of_source_different_level(self): # a should be removed from the cd source, as they live at # a different sources level. a, b, c, d = [self.pkgs[name] for name in 'abcd'] src_indices = {'ab': self.pkg_index([a, b]), 'cd': self.pkg_index([a, c, d])} result = resolve_index(src_indices, env_sources=[['ab'], ['cd']]) ab_index = self.pkg_index([a, b], source='ab') cd_index = self.pkg_index([c, d], source='cd') expected_index = cd_index expected_index.update(ab_index) self.assertEqual(result, expected_index)
def test_combining_of_source_same_level(self): # a should be in both ab and cd source, as they live at # the same sources level. a, b, c, d = [self.pkgs[name] for name in 'abcd'] src_indices = {'ab': self.pkg_index([a, b], source='ab'), 'cd': self.pkg_index([c, d], source='cd')} self.pkg_index([a], version='0.2', index=src_indices['cd']) result = resolve_index(src_indices, env_sources=[['ab', 'cd']]) ab_index = self.pkg_index([a, b], source='ab') cd_index = self.pkg_index([c, d], source='cd') expected_index = cd_index expected_index.update(ab_index) self.pkg_index([a], version='0.2', source='cd', index=expected_index) self.assertEqual(result.keys(), expected_index.keys()) self.assertEqual(result, expected_index)
"The output file for the environment manifest. " "Uses python string formatting, with env being " "passed as a named argument." ), ) if 1 or conda_manifest.config.DEBUG: args = parser.parse_args(["--envs", "../env.specs/lts.yaml", "--sources", "../sources.yaml"]) else: args = parser.parse_args() sources = load_sources(args.sources) envs = load_envs(args.envs) for env in envs: src_index = compute_source_indices(env["sources"]) index = resolve_index(src_index, env["sources"]) r = conda.resolve.Resolve(index) full_list_of_packages = sorted(r.solve(env["packages"])) lines = [] for pkg_name in full_list_of_packages: pkg = index[pkg_name] lines.append(("{pkg[name]: <20} {pkg[version]: <12} " "{pkg[build]: <12} {pkg[source]}".format(pkg=pkg))) with open(args.outfile.format(env=env), "w") as fh: fh.write("\n".join(lines)) repodata_dir = "indices/index_for_{env[name]}/{plat}".format(env=env, plat=conda.config.subdir) if not os.path.exists(repodata_dir): os.makedirs(repodata_dir)
help="Glob pattern of environment yamls.") parser.add_argument("--outfile", default='env_{env[name]}.manifest', help=("The output file for the environment manifest. " "Uses python string formatting, with env being " "passed as a named argument.")) if 1 or conda_manifest.config.DEBUG: args = parser.parse_args(['--envs', '../env.specs/lts.yaml', '--sources', '../sources.yaml']) else: args = parser.parse_args() sources = load_sources(args.sources) envs = load_envs(args.envs) for env in envs: src_index = compute_source_indices(env['sources']) index = resolve_index(src_index, env['sources']) r = conda.resolve.Resolve(index) full_list_of_packages = sorted(r.solve(env['packages'])) lines = [] for pkg_name in full_list_of_packages: pkg = index[pkg_name] lines.append(('{pkg[name]: <20} {pkg[version]: <12} ' '{pkg[build]: <12} {pkg[source]}'.format(pkg=pkg))) with open(args.outfile.format(env=env), 'w') as fh: fh.write('\n'.join(lines)) repodata_dir = 'indices/index_for_{env[name]}/{plat}'.format(env=env, plat=conda.config.subdir)