Example #1
0
def canonical_channel_name(channel):
    channel_alias = config.rc.get('channel_alias', config.DEFAULT_CHANNEL_ALIAS)
    if channel.startswith(channel_alias):
        return channel.split(channel_alias, 1)[1].split('/')[0]
    elif any(channel.startswith(i) for i in config.get_default_urls()):
        return 'defaults'
    elif channel.startswith('http://filer/'):
        return 'filer'
    else:
        return channel
Example #2
0
def test_installable(channel='defaults', verbose=True):
    if not verbose:
        sys.stdout = open(os.devnull, 'w')

    success = False
    has_py = re.compile(r'py(\d)(\d)')
    for platform in ['osx-64', 'linux-32', 'linux-64', 'win-32', 'win-64']:
        print("######## Testing platform %s ########" % platform)
        channels = [channel] + get_default_urls()
        index = get_index(channel_urls=channels,
                          prepend=False,
                          platform=platform)
        for package in sorted(index):
            if channel != 'defaults':
                # If we give channels at the command line, only look at
                # packages from those channels (not defaults).
                if index[package]['channel'] not in normalize_urls(
                    [channel], platform=platform):
                    continue
            name, version, build = package.rsplit('.tar.bz2',
                                                  1)[0].rsplit('-', 2)
            if name in {'conda', 'conda-build'}:
                # conda can only be installed in the root environment
                continue
            # Don't fail just because the package is a different version of Python
            # than the default.  We should probably check depends rather than the
            # build string.
            match = has_py.search(build)
            assert match if 'py' in build else True, build
            if match:
                additional_packages = [
                    'python=%s.%s' % (match.group(1), match.group(2))
                ]
            else:
                additional_packages = []

            print('Testing %s=%s' % (name, version))
            # if additional_packages:
            #     print("Including %s" % additional_packages[0])

            try:
                check_install([name + '=' + version] + additional_packages,
                              channel_urls=channels,
                              prepend=False,
                              platform=platform)
            except KeyboardInterrupt:
                raise
            # sys.exit raises an exception that doesn't subclass from Exception
            except BaseException as e:
                success = True
                print("FAIL: %s %s on %s with %s (%s)" %
                      (name, version, platform, additional_packages, e),
                      file=sys.stderr)

    return success
Example #3
0
def canonical_channel_name(channel):
    channel_alias = config.rc.get('channel_alias',
                                  config.DEFAULT_CHANNEL_ALIAS)
    if channel.startswith(channel_alias):
        return channel.split(channel_alias, 1)[1].split('/')[0]
    elif any(channel.startswith(i) for i in config.get_default_urls()):
        return 'defaults'
    elif channel.startswith('http://filer/'):
        return 'filer'
    else:
        return channel
Example #4
0
def test_installable(channel='defaults', verbose=True):
    if not verbose:
        sys.stdout = open(os.devnull, 'w')

    success = False
    has_py = re.compile(r'py(\d)(\d)')
    for platform in ['osx-64', 'linux-32', 'linux-64', 'win-32', 'win-64']:
        print("######## Testing platform %s ########" % platform)
        channels = [channel] + get_default_urls()
        index = get_index(channel_urls=channels, prepend=False, platform=platform)
        for package, rec in iteritems(index):
            # If we give channels at the command line, only look at
            # packages from those channels (not defaults).
            if channel != 'defaults' and rec.get('schannel', 'defaults') == 'defaults':
                continue
            name = rec['name']
            if name in {'conda', 'conda-build'}:
                # conda can only be installed in the root environment
                continue
            # Don't fail just because the package is a different version of Python
            # than the default.  We should probably check depends rather than the
            # build string.
            build = rec['build']
            match = has_py.search(build)
            assert match if 'py' in build else True, build
            if match:
                additional_packages = ['python=%s.%s' % (match.group(1), match.group(2))]
            else:
                additional_packages = []

            version = rec['version']
            print('Testing %s=%s' % (name, version))
            # if additional_packages:
            #     print("Including %s" % additional_packages[0])

            try:
                check_install([name + '=' + version] + additional_packages,
                    channel_urls=channels, prepend=False,
                    platform=platform)
            except KeyboardInterrupt:
                raise
            # sys.exit raises an exception that doesn't subclass from Exception
            except BaseException as e:
                success = True
                print("FAIL: %s %s on %s with %s (%s)" % (name, version,
                    platform, additional_packages, e), file=sys.stderr)

    return success