Example #1
0
def test_conda_py_no_period(testing_workdir, testing_metadata, monkeypatch):
    monkeypatch.setenv('CONDA_PY', '34')
    testing_metadata.meta['requirements'] = {'host': ['python'],
                                             'run': ['python']}
    api.output_yaml(testing_metadata, 'meta.yaml')
    outputs = api.build(testing_workdir, notest=True)
    assert any('py34' in output for output in outputs)
Example #2
0
def test_inspect_hash_input(testing_metadata, testing_workdir, capfd):
    api.output_yaml(testing_metadata, 'meta.yaml')
    output = api.build(testing_workdir)[0]
    args = ['hash-inputs', output]
    main_inspect.execute(args)
    output, error = capfd.readouterr()
    assert 'requirements' in output
def test_hash_no_apply_to_custom_build_string(testing_metadata, testing_workdir):
    testing_metadata.meta['build']['string'] = 'steve'
    testing_metadata.meta['requirements']['build'] = ['zlib 1.2.8']

    api.output_yaml(testing_metadata, 'meta.yaml')
    metadata = api.render(testing_workdir)[0][0]

    assert metadata.build_id() == 'steve'
Example #4
0
def test_build_output_folder(testing_workdir, test_metadata, capfd):
    api.output_yaml(test_metadata, 'meta.yaml')
    with TemporaryDirectory() as tmp:
        out = os.path.join(tmp, 'out')
        args = [testing_workdir, '--no-build-id',
                '--croot', tmp, '--no-activate', '--no-anaconda-upload',
                '--output-folder', out]
        output = main_build.execute(args)[0]
        assert os.path.isfile(os.path.join(out, test_metadata.config.subdir, os.path.basename(output)))
Example #5
0
def test_render_output_build_path(testing_workdir, testing_metadata, capfd, caplog):
    api.output_yaml(testing_metadata, 'meta.yaml')
    args = ['--output', os.path.join(testing_workdir)]
    main_render.execute(args)
    test_path = os.path.join(sys.prefix, "conda-bld", testing_metadata.config.host_subdir,
                             "test_render_output_build_path-1.0-1.tar.bz2")
    output, error = capfd.readouterr()
    assert output.rstrip() == test_path, error
    assert error == ""
Example #6
0
def test_render_output_build_path(testing_workdir, test_metadata, capfd):
    api.output_yaml(test_metadata, 'meta.yaml')
    args = ['--output', testing_workdir]
    main_render.execute(args)
    test_path = "test_render_output_build_path-1.0-py{}{}_1.tar.bz2".format(
                                      sys.version_info.major, sys.version_info.minor)
    output, error = capfd.readouterr()
    assert error == ""
    assert os.path.basename(output.rstrip()) == test_path, error
def test_render_yaml_output(testing_workdir, testing_config):
    metadata, need_download, need_reparse_in_env = api.render(
        os.path.join(metadata_dir, "source_git_jinja2"),
        config=testing_config)[0]
    yaml_metadata = api.output_yaml(metadata)
    assert "package:" in yaml_metadata

    # writes file with yaml data in it
    api.output_yaml(metadata, os.path.join(testing_workdir, "output.yaml"))
    assert "package:" in open(os.path.join(testing_workdir, "output.yaml")).read()
def test_get_output_file_path(testing_workdir, testing_metadata):
    testing_metadata = render.finalize_metadata(testing_metadata)
    api.output_yaml(testing_metadata, 'recipe/meta.yaml')

    build_path = api.get_output_file_paths(os.path.join(testing_workdir, 'recipe'),
                                          config=testing_metadata.config,
                                          no_download_source=True)[0]
    assert build_path == os.path.join(testing_metadata.config.croot,
                                      testing_metadata.config.host_subdir,
                                      "test_get_output_file_path-1.0-1.tar.bz2")
Example #9
0
def test_build_output_build_path(testing_workdir, test_config, test_metadata, capfd):
    api.output_yaml(test_metadata, 'meta.yaml')
    args = ['--output', testing_workdir]
    main_build.execute(args)
    test_path = os.path.join(sys.prefix, "conda-bld", test_config.subdir,
                                  "test_build_output_build_path-1.0-py{}{}_1.tar.bz2".format(
                                      sys.version_info.major, sys.version_info.minor))
    output, error = capfd.readouterr()
    assert error == ""
    assert output.rstrip() == test_path, error
Example #10
0
def test_inspect_hash_input(testing_metadata, testing_workdir, capfd):
    testing_metadata.meta['requirements']['build'] = ['zlib']
    api.output_yaml(testing_metadata, 'meta.yaml')
    output = api.build(testing_workdir, notest=True)[0]
    with open(os.path.join(testing_workdir, 'conda_build_config.yaml'), 'w') as f:
        yaml.dump({'zlib': ['1.2.11']}, f)
    args = ['hash-inputs', output]
    main_inspect.execute(args)
    output, error = capfd.readouterr()
    assert 'zlib' in output
Example #11
0
def test_render_output_build_path(testing_workdir, testing_metadata, capfd, caplog):
    api.output_yaml(testing_metadata, 'meta.yaml')
    metadata = api.render(testing_workdir)[0][0]
    args = ['--output', os.path.join(testing_workdir)]
    main_render.execute(args)
    _hash = metadata._hash_dependencies()
    test_path = "test_render_output_build_path-1.0-py{}{}{}_1.tar.bz2".format(
                                      sys.version_info.major, sys.version_info.minor, _hash)
    output, error = capfd.readouterr()
    # assert error == ""
    assert os.path.basename(output.rstrip()) == test_path, error
Example #12
0
def test_build_output_build_path(testing_workdir, testing_metadata, testing_config, capfd):
    api.output_yaml(testing_metadata, 'meta.yaml')
    testing_config.verbose = False
    testing_config.debug = False
    args = ['--output', os.path.join(testing_workdir)]
    main_build.execute(args)
    test_path = os.path.join(sys.prefix, "conda-bld", testing_config.host_subdir,
                                  "test_build_output_build_path-1.0-1.tar.bz2")
    output, error = capfd.readouterr()
    assert test_path == output.rstrip(), error
    assert error == ""
Example #13
0
def test_purge_all(testing_workdir, testing_metadata):
    """
    purge-all clears out build folders as well as build packages in the osx-64 folders and such
    """
    api.output_yaml(testing_metadata, 'meta.yaml')
    with TemporaryDirectory() as tmpdir:
        testing_metadata.config.croot = tmpdir
        outputs = api.build(testing_workdir, config=testing_metadata.config)
        args = ['purge-all', '--croot', tmpdir]
        main_build.execute(args)
        assert not get_build_folders(testing_metadata.config.croot)
        assert not any(os.path.isfile(fn) for fn in outputs)
Example #14
0
def test_no_filename_hash(testing_workdir, testing_metadata, capfd):
    api.output_yaml(testing_metadata, 'meta.yaml')
    args = ['--output', testing_workdir, '--old-build-string']
    main_render.execute(args)
    output, error = capfd.readouterr()
    assert not re.search('h[0-9a-f]{%d}' % testing_metadata.config.hash_length, output)

    args = ['--no-anaconda-upload', '--no-activate', testing_workdir, '--old-build-string']
    main_build.execute(args)
    output, error = capfd.readouterr()
    assert not re.search('h[0-9a-f]{%d}' % testing_metadata.config.hash_length, output)
    assert not re.search('h[0-9a-f]{%d}' % testing_metadata.config.hash_length, error)
Example #15
0
def test_get_output_file_path(testing_workdir, testing_metadata):
    testing_metadata = render.finalize_metadata(testing_metadata, testing_metadata.config.index)
    api.output_yaml(testing_metadata, 'recipe/meta.yaml')

    build_path = api.get_output_file_path(os.path.join(testing_workdir, 'recipe'),
                                          config=testing_metadata.config,
                                          no_download_source=True)[0]
    _hash = testing_metadata._hash_dependencies()
    python = ''.join(testing_metadata.config.variant['python'].split('.')[:2])
    assert build_path == os.path.join(testing_metadata.config.croot,
                                      testing_metadata.config.host_subdir,
                                      "test_get_output_file_path-1.0-py{}{}_1.tar.bz2".format(
                                          python, _hash))
Example #16
0
def test_build_multiple_recipes(testing_metadata, testing_workdir, testing_config):
    """Test that building two recipes in one CLI call separates the build environment for each"""
    os.makedirs('recipe1')
    os.makedirs('recipe2')
    api.output_yaml(testing_metadata, 'recipe1/meta.yaml')
    with open('recipe1/run_test.py', 'w') as f:
        f.write("import os; assert 'test_build_multiple_recipes' in os.getenv('PREFIX')")
    testing_metadata.meta['package']['name'] = 'package2'
    api.output_yaml(testing_metadata, 'recipe2/meta.yaml')
    with open('recipe2/run_test.py', 'w') as f:
        f.write("import os; assert 'package2' in os.getenv('PREFIX')")
    args = ['--no-anaconda-upload', 'recipe1', 'recipe2']
    main_build.execute(args)
Example #17
0
def test_build_output_build_path(testing_workdir, testing_metadata, testing_config, capfd):
    api.output_yaml(testing_metadata, 'meta.yaml')
    testing_config.verbose = False
    testing_config.debug = False
    metadata = api.render(testing_workdir, config=testing_config)[0][0]
    args = ['--output', os.path.join(testing_workdir)]
    main_build.execute(args)
    _hash = metadata._hash_dependencies()
    test_path = os.path.join(sys.prefix, "conda-bld", testing_config.host_subdir,
                                  "test_build_output_build_path-1.0-py{}{}{}_1.tar.bz2".format(
                                      sys.version_info.major, sys.version_info.minor, _hash))
    output, error = capfd.readouterr()
    # assert error == ""
    assert output.rstrip() == test_path, error
Example #18
0
def test_purge(testing_workdir, testing_metadata):
    """
    purge clears out build folders - things like some_pkg_12048309850135

    It does not clear out build packages from folders like osx-64 or linux-64.
    """
    api.output_yaml(testing_metadata, 'meta.yaml')
    outputs = api.build(testing_workdir)
    args = ['purge']
    main_build.execute(args)
    dirs = get_build_folders(testing_metadata.config.croot)
    assert not dirs
    # make sure artifacts are kept - only temporary folders get nuked
    assert all(os.path.isfile(fn) for fn in outputs)
Example #19
0
def test_render_output_build_path_set_python(testing_workdir, test_metadata, capfd):
    api.output_yaml(test_metadata, 'meta.yaml')
    # build the other major thing, whatever it is
    if sys.version_info.major == 3:
        version = "2.7"
    else:
        version = "3.5"

    args = ['--output', testing_workdir, '--python', version]
    main_render.execute(args)
    test_path = "test_render_output_build_path_set_python-1.0-py{}{}_1.tar.bz2".format(
                                      version.split('.')[0], version.split('.')[1])
    output, error = capfd.readouterr()
    assert os.path.basename(output.rstrip()) == test_path, error
Example #20
0
def test_build_output_build_path_multiple_recipes(testing_workdir, testing_metadata,
                                                  testing_config, capfd):
    api.output_yaml(testing_metadata, 'meta.yaml')
    testing_config.verbose = False
    skip_recipe = os.path.join(metadata_dir, "build_skip")
    args = ['--output', testing_workdir, skip_recipe]

    main_build.execute(args)

    test_path = lambda pkg: os.path.join(sys.prefix, "conda-bld", testing_config.host_subdir, pkg)
    test_paths = [test_path("test_build_output_build_path_multiple_recipes-1.0-1.tar.bz2"), ]

    output, error = capfd.readouterr()
    # assert error == ""
    assert output.rstrip().splitlines() == test_paths, error
Example #21
0
def test_test_extra_dep(testing_metadata):
    testing_metadata.meta['test']['imports'] = ['imagesize']
    api.output_yaml(testing_metadata, 'meta.yaml')
    output = api.build(testing_metadata, notest=True, anaconda_upload=False)[0]

    # tests version constraints.  CLI would quote this - "click <6.7"
    args = [output, '-t', '--extra-deps', 'imagesize <1.0']
    # extra_deps will add it in
    main_build.execute(args)

    # missing click dep will fail tests
    with pytest.raises(SystemExit):
        args = [output, '-t']
        # extra_deps will add it in
        main_build.execute(args)
Example #22
0
def execute(args):
    p, args = parse_args(args)

    config = get_or_merge_config(None, **args.__dict__)
    variants = get_package_variants(args.recipe, config)
    set_language_env_vars(variants)

    channel_urls = args.__dict__.get('channel') or args.__dict__.get('channels') or ()
    config.channel_urls = []

    for url in channel_urls:
        # allow people to specify relative or absolute paths to local channels
        #    These channels still must follow conda rules - they must have the
        #    appropriate platform-specific subdir (e.g. win-64)
        if os.path.isdir(url):
            if not os.path.isabs(url):
                url = os.path.normpath(os.path.abspath(os.path.join(os.getcwd(), url)))
            url = url_path(url)
        config.channel_urls.append(url)

    config.override_channels = args.override_channels

    metadata_tuples = api.render(args.recipe, config=config,
                                 no_download_source=args.no_source)

    if args.output:
        with LoggingContext(logging.CRITICAL + 1):
            config.verbose = False
            config.debug = False
            paths = api.get_output_file_paths(metadata_tuples, config=config)
            print('\n'.join(sorted(paths)))
    else:
        logging.basicConfig(level=logging.INFO)
        for (m, _, _) in metadata_tuples:
            print(api.output_yaml(m, args.file))
Example #23
0
def test_build_output_build_path_multiple_recipes(testing_workdir, test_config, test_metadata, capfd):
    skip_recipe = os.path.join(metadata_dir, "build_skip")
    api.output_yaml(test_metadata, 'meta.yaml')
    args = ['--output', testing_workdir, skip_recipe, '--no-anaconda-upload']

    main_build.execute(args)

    test_path = lambda pkg: os.path.join(sys.prefix, "conda-bld", test_config.subdir, pkg)
    test_paths = [test_path(
        "test_build_output_build_path_multiple_recipes-1.0-py{}{}_1.tar.bz2".format(
        sys.version_info.major, sys.version_info.minor)),
        "Skipped: {} defines build/skip for this "
        "configuration.".format(os.path.abspath(skip_recipe))]

    output, error = capfd.readouterr()
    assert error == ""
    assert output.rstrip().splitlines() == test_paths, error
Example #24
0
def test_no_force_upload(mocker, testing_workdir, testing_metadata):
    with open(os.path.join(testing_workdir, '.condarc'), 'w') as f:
        f.write('anaconda_upload: True\n')
        f.write('conda_build:\n')
        f.write('    force_upload: False\n')
    del testing_metadata.meta['test']
    api.output_yaml(testing_metadata, 'meta.yaml')
    args = ['--no-force-upload', testing_workdir]
    call = mocker.patch.object(conda_build.build.subprocess, 'call')
    reset_context(testing_workdir)
    main_build.execute(args)
    pkg = api.get_output_file_path(testing_metadata)
    assert call.called_once_with(['anaconda', 'upload', pkg])
    args = [testing_workdir]
    with open(os.path.join(testing_workdir, '.condarc'), 'w') as f:
        f.write('anaconda_upload: True\n')
    main_build.execute(args)
    assert call.called_once_with(['anaconda', 'upload', '--force', pkg])
Example #25
0
def test_no_force_upload(mocker, testing_workdir, testing_metadata):
    with open(os.path.join(testing_workdir, '.condarc'), 'w') as f:
        f.write('anaconda_upload: True\n')
        f.write('conda_build:\n')
        f.write('    force_upload: False\n')
    del testing_metadata.meta['test']
    api.output_yaml(testing_metadata, 'meta.yaml')
    args = ['--no-force-upload', testing_workdir]
    call = mocker.patch.object(conda_build.build.subprocess, 'call')
    reset_context(testing_workdir)
    main_build.execute(args)
    pkg = api.get_output_file_path(testing_metadata)
    assert call.called_once_with(['anaconda', 'upload', pkg])
    args = [testing_workdir]
    with open(os.path.join(testing_workdir, '.condarc'), 'w') as f:
        f.write('anaconda_upload: True\n')
    main_build.execute(args)
    assert call.called_once_with(['anaconda', 'upload', '--force', pkg])
Example #26
0
def test_no_filename_hash(testing_workdir, testing_metadata, capfd):
    api.output_yaml(testing_metadata, 'meta.yaml')
    args = ['--output', testing_workdir, '--old-build-string']
    main_render.execute(args)
    output, error = capfd.readouterr()
    assert not re.search('h[0-9a-f]{%d}' % testing_metadata.config.hash_length,
                         output)

    args = [
        '--no-anaconda-upload', '--no-activate', testing_workdir,
        '--old-build-string'
    ]
    main_build.execute(args)
    output, error = capfd.readouterr()
    assert not re.search('h[0-9a-f]{%d}' % testing_metadata.config.hash_length,
                         output)
    assert not re.search('h[0-9a-f]{%d}' % testing_metadata.config.hash_length,
                         error)
Example #27
0
def test_render_output_build_path_set_python(testing_workdir, testing_metadata, capfd):
    api.output_yaml(testing_metadata, 'meta.yaml')
    # build the other major thing, whatever it is
    if sys.version_info.major == 3:
        version = "2.7"
    else:
        version = "3.5"

    api.output_yaml(testing_metadata, 'meta.yaml')
    metadata = api.render(testing_workdir, python=version)[0][0]

    args = ['--output', testing_workdir, '--python', version]
    main_render.execute(args)

    _hash = metadata._hash_dependencies()
    test_path = "test_render_output_build_path_set_python-1.0-py{}{}{}_1.tar.bz2".format(
                                      version.split('.')[0], version.split('.')[1], _hash)
    output, error = capfd.readouterr()
    assert os.path.basename(output.rstrip()) == test_path, error
Example #28
0
def execute(args, print_results=True):
    p, args = parse_args(args)

    config = get_or_merge_config(None, **args.__dict__)

    variants = get_package_variants(args.recipe,
                                    config,
                                    variants=args.variants)
    set_language_env_vars(variants)

    channel_urls = args.__dict__.get('channel') or args.__dict__.get(
        'channels') or ()
    config.channel_urls = []

    for url in channel_urls:
        # allow people to specify relative or absolute paths to local channels
        #    These channels still must follow conda rules - they must have the
        #    appropriate platform-specific subdir (e.g. win-64)
        if os.path.isdir(url):
            if not os.path.isabs(url):
                url = os.path.normpath(
                    os.path.abspath(os.path.join(os.getcwd(), url)))
            url = url_path(url)
        config.channel_urls.append(url)

    config.override_channels = args.override_channels

    if args.output:
        config.verbose = False
        config.debug = False

    metadata_tuples = api.render(args.recipe,
                                 config=config,
                                 no_download_source=args.no_source,
                                 variants=args.variants)

    if print_results:
        if args.output:
            with LoggingContext(logging.CRITICAL + 1):
                paths = api.get_output_file_paths(metadata_tuples,
                                                  config=config)
                print('\n'.join(sorted(paths)))
        else:
            logging.basicConfig(level=logging.INFO)
            for (m, _, _) in metadata_tuples:
                print("--------------")
                print("Hash contents:")
                print("--------------")
                pprint(m.get_hash_contents())
                print("----------")
                print("meta.yaml:")
                print("----------")
                print(api.output_yaml(m, args.file, suppress_outputs=True))
    else:
        return metadata_tuples
Example #29
0
def test_build_output_build_path_multiple_recipes(testing_workdir,
                                                  testing_metadata,
                                                  testing_config, capfd):
    api.output_yaml(testing_metadata, 'meta.yaml')
    testing_config.verbose = False
    skip_recipe = os.path.join(metadata_dir, "build_skip")
    args = ['--output', testing_workdir, skip_recipe]

    main_build.execute(args)

    test_path = lambda pkg: os.path.join(sys.prefix, "conda-bld",
                                         testing_config.host_subdir, pkg)
    test_paths = [
        test_path(
            "test_build_output_build_path_multiple_recipes-1.0-1.tar.bz2"),
    ]

    output, error = capfd.readouterr()
    # assert error == ""
    assert output.rstrip().splitlines() == test_paths, error
Example #30
0
def test_render_output_build_path_set_python(testing_workdir, testing_metadata, capfd):
    testing_metadata.meta['requirements'] = {'host': ['python'],
                                             'run': ['python']}
    api.output_yaml(testing_metadata, 'meta.yaml')
    # build the other major thing, whatever it is
    if sys.version_info.major == 3:
        version = "2.7"
    else:
        version = "3.5"

    api.output_yaml(testing_metadata, 'meta.yaml')
    metadata = api.render(testing_workdir, python=version)[0][0]

    args = ['--output', testing_workdir, '--python', version]
    main_render.execute(args)

    _hash = metadata.hash_dependencies()
    test_path = "test_render_output_build_path_set_python-1.0-py{}{}{}_1.tar.bz2".format(
                                      version.split('.')[0], version.split('.')[1], _hash)
    output, error = capfd.readouterr()
    assert os.path.basename(output.rstrip()) == test_path, error
Example #31
0
def test_build_output_build_path_multiple_recipes(testing_workdir, testing_metadata,
                                                  testing_config, capfd):
    api.output_yaml(testing_metadata, 'meta.yaml')
    testing_config.verbose = False
    metadata = api.render(testing_workdir, config=testing_config)[0][0]
    skip_recipe = os.path.join(metadata_dir, "build_skip")
    args = ['--output', testing_workdir, skip_recipe]

    main_build.execute(args)

    _hash = metadata._hash_dependencies()
    test_path = lambda pkg: os.path.join(sys.prefix, "conda-bld", testing_config.host_subdir, pkg)
    test_paths = [test_path(
        "test_build_output_build_path_multiple_recipes-1.0-py{}{}{}_1.tar.bz2".format(
            sys.version_info.major, sys.version_info.minor, _hash)),
        "Skipped: {} defines build/skip for this "
        "configuration.".format(os.path.abspath(skip_recipe))]

    output, error = capfd.readouterr()
    # assert error == ""
    assert output.rstrip().splitlines() == test_paths, error
Example #32
0
def test_build_output_build_path_multiple_recipes(testing_workdir, test_config,
                                                  test_metadata, capfd):
    skip_recipe = os.path.join(metadata_dir, "build_skip")
    api.output_yaml(test_metadata, 'meta.yaml')
    args = ['--output', testing_workdir, skip_recipe, '--no-anaconda-upload']

    main_build.execute(args)

    test_path = lambda pkg: os.path.join(sys.prefix, "conda-bld", test_config.
                                         subdir, pkg)
    test_paths = [
        test_path(
            "test_build_output_build_path_multiple_recipes-1.0-py{}{}_1.tar.bz2"
            .format(sys.version_info.major, sys.version_info.minor)),
        "Skipped: {} defines build/skip for this "
        "configuration.".format(os.path.abspath(skip_recipe))
    ]

    output, error = capfd.readouterr()
    assert error == ""
    assert output.rstrip().splitlines() == test_paths, error
Example #33
0
def test_build_output_build_path_multiple_recipes(testing_workdir, testing_metadata,
                                                  testing_config, capfd):
    api.output_yaml(testing_metadata, 'meta.yaml')
    testing_config.verbose = False
    metadata = api.render(testing_workdir, config=testing_config)[0][0]
    skip_recipe = os.path.join(metadata_dir, "build_skip")
    args = ['--output', testing_workdir, skip_recipe]

    main_build.execute(args)

    _hash = metadata._hash_dependencies()
    test_path = lambda pkg: os.path.join(sys.prefix, "conda-bld", testing_config.host_subdir, pkg)
    test_paths = [test_path(
        "test_build_output_build_path_multiple_recipes-1.0-py{}{}{}_1.tar.bz2".format(
            sys.version_info.major, sys.version_info.minor, _hash)),
        "Skipped: {} defines build/skip for this "
        "configuration.".format(os.path.abspath(skip_recipe))]

    output, error = capfd.readouterr()
    # assert error == ""
    assert output.rstrip().splitlines() == test_paths, error
Example #34
0
def execute(args):
    p, args = parse_args(args)

    config = get_or_merge_config(None, **args.__dict__)
    variants = get_package_variants(args.recipe, config)
    set_language_env_vars(variants)

    metadata_tuples = api.render(args.recipe, config=config,
                                 no_download_source=args.no_source)
    if args.output:
        with LoggingContext(logging.CRITICAL + 1):
            paths = api.get_output_file_path(metadata_tuples)
            print('\n'.join(paths))
    else:
        logging.basicConfig(level=logging.INFO)
        for (m, _, _) in metadata_tuples:
            print(api.output_yaml(m, args.file))
Example #35
0
def execute(args):
    p, args = parse_args(args)

    config = get_or_merge_config(None, **args.__dict__)
    variants = get_package_variants(args.recipe, config)
    set_language_env_vars(variants)

    metadata_tuples = api.render(args.recipe, config=config,
                                 no_download_source=args.no_source)

    if args.output:
        with LoggingContext(logging.CRITICAL + 1):
            paths = api.get_output_file_paths(metadata_tuples)
            print('\n'.join(sorted(paths)))
    else:
        logging.basicConfig(level=logging.INFO)
        for (m, _, _) in metadata_tuples:
            print(api.output_yaml(m, args.file))
Example #36
0
def execute(args, print_results=True):
    p, args = parse_args(args)

    config = get_or_merge_config(None, **args.__dict__)

    variants = get_package_variants(args.recipe,
                                    config,
                                    variants=args.variants)
    set_language_env_vars(variants)

    config.channel_urls = get_channel_urls(args.__dict__)

    config.override_channels = args.override_channels

    if args.output:
        config.verbose = False
        config.debug = False

    metadata_tuples = api.render(args.recipe,
                                 config=config,
                                 no_download_source=args.no_source,
                                 variants=args.variants)

    if print_results:
        if args.output:
            with LoggingContext(logging.CRITICAL + 1):
                paths = api.get_output_file_paths(metadata_tuples,
                                                  config=config)
                print('\n'.join(sorted(paths)))
        else:
            logging.basicConfig(level=logging.INFO)
            for (m, _, _) in metadata_tuples:
                print("--------------")
                print("Hash contents:")
                print("--------------")
                pprint(m.get_hash_contents())
                print("----------")
                print("meta.yaml:")
                print("----------")
                print(api.output_yaml(m, args.file, suppress_outputs=True))
    else:
        return metadata_tuples
Example #37
0
def execute(args, print_results=True):
    p, args = parse_args(args)

    config = get_or_merge_config(None, **args.__dict__)

    variants = get_package_variants(args.recipe, config, variants=args.variants)
    set_language_env_vars(variants)

    config.channel_urls = get_channel_urls(args.__dict__)

    config.override_channels = args.override_channels

    if args.output:
        config.verbose = False
        config.debug = False

    metadata_tuples = api.render(args.recipe, config=config,
                                 no_download_source=args.no_source,
                                 variants=args.variants)

    if print_results:
        if args.output:
            with LoggingContext(logging.CRITICAL + 1):
                paths = api.get_output_file_paths(metadata_tuples, config=config)
                print('\n'.join(sorted(paths)))
        else:
            logging.basicConfig(level=logging.INFO)
            for (m, _, _) in metadata_tuples:
                print("--------------")
                print("Hash contents:")
                print("--------------")
                pprint(m.get_hash_contents())
                print("----------")
                print("meta.yaml:")
                print("----------")
                print(api.output_yaml(m, args.file, suppress_outputs=True))
    else:
        return metadata_tuples
Example #38
0
def test_conda_py_no_period(testing_workdir, testing_metadata, monkeypatch):
    monkeypatch.setenv('CONDA_PY', '34')
    api.output_yaml(testing_metadata, 'meta.yaml')
    outputs = api.build(testing_workdir)
    assert any('py34' in output for output in outputs)
Example #39
0
def test_package_test(testing_workdir, testing_metadata):
    """Test calling conda build -t <package file> - rather than <recipe dir>"""
    api.output_yaml(testing_metadata, 'recipe/meta.yaml')
    output = api.build(testing_workdir, config=testing_metadata.config, notest=True)[0]
    args = ['-t', output]
    main_build.execute(args)
Example #40
0
def test_package_test(testing_workdir, testing_metadata):
    """Test calling conda build -t <package file> - rather than <recipe dir>"""
    api.output_yaml(testing_metadata, 'recipe/meta.yaml')
    output = api.build(testing_workdir, config=testing_metadata.config, notest=True)[0]
    args = ['-t', output]
    main_build.execute(args)