예제 #1
0
 def test_subdir_data_context_offline(self):
     with env_var('CONDA_OFFLINE',
                  'yes',
                  stack_callback=conda_tests_ctxt_mgmt_def_pol):
         local_channel = Channel(
             join(dirname(__file__), "..", "data", "conda_format_repo",
                  context.subdir))
         sd = SubdirData(channel=local_channel)
         assert len(sd.query_all('zlib', channels=[local_channel])) > 0
         assert len(sd.query_all('zlib')) == 0
     assert len(sd.query_all('zlib')) > 1
예제 #2
0
def execute(args, parser):
    spec = MatchSpec(args.match_spec)
    if spec.get_exact_value('subdir'):
        subdirs = spec.get_exact_value('subdir'),
    elif args.platform:
        subdirs = args.platform,
    else:
        subdirs = context.subdirs

    with Spinner("Loading channels", not context.verbosity
                 and not context.quiet, context.json):
        spec_channel = spec.get_exact_value('channel')
        channel_urls = (spec_channel, ) if spec_channel else context.channels

        matches = sorted(SubdirData.query_all(spec, channel_urls, subdirs),
                         key=lambda rec:
                         (rec.name, VersionOrder(rec.version), rec.build))

    if not matches:
        channels_urls = tuple(
            calculate_channel_urls(
                channel_urls=context.channels,
                prepend=not args.override_channels,
                platform=subdirs[0],
                use_local=args.use_local,
            ))
        from ..exceptions import PackagesNotFoundError
        raise PackagesNotFoundError((text_type(spec), ), channels_urls)
    else:
        return matches