def match_peer_job(target_matchspec, other_m, this_m=None): """target_matchspec comes from the recipe. target_variant is the variant from the recipe whose deps we are matching. m is the peer job, which must satisfy conda and also have matching keys for any keys that are shared between target_variant and m.config.variant""" match_dict = { 'name': other_m.name(), 'version': other_m.version(), 'build': _fix_any(other_m.build_id(), other_m.config), } if conda_interface.conda_43: match_dict = conda_interface.Dist( name=match_dict['name'], dist_name='-'.join((match_dict['name'], match_dict['version'], match_dict['build'])), version=match_dict['version'], build_string=match_dict['build'], build_number=int(other_m.build_number() or 0), channel=None) matchspec_matches = target_matchspec.match(match_dict) variant_matches = True if this_m: other_m_used_vars = other_m.get_used_loop_vars() for v in this_m.get_used_loop_vars(): if v in other_m_used_vars: variant_matches &= this_m.config.variant[ v] == other_m.config.variant[v] return matchspec_matches and variant_matches
def testing_conda_resolve(request): pkgs = ('a', 'b', 'c', 'd') if conda_interface.conda_43: index = {conda_interface.Dist(dist_name='-'.join((pkg, '920', 'h68c14d1_0')), channel=None, name=pkg, version='920', build_string='h68c14d1_0', build_number=0): conda_interface.IndexRecord(arch='x86_64', build='h68c14d1_0', build_number=0, depends=None, license='GNU Lesser General Public License (LGPL)', md5='7268f7dcc075e615af758d1243ed4f1d', name=pkg, platform=conda_interface.cc_platform, requires=(), size=192170, subdir=conda_interface.subdir, version='920', fn=pkg + '-920-h68c14d1_0.tar.bz2', schannel='r', channel='https://conda.anaconda.org/r/' + conda_interface.subdir, priority=1, url=('https://conda.anaconda.org/r/{}/pkg-920-h68c14d1_0.tar.bz2' .format(conda_interface.subdir, pkg))) for pkg in pkgs} else: index = {pkg: { "build": "h68c14d1_0", "build_number": 0, "date": "2015-10-28", "depends": [], "license": "LGPL", "md5": "7268f7dcc075e615af758d1243ed4f1d", "name": pkg, "requires": [], "size": 303694, "version": "920" } for pkg in pkgs} return Resolve(index)
def match_peer_job(target_matchspec, m): match_dict = {'name': m.name(), 'version': m.version(), 'build': _fix_any(m.build_id(), m.config), } if conda_interface.conda_43: match_dict = conda_interface.Dist(name=match_dict['name'], dist_name='-'.join((match_dict['name'], match_dict['version'], match_dict['build'])), version=match_dict['version'], build_string=match_dict['build'], build_number=int(m.build_number() or 0), channel=None) return target_matchspec.match(match_dict)