@@ -0,0 +1,2502 @@
+import os%0Aimport requests%0Afrom conda.version import VersionOrder%0Afrom . import utils%0Afrom . import linting%0A%0A%0Adef compare_recipe_to_pypi(recipe, env):%0A    %22%22%22%0A    If it looks like a PyPI package, returns a tuple of%0A    (name, current_bioconda_version, latest_version_on_PyPI, needs_update).%0A%0A    If it doesn't look like a PyPI package, then return None.%0A%0A    If it looks like a PyPI package but the PyPI info can't be found (e.g.,%0A    %22python-wget%22) then a tuple is returned but with a value of None for the%0A    latest version on PyPI and None for needs_update.%0A    %22%22%22%0A    meta = utils.load_meta(os.path.join(recipe, 'meta.yaml'), env)%0A    current = meta%5B'package'%5D%5B'version'%5D%0A    name = meta%5B'package'%5D%5B'name'%5D%0A    try:%0A        source_url = meta%5B'source'%5D%5B'url'%5D%0A    except KeyError:%0A        return%0A%0A    if 'pypi' in source_url:%0A        pypi = requests.get('http://pypi.python.org/pypi/' + name + '/json')%0A        if pypi.status_code == 200:%0A            contents = pypi.json()%0A            latest = contents%5B'info'%5D%5B'version'%5D%0A            needs_update = False%0A            if VersionOrder(latest) %3E VersionOrder(current):%0A                needs_update = True%0A            return (name, current, latest, needs_update)%0A        else:%0A            return (name, current, None, None)%0A%0A%0Adef check_all(recipe_folder, config, packages='*'):%0A    df = linting.channel_dataframe(channels=%5B'conda-forge'%5D)%0A    df%5B'looseversion'%5D = df%5B'version'%5D.apply(VersionOrder)%0A    latest_conda_forge = df.groupby('name')%5B'looseversion'%5D.agg(max)%0A%0A    recipes = list(utils.get_latest_recipes(recipe_folder, config, packages))%0A    config = utils.load_config(config)%0A    env = list(utils.EnvMatrix(config%5B'env_matrix'%5D))%5B0%5D%0A    df = %5B%5D%0A    for recipe in recipes:%0A        result = compare_recipe_to_pypi(recipe, env)%0A        if not result:%0A            continue%0A%0A        result = list(result)%0A        try:%0A            conda_forge_version = latest_conda_forge%5Bresult%5B0%5D%5D%0A            in_conda_forge = True%0A        except KeyError:%0A            conda_forge_version = None%0A            in_conda_forge = False%0A%0A        if not result%5B3%5D:%0A            action = 'up-to-date'%0A%0A        else:%0A            if in_conda_forge:%0A                if str(conda_forge_version) == result%5B2%5D:%0A                    action = 'remove-from-bioconda'%0A                else:%0A                    action = 'decide-where-to-update'%0A            else:%0A                action = 'update-bioconda'%0A%0A        if result:%0A            yield result + %5Bconda_forge_version, action%5D%0A%0A

add check_for_pypi_updates.py