Example #1
0
def python_skipped_recipe(config_yaml, request):
    os.makedirs(os.path.join(config_yaml, "recipe"))
    with open(os.path.join(config_yaml, "recipe", "meta.yaml"), "w") as fh:
        fh.write(
            """
package:
    name: py-test
    version: 1.0.0
build:
    skip: True   # [py36]
requirements:
    build:
        - python
    run:
        - python
about:
    home: home
    """
        )
    return RecipeConfigPair(
        str(config_yaml),
        _load_forge_config(
            config_yaml, exclusive_config_file=os.path.join(config_yaml, "config.yaml")
        ),
    )
Example #2
0
def cuda_enabled_recipe(config_yaml, request):
    with open(os.path.join(config_yaml, "recipe", "meta.yaml"), "w") as fh:
        fh.write("""
package:
    name: py-test
    version: 1.0.0
build:
    skip: True   # [os.environ.get("CF_CUDA_ENABLED") != "True"]
requirements:
    build:
        - {{ compiler('c') }}
        - {{ compiler('cuda') }}
    host:
        - python
    run:
        - python
about:
    home: home
    """)
    return RecipeConfigPair(
        str(config_yaml),
        _load_forge_config(
            config_yaml,
            exclusive_config_file=os.path.join(config_yaml, "recipe",
                                               "default_config.yaml"),
        ),
    )
Example #3
0
def python_skipped_recipe(config_yaml, request):
    with open(os.path.join(config_yaml, "recipe", "meta.yaml"), "w") as fh:
        fh.write(
            """
package:
    name: py-test
    version: 1.0.0
build:
    skip: True   # [py36]
requirements:
    build:
        - python
    run:
        - python
about:
    home: home
    """
        )
    return RecipeConfigPair(
        str(config_yaml),
        _load_forge_config(
            config_yaml, exclusive_config_file=os.path.join(
                config_yaml, "recipe", "default_config.yaml")
        ),
    )
Example #4
0
def recipe_migration_cfep9(config_yaml, request):
    # write a migrator
    with open(os.path.join(config_yaml, "recipe", "meta.yaml"), "w") as fh:
        fh.write(
            """
package:
    name: py-test
    version: 1.0.0
requirements:
    host:
        - python
        - zlib
    run:
        - python
about:
    home: home
    """
        )

    with open(os.path.join(config_yaml, "migrations", "zlib.yaml"), "w") as fh:
        fh.write("""
zlib:
    - 1000
""")

    return RecipeConfigPair(
        str(config_yaml),
        _load_forge_config(
            config_yaml, exclusive_config_file=os.path.join(
                config_yaml, "recipe", "default_config.yaml")
        ),
    )
Example #5
0
def recipe_migration_cfep9_downgrade(config_yaml, recipe_migration_cfep9):
    # write a downgrade migrator that lives next to the current migrator.
    # Only this, more recent migrator should apply.
    os.makedirs(
        os.path.join(config_yaml, ".ci_support", "migrations"), exist_ok=True
    )
    with open(
        os.path.join(
            config_yaml, ".ci_support", "migrations", "zlib-downgrade.yaml"
        ),
        "w",
    ) as fh:
        fh.write(
            """
migration_ts: 1.0
zlib:
    - 999
"""
        )
    # return recipe_migration_cfep9
    return RecipeConfigPair(
        str(config_yaml),
        _load_forge_config(
            config_yaml,
            exclusive_config_file=os.path.join(
                config_yaml, "recipe", "default_config.yaml"
            ),
        ),
    )
Example #6
0
def py_recipe(config_yaml, request):
    with open(os.path.join(config_yaml, "recipe", "meta.yaml"), "w") as fh:
        fh.write(
            """
package:
    name: py-test
    version: 1.0.0
requirements:
    build:                      # [win]
        - {{ compiler('c') }}   # [win]
    host:
        - python
    run:
        - python
about:
    home: home
    """
        )
    return RecipeConfigPair(
        str(config_yaml),
        _load_forge_config(
            config_yaml, exclusive_config_file=os.path.join(
                config_yaml, "recipe", "default_config.yaml")
        ),
    )
Example #7
0
def py_recipe(config_yaml, request):
    os.makedirs(os.path.join(config_yaml, "recipe"))
    with open(os.path.join(config_yaml, "recipe", "meta.yaml"), "w") as fh:
        fh.write(
            """
package:
    name: py-test
    version: 1.0.0
requirements:
    build:                      # [win]
        - {{ compiler('c') }}   # [win]
    host:
        - python
    run:
        - python
about:
    home: home
    """
        )
    return RecipeConfigPair(
        str(config_yaml),
        _load_forge_config(
            config_yaml, exclusive_config_file=os.path.join(config_yaml, "config.yaml")
        ),
    )
Example #8
0
def r_recipe(config_yaml, request):
    with open(os.path.join(config_yaml, "recipe", "meta.yaml"), "w") as fh:
        fh.write(
            """
package:
    name: r-test
    version: 1.0.0
build:
    skip: True  # [win]
requirements:
    build:
        - r-base
    run:
        - r-base
    """
        )
    return RecipeConfigPair(
        str(config_yaml),
        _load_forge_config(
            config_yaml,
            exclusive_config_file=os.path.join(
                config_yaml, "recipe", "default_config.yaml"
            ),
        ),
    )
Example #9
0
def render_skipped_recipe(config_yaml, request):
    with open(os.path.join(config_yaml, "recipe", "meta.yaml"), "w") as fh:
        fh.write("""
package:
    name: python-noarch-test
    version: 1.0.0
build:
    noarch: python
requirements:
    build:
        - python
    run:
        - python
    """)
    with open(os.path.join(config_yaml, "conda-forge.yml"), "a+") as fh:
        fh.write("""
skip_render:
    - .gitignore
    - .gitattributes
    - README.md
    - LICENSE.txt
    """)
    return RecipeConfigPair(
        str(config_yaml),
        _load_forge_config(
            config_yaml,
            exclusive_config_file=os.path.join(config_yaml, "recipe",
                                               "default_config.yaml"),
        ),
    )
Example #10
0
def recipe_migration_win_compiled(config_yaml, py_recipe):
    with open(os.path.join(config_yaml, "migrations", "vc-migrate.yaml"), "w") as fh:
        fh.write(dedent("""
        migration_ts: 1.0
        c_compiler:    # [win]
            - vs2008   # [win]
            - vs2017   # [win]
        cxx_compiler:  # [win]
            - vs2008   # [win]
            - vs2017   # [win]
        vc:            # [win]
            - '9'      # [win]
            - '14.1'   # [win]
        zip_keys:
            - - python          # [win]
              - c_compiler      # [win]
              - cxx_compiler    # [win]
              - vc              # [win]
        """))
    return RecipeConfigPair(
        str(config_yaml),
        _load_forge_config(
            config_yaml, exclusive_config_file=os.path.join(
                config_yaml, "recipe", "default_config.yaml")
        ),
    )
Example #11
0
def choco_recipe(config_yaml, request):
    with open(os.path.join(config_yaml, "recipe", "meta.yaml"), "w") as fh:
        fh.write("""
package:
    name: py-test
    version: 1.0.0
build:
    skip: true  # [not win]
requirements:
    build:
        - {{ compiler('c') }}
    host:
        - python
    run:
        - python
about:
    home: home
    """)
    with open(os.path.join(config_yaml, "conda-forge.yml"), "a+") as fh:
        fh.write("""
choco:
    - pkg0
    - pkg1 --version=X.Y.Z
    """)
    return RecipeConfigPair(
        str(config_yaml),
        _load_forge_config(
            config_yaml,
            exclusive_config_file=os.path.join(config_yaml, "recipe",
                                               "default_config.yaml"),
        ),
    )
Example #12
0
def noarch_recipe(config_yaml, request):
    with open(os.path.join(config_yaml, "recipe", "meta.yaml"), "w") as fh:
        fh.write(
            """
package:
    name: python-noarch-test
    version: 1.0.0
build:
    noarch: python
requirements:
    build:
        - python
    run:
        - python
    """
        )
    return RecipeConfigPair(
        str(config_yaml),
        _load_forge_config(
            config_yaml,
            exclusive_config_file=os.path.join(
                config_yaml, "recipe", "default_config.yaml"
            ),
        ),
    )
def test_noarch_platforms_bad_yaml(config_yaml):
    load_forge_config = lambda: cnfgr_fdstk._load_forge_config(  # noqa
        config_yaml,
        exclusive_config_file=os.path.join(config_yaml, "recipe",
                                           "default_config.yaml"),
    )

    with open(os.path.join(config_yaml, "conda-forge.yml"), "a+") as fp:
        fp.write("noarch_platforms: [eniac, zx80]")

    with pytest.raises(ValueError) as excinfo:
        load_forge_config()

    assert "eniac" in str(excinfo.value)
def test_conda_forge_yaml_empty(config_yaml):
    load_forge_config = lambda: cnfgr_fdstk._load_forge_config(  # noqa
        config_yaml,
        exclusive_config_file=os.path.join(config_yaml, "recipe",
                                           "default_config.yaml"),
    )

    assert ["conda-forge",
            "main"] in load_forge_config()["channels"]["targets"]

    os.unlink(os.path.join(config_yaml, "conda-forge.yml"))
    with pytest.raises(RuntimeError):
        load_forge_config()

    with open(os.path.join(config_yaml, "conda-forge.yml"), "w"):
        pass
    assert ["conda-forge",
            "main"] in load_forge_config()["channels"]["targets"]
Example #15
0
def noarch_recipe(config_yaml, request):
    os.makedirs(os.path.join(config_yaml, 'recipe'))
    with open(os.path.join(config_yaml, 'recipe', 'meta.yaml'), 'w') as fh:
        fh.write("""
package:
    name: python-noarch-test
    version: 1.0.0
build:
    noarch: python
requirements:
    build:
        - python
    run:
        - python
    """)
    return RecipeConfigPair(
        str(config_yaml),
        _load_forge_config(config_yaml,
                           exclusive_config_file=os.path.join(
                               config_yaml, 'config.yaml')))
Example #16
0
def linux_skipped_recipe(config_yaml, request):
    os.makedirs(os.path.join(config_yaml, 'recipe'))
    with open(os.path.join(config_yaml, 'recipe', 'meta.yaml'), 'w') as fh:
        fh.write("""
package:
    name: py-test
    version: 1.0.0
build:
    skip: True   # [linux]
requirements:
    build:
        - zlib
about:
    home: home
    """)
    return RecipeConfigPair(
        str(config_yaml),
        _load_forge_config(config_yaml,
                           exclusive_config_file=os.path.join(
                               config_yaml, 'config.yaml')))
Example #17
0
def r_recipe(config_yaml, request):
    os.makedirs(os.path.join(config_yaml, 'recipe'))
    with open(os.path.join(config_yaml, 'recipe', 'meta.yaml'), 'w') as fh:
        fh.write("""
package:
    name: r-test
    version: 1.0.0
build:
    skip: True  # [win]
requirements:
    build:
        - r-base
    run:
        - r-base
    """)
    return RecipeConfigPair(
        str(config_yaml),
        _load_forge_config(config_yaml,
                           exclusive_config_file=os.path.join(
                               config_yaml, 'config.yaml')))
def test_forge_yml_alt_path(config_yaml):
    load_forge_config = (
        lambda forge_yml: cnfgr_fdstk._load_forge_config(  # noqa
            config_yaml,
            exclusive_config_file=os.path.join(config_yaml, "recipe",
                                               "default_config.yaml"),
            forge_yml=forge_yml,
        ))

    forge_yml = os.path.join(config_yaml, "conda-forge.yml")
    forge_yml_alt = os.path.join(config_yaml, ".config",
                                 "feedstock-config.yml")

    os.mkdir(os.path.dirname(forge_yml_alt))
    os.rename(forge_yml, forge_yml_alt)

    with pytest.raises(RuntimeError):
        load_forge_config(None)

    assert ["conda-forge",
            "main"] in load_forge_config(forge_yml_alt)["channels"]["targets"]
Example #19
0
def py_recipe(config_yaml, request):
    os.makedirs(os.path.join(config_yaml, 'recipe'))
    with open(os.path.join(config_yaml, 'recipe', 'meta.yaml'), 'w') as fh:
        fh.write("""
package:
    name: py-test
    version: 1.0.0
requirements:
    build:                      # [win]
        - {{ compiler('c') }}   # [win]
    host:
        - python
    run:
        - python
about:
    home: home
    """)
    return RecipeConfigPair(
        str(config_yaml),
        _load_forge_config(config_yaml,
                           exclusive_config_file=os.path.join(
                               config_yaml, 'config.yaml')))
Example #20
0
def r_recipe(config_yaml, request):
    os.makedirs(os.path.join(config_yaml, "recipe"))
    with open(os.path.join(config_yaml, "recipe", "meta.yaml"), "w") as fh:
        fh.write(
            """
package:
    name: r-test
    version: 1.0.0
build:
    skip: True  # [win]
requirements:
    build:
        - r-base
    run:
        - r-base
    """
        )
    return RecipeConfigPair(
        str(config_yaml),
        _load_forge_config(
            config_yaml, exclusive_config_file=os.path.join(config_yaml, "config.yaml")
        ),
    )
Example #21
0
def noarch_recipe(config_yaml, request):
    os.makedirs(os.path.join(config_yaml, "recipe"))
    with open(os.path.join(config_yaml, "recipe", "meta.yaml"), "w") as fh:
        fh.write(
            """
package:
    name: python-noarch-test
    version: 1.0.0
build:
    noarch: python
requirements:
    build:
        - python
    run:
        - python
    """
        )
    return RecipeConfigPair(
        str(config_yaml),
        _load_forge_config(
            config_yaml, exclusive_config_file=os.path.join(config_yaml, "config.yaml")
        ),
    )