コード例 #1
0
ファイル: test_api_render.py プロジェクト: ESSS/conda-build
def test_get_output_file_path(testing_workdir, test_config):
    build_path = api.get_output_file_path(os.path.join(metadata_dir, "python_build"),
                                          config=test_config,
                                          no_download_source=True)
    assert build_path == os.path.join(test_config.croot, test_config.subdir,
                                      "conda-build-test-python-build-1.0-0.tar.bz2")
    build_path = api.get_output_file_path(os.path.join(metadata_dir, "python_build"),
                                          config=test_config)
    assert build_path == os.path.join(test_config.croot, test_config.subdir,
                                      "conda-build-test-python-build-1.0-0.tar.bz2")
コード例 #2
0
ファイル: test_api_build.py プロジェクト: ESSS/conda-build
def test_no_include_recipe_meta_yaml(test_metadata, test_config):
    # first, make sure that the recipe is there by default.  This test copied from above, but copied
    # as a sanity check here.
    output_file = api.get_output_file_path(test_metadata)
    api.build(test_metadata)
    assert package_has_file(output_file, "info/recipe/meta.yaml")

    output_file = api.get_output_file_path(os.path.join(metadata_dir, '_no_include_recipe'),
                                           config=test_config)
    api.build(os.path.join(metadata_dir, '_no_include_recipe'), config=test_config)
    assert not package_has_file(output_file, "info/recipe/meta.yaml")
コード例 #3
0
ファイル: test_cli.py プロジェクト: msarahan/conda-build
def test_slash_in_recipe_arg_keeps_build_id(testing_workdir, test_config):
    recipe_path = os.path.join(metadata_dir, "has_prefix_files" + os.path.sep)
    fn = api.get_output_file_path(recipe_path, config=test_config)
    args = [os.path.join(metadata_dir, "has_prefix_files"), '--croot', test_config.croot]
    main_build.execute(args)
    fn = api.get_output_file_path(recipe_path,
                                  config=test_config)
    assert package_has_file(fn, 'info/has_prefix')
    data = package_has_file(fn, 'info/has_prefix')
    if hasattr(data, 'decode'):
        data = data.decode('UTF-8')
    assert 'has_prefix_files_1' in data
コード例 #4
0
def test_no_include_recipe_config_arg(test_metadata):
    """Two ways to not include recipe: build/include_recipe: False in meta.yaml; or this.
    Former is tested with specific recipe."""
    output_file = api.get_output_file_path(test_metadata)
    api.build(test_metadata)
    assert package_has_file(output_file, "info/recipe/meta.yaml")

    # make sure that it is not there when the command line flag is passed
    test_metadata.config.include_recipe = False
    test_metadata.meta['build_number'] = 2
    output_file = api.get_output_file_path(test_metadata)
    api.build(test_metadata)
    assert not package_has_file(output_file, "info/recipe/meta.yaml")
コード例 #5
0
ファイル: test_api_render.py プロジェクト: ESSS/conda-build
def test_get_output_file_path_jinja2(testing_workdir, test_config):
    # If this test does not raise, it's an indicator that the workdir is not
    #    being cleaned as it should.

    # First get metadata with a recipe that is known to need a download:
    with pytest.raises(SystemExit):
        build_path = api.get_output_file_path(os.path.join(metadata_dir, "source_git_jinja2"),
                                              config=test_config,
                                              no_download_source=True)
    build_path = api.get_output_file_path(os.path.join(metadata_dir, "source_git_jinja2"),
                                          config=test_config)
    assert build_path == os.path.join(test_config.croot, test_config.subdir,
                                      "conda-build-test-source-git-jinja2-1.20.2-"
                                      "py{0}_0_g262d444.tar.bz2".format(test_config.CONDA_PY))
コード例 #6
0
def test_numpy_setup_py_data(testing_config):
    recipe_path = os.path.join(metadata_dir, '_numpy_setup_py_data')
    _hash = api.render(recipe_path, config=testing_config, numpy="1.11")[0][0]._hash_dependencies()
    assert os.path.basename(api.get_output_file_path(recipe_path,
                            config=testing_config, numpy="1.11")[0]) == \
                            "load_setup_py_test-1.0a1-py{0}{1}np111{2}_1.tar.bz2".format(
                                sys.version_info.major, sys.version_info.minor, _hash)
コード例 #7
0
def test_output_build_path_git_source(testing_workdir, test_config):
    output = api.get_output_file_path(os.path.join(metadata_dir, "source_git_jinja2"),
                                      config=test_config)
    test_path = os.path.join(test_config.croot, test_config.subdir,
                     "conda-build-test-source-git-jinja2-1.20.2-py{}{}_0_g262d444.tar.bz2".format(
                                      sys.version_info.major, sys.version_info.minor))
    assert output == test_path
コード例 #8
0
def test_info_files_json(test_config):
    recipe = os.path.join(metadata_dir, "ignore_some_prefix_files")
    fn = api.get_output_file_path(recipe, config=test_config)
    api.build(recipe, config=test_config)
    assert package_has_file(fn, "info/paths.json")
    with tarfile.open(fn) as tf:
        data = json.loads(tf.extractfile('info/paths.json').read().decode('utf-8'))
    fields = ["_path", "sha256", "size_in_bytes", "path_type", "file_mode", "no_link",
              "prefix_placeholder", "inode_paths"]
    for key in data.keys():
        assert key in ['paths', 'paths_version']
    for paths in data.get('paths'):
        for field in paths.keys():
            assert field in fields
    assert len(data.get('paths')) == 2
    for file in data.get('paths'):
        for key in file.keys():
            assert key in fields
        short_path = file.get("_path")
        if short_path == "test.sh" or short_path == "test.bat":
            assert file.get("prefix_placeholder") is not None
            assert file.get("file_mode") is not None
        else:
            assert file.get("prefix_placeholder") is None
            assert file.get("file_mode") is None
コード例 #9
0
def test_noarch_foo_value():
    recipe = os.path.join(metadata_dir, "noarch_foo")
    fn = api.get_output_file_path(recipe)
    api.build(recipe)
    metadata = json.loads(package_has_file(fn, 'info/index.json').decode())
    assert 'noarch' in metadata
    assert metadata['noarch'] == "foo"
コード例 #10
0
def test_subpackage_version_provided(testing_metadata):
    testing_metadata.meta['outputs'] = [{'name': 'a', 'version': '2.0'}]
    del testing_metadata.meta['requirements']
    out_dicts_and_metadata = testing_metadata.get_output_metadata_set()
    outputs = api.get_output_file_path([(m, None, None) for (_, m) in out_dicts_and_metadata])
    assert len(outputs) == 1
    assert "a-2.0-h" in outputs[0]
コード例 #11
0
def test_git_describe_info_on_branch(testing_config):
    recipe_path = os.path.join(metadata_dir, "_git_describe_number_branch")
    output = api.get_output_file_path(recipe_path)[0]
    _hash = api.render(recipe_path, config=testing_config)[0][0]._hash_dependencies()
    test_path = os.path.join(sys.prefix, "conda-bld", testing_config.host_subdir,
                    "git_describe_number_branch-1.20.2.0-{}_1_g82c6ba6.tar.bz2".format(_hash))
    assert test_path == output
コード例 #12
0
def test_relative_git_url_git_versioning(testing_workdir, testing_config):
    cwd = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..',
                                       'conda_build_test_recipe'))
    tag = describe_root(cwd)
    recipe = os.path.join(metadata_dir, "_source_git_jinja2_relative_git_url")
    output = api.get_output_file_path(recipe, config=testing_config)[0]
    assert tag in output
コード例 #13
0
ファイル: test_cli.py プロジェクト: bioconda/conda-build
def test_inspect_prefix_length(testing_workdir, capfd):
    from conda_build import api

    # build our own known-length package here
    test_base = os.path.expanduser("~/cbtmp")
    config = api.Config(croot=test_base, anaconda_upload=False, verbose=True)
    recipe_path = os.path.join(metadata_dir, "has_prefix_files")
    fn = api.get_output_file_path(recipe_path, config=config)
    if os.path.isfile(fn):
        os.remove(fn)
    config.prefix_length = 80
    api.build(recipe_path, config=config)

    args = ["prefix-lengths", fn]
    with pytest.raises(SystemExit):
        main_inspect.execute(args)
        output, error = capfd.readouterr()
        assert "Packages with binary prefixes shorter than" in output
        assert fn in output

    config.prefix_length = 255
    api.build(recipe_path, config=config)
    main_inspect.execute(args)
    output, error = capfd.readouterr()
    assert "No packages found with binary prefixes shorter" in output
コード例 #14
0
ファイル: test_api_build.py プロジェクト: ESSS/conda-build
def test_fix_permissions(test_config):
    recipe = os.path.join(metadata_dir, "fix_permissions")
    fn = api.get_output_file_path(recipe, config=test_config)
    api.build(recipe, config=test_config)
    tf = tarfile.open(fn)
    for f in tf.getmembers():
        assert f.mode & 0o444 == 0o444, "tar member '{}' has invalid (read) mode".format(f.name)
コード例 #15
0
ファイル: test_api_test.py プロジェクト: ESSS/conda-build
def test_package_with_jinja2_does_not_redownload_source(testing_workdir, test_config):
    recipe = os.path.join(metadata_dir, 'jinja2_build_str')
    api.build(recipe, config=test_config, notest=True)
    output_file = api.get_output_file_path(recipe, config=test_config)
    # this recipe uses jinja2, which should trigger source download, except that source download
    #    will have already happened in the build stage.
    # https://github.com/conda/conda-build/issues/1451
    api.test(output_file, config=test_config)
コード例 #16
0
def test_get_output_file_path_metadata_object(testing_metadata):
    build_path = api.get_output_file_path(testing_metadata)[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_metadata_object-1.0-py{}{}_1.tar.bz2".format(
                    python, _hash))
コード例 #17
0
def test_noarch_python():
    recipe = os.path.join(metadata_dir, "_noarch_python")
    fn = api.get_output_file_path(recipe)
    api.build(recipe)
    assert package_has_file(fn, 'info/files') is not ''
    noarch = json.loads(package_has_file(fn, 'info/noarch.json').decode())
    assert 'entry_points' in noarch
    assert 'type' in noarch
コード例 #18
0
def test_subpackage_independent_hash(testing_metadata):
    testing_metadata.meta['outputs'] = [{'name': 'a', 'requirements': 'bzip2'}]
    testing_metadata.meta['requirements']['run'] = ['a']
    out_dicts_and_metadata = testing_metadata.get_output_metadata_set()
    assert len(out_dicts_and_metadata) == 2
    outputs = api.get_output_file_path([(m, None, None) for (_, m) in out_dicts_and_metadata])
    assert len(outputs) == 2
    assert outputs[0][-15:] != outputs[1][-15:]
コード例 #19
0
def test_output_build_path_git_source(testing_workdir, testing_config):
    recipe_path = os.path.join(metadata_dir, "source_git_jinja2")
    output = api.get_output_file_path(recipe_path, config=testing_config)[0]
    _hash = api.render(recipe_path, config=testing_config)[0][0]._hash_dependencies()
    test_path = os.path.join(testing_config.croot, testing_config.host_subdir,
                    "conda-build-test-source-git-jinja2-1.20.2-py{}{}{}_0_g262d444.tar.bz2".format(
                        sys.version_info.major, sys.version_info.minor, _hash))
    assert output == test_path
コード例 #20
0
def test_relative_path_git_versioning(testing_workdir, test_config):
    # conda_build_test_recipe is a manual step.  Clone it at the same level as
    #    your conda-build source.
    cwd = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..',
                                       'conda_build_test_recipe'))
    tag = describe_root(cwd)
    recipe = os.path.join(metadata_dir, "_source_git_jinja2_relative_path")
    output = api.get_output_file_path(recipe, config=test_config)
    assert tag in output
コード例 #21
0
ファイル: test_cli.py プロジェクト: patricksnape/conda-build
def test_purge_all(test_metadata):
    """
    purge-all clears out build folders as well as build packages in the osx-64 folders and such
    """
    api.build(test_metadata)
    fn = api.get_output_file_path(test_metadata)
    args = ['purge-all', '--croot', test_metadata.config.croot]
    main_build.execute(args)
    assert not get_build_folders(test_metadata.config.croot)
    assert not os.path.isfile(fn)
コード例 #22
0
ファイル: test_api_convert.py プロジェクト: ESSS/conda-build
def test_convert_from_unix_to_win_creates_entry_points(test_config):
    recipe_dir = os.path.join(metadata_dir, "entry_points")
    fn = api.get_output_file_path(recipe_dir, config=test_config)
    api.build(recipe_dir, config=test_config)
    for platform in ['win-64', 'win-32']:
        api.convert(fn, platforms=[platform], force=True)
        assert package_has_file(os.path.join(platform, os.path.basename(fn)), "Scripts/test-script-manual-script.py")
        assert package_has_file(os.path.join(platform, os.path.basename(fn)), "Scripts/test-script-manual.bat")
        assert package_has_file(os.path.join(platform, os.path.basename(fn)), "Scripts/test-script-setup-script.py")
        assert package_has_file(os.path.join(platform, os.path.basename(fn)), "Scripts/test-script-setup.bat")
コード例 #23
0
def test_subpackage_independent_hash(testing_metadata):
    # this recipe is creating 2 outputs.  One is the output here, a.  The other is the top-level
    #     output, implicitly created by adding the run requirement.
    testing_metadata.meta['outputs'] = [{'name': 'a', 'requirements': 'bzip2'}]
    testing_metadata.meta['requirements']['run'] = ['a']
    out_dicts_and_metadata = testing_metadata.get_output_metadata_set()
    assert len(out_dicts_and_metadata) == 2
    outputs = api.get_output_file_path([(m, None, None) for (_, m) in out_dicts_and_metadata])
    assert len(outputs) == 2
    assert outputs[0][-15:] != outputs[1][-15:]
コード例 #24
0
def test_noarch_python_1(test_config):
    recipe = os.path.join(metadata_dir, "_noarch_python")
    fn = api.get_output_file_path(recipe, config=test_config)
    api.build(recipe, config=test_config)
    assert package_has_file(fn, 'info/files') is not ''
    extra = json.loads(package_has_file(fn, 'info/package_metadata.json').decode())
    assert 'noarch' in extra
    assert 'entry_points' in extra['noarch']
    assert 'type' in extra['noarch']
    assert 'package_metadata_version' in extra
コード例 #25
0
ファイル: test_api_test.py プロジェクト: msarahan/conda-build
def test_package_test(testing_workdir, test_config):
    """Test calling conda build -t <package file> - rather than <recipe dir>"""

    # temporarily necessary because we have custom rebuilt svn for longer prefix here
    test_config.channel_urls = ('conda_build_test', )

    recipe = os.path.join(metadata_dir, 'has_prefix_files')
    api.build(recipe, config=test_config, notest=True)
    output_file = api.get_output_file_path(recipe, config=test_config)
    api.test(output_file, config=test_config)
コード例 #26
0
ファイル: test_cli.py プロジェクト: msarahan/conda-build
def test_build_no_build_id(testing_workdir, test_config, capfd):
    args = [os.path.join(metadata_dir, "has_prefix_files"), '--no-build-id',
            '--croot', test_config.croot]
    main_build.execute(args)
    fn = api.get_output_file_path(os.path.join(metadata_dir, "has_prefix_files"),
                                  config=test_config)
    assert package_has_file(fn, 'info/has_prefix')
    data = package_has_file(fn, 'info/has_prefix')
    if hasattr(data, 'decode'):
        data = data.decode('UTF-8')
    assert 'has_prefix_files_1' not in data
コード例 #27
0
ファイル: test_cli.py プロジェクト: patricksnape/conda-build
def test_build_no_build_id(testing_workdir, test_config):
    args = [os.path.join(metadata_dir, "has_prefix_files"), '--no-build-id',
            '--croot', test_config.croot, '--no-activate', '--no-anaconda-upload']
    main_build.execute(args)
    fn = api.get_output_file_path(os.path.join(metadata_dir, "has_prefix_files"),
                                  config=test_config)
    data = package_has_file(fn, 'binary-has-prefix')
    assert data
    if hasattr(data, 'decode'):
        data = data.decode('UTF-8')
    assert 'has_prefix_files_1' not in data
コード例 #28
0
ファイル: test_cli.py プロジェクト: patricksnape/conda-build
def test_purge(testing_workdir, test_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.build(test_metadata)
    fn = api.get_output_file_path(test_metadata)
    args = ['purge']
    main_build.execute(args)
    assert not get_build_folders(test_metadata.config.croot)
    assert os.path.isfile(fn)
コード例 #29
0
def test_get_output_file_path_jinja2(testing_workdir, testing_config):
    # If this test does not raise, it's an indicator that the workdir is not
    #    being cleaned as it should.
    recipe = os.path.join(metadata_dir, "source_git_jinja2")

    # First get metadata with a recipe that is known to need a download:
    with pytest.raises((ValueError, SystemExit)):
        build_path = api.get_output_file_path(recipe,
                                              config=testing_config,
                                              no_download_source=True)[0]

    metadata, need_download, need_reparse_in_env = api.render(
        recipe,
        config=testing_config,
        no_download_source=False)[0]
    build_path = api.get_output_file_path(metadata)[0]
    _hash = metadata._hash_dependencies()
    python = ''.join(metadata.config.variant['python'].split('.')[:2])
    assert build_path == os.path.join(testing_config.croot, testing_config.host_subdir,
                                      "conda-build-test-source-git-jinja2-1.20.2-"
                                      "py{0}{1}_0_g262d444.tar.bz2".format(python, _hash))
コード例 #30
0
ファイル: test_cli.py プロジェクト: bioconda/conda-build
def test_purge_all(test_metadata):
    """
    purge-all clears out build folders as well as build packages in the osx-64 folders and such
    """
    # override config to be default, so that output path lines up with default
    #    config used by main_build
    test_metadata.config = api.Config()
    api.build(test_metadata)
    fn = api.get_output_file_path(test_metadata)
    args = ["purge-all"]
    main_build.execute(args)
    assert not get_build_folders(test_metadata.config.croot)
    assert not os.path.isfile(fn)
コード例 #31
0
ファイル: test_api_build.py プロジェクト: jerowe/conda-build
def test_legacy_noarch_python(test_config):
    recipe = os.path.join(metadata_dir, "_legacy_noarch_python")
    fn = api.get_output_file_path(recipe, config=test_config)
    # make sure that the package is going into the noarch folder
    assert os.path.basename(os.path.dirname(fn)) == 'noarch'
    api.build(recipe, config=test_config)
コード例 #32
0
def test_relative_git_url_submodule_clone(testing_workdir, monkeypatch):
    """
    A multi-part test encompassing the following checks:

    1. That git submodules identified with both relative and absolute URLs can be mirrored
       and cloned.

    2. That changes pushed to the original repository are updated in the mirror and finally
       reflected in the package version and filename via `GIT_DESCRIBE_TAG`.

    3. That `source.py` is using `check_call_env` and `check_output_env` and that those
       functions are using tools from the build env.
    """

    toplevel = os.path.join(testing_workdir, 'toplevel')
    os.mkdir(toplevel)
    relative_sub = os.path.join(testing_workdir, 'relative_sub')
    os.mkdir(relative_sub)
    absolute_sub = os.path.join(testing_workdir, 'absolute_sub')
    os.mkdir(absolute_sub)

    sys_git_env = os.environ.copy()
    sys_git_env['GIT_AUTHOR_NAME'] = 'conda-build'
    sys_git_env['GIT_AUTHOR_EMAIL'] = '*****@*****.**'
    sys_git_env['GIT_COMMITTER_NAME'] = 'conda-build'
    sys_git_env['GIT_COMMITTER_EMAIL'] = '*****@*****.**'

    # Find the git executable before putting our dummy one on PATH.
    git = find_executable('git')

    # Put the broken git on os.environ["PATH"]
    exename = dummy_executable(testing_workdir, 'git')
    monkeypatch.setenv("PATH", testing_workdir, prepend=os.pathsep)
    # .. and ensure it gets run (and fails).
    FNULL = open(os.devnull, 'w')
    # Strangely ..
    #   stderr=FNULL suppresses the output from echo on OS X whereas
    #   stdout=FNULL suppresses the output from echo on Windows
    with pytest.raises(subprocess.CalledProcessError,
                       message="Dummy git was not executed"):
        check_call_env([exename, '--version'], stdout=FNULL, stderr=FNULL)
    FNULL.close()

    for tag in range(2):
        os.chdir(absolute_sub)
        if tag == 0:
            check_call_env([git, 'init'], env=sys_git_env)
        with open('absolute', 'w') as f:
            f.write(str(tag))
        check_call_env([git, 'add', 'absolute'], env=sys_git_env)
        check_call_env([git, 'commit', '-m', 'absolute{}'.format(tag)],
                       env=sys_git_env)

        os.chdir(relative_sub)
        if tag == 0:
            check_call_env([git, 'init'], env=sys_git_env)
        with open('relative', 'w') as f:
            f.write(str(tag))
        check_call_env([git, 'add', 'relative'], env=sys_git_env)
        check_call_env([git, 'commit', '-m', 'relative{}'.format(tag)],
                       env=sys_git_env)

        os.chdir(toplevel)
        if tag == 0:
            check_call_env([git, 'init'], env=sys_git_env)
        with open('toplevel', 'w') as f:
            f.write(str(tag))
        check_call_env([git, 'add', 'toplevel'], env=sys_git_env)
        check_call_env([git, 'commit', '-m', 'toplevel{}'.format(tag)],
                       env=sys_git_env)
        if tag == 0:
            check_call_env([
                git, 'submodule', 'add',
                convert_path_for_cygwin_or_msys2(git, absolute_sub), 'absolute'
            ],
                           env=sys_git_env)
            check_call_env(
                [git, 'submodule', 'add', '../relative_sub', 'relative'],
                env=sys_git_env)
        else:
            # Once we use a more recent Git for Windows than 2.6.4 on Windows or m2-git we
            # can change this to `git submodule update --recursive`.
            check_call_env([git, 'submodule', 'foreach', git, 'pull'],
                           env=sys_git_env)
        check_call_env(
            [git, 'commit', '-am', 'added submodules@{}'.format(tag)],
            env=sys_git_env)
        check_call_env(
            [git, 'tag', '-a',
             str(tag), '-m', 'tag {}'.format(tag)],
            env=sys_git_env)

        # It is possible to use `Git for Windows` here too, though you *must* not use a different
        # (type of) git than the one used above to add the absolute submodule, because .gitmodules
        # stores the absolute path and that is not interchangeable between MSYS2 and native Win32.
        #
        # Also, git is set to False here because it needs to be rebuilt with the longer prefix. As
        # things stand, my _b_env folder for this test contains more than 80 characters.
        requirements = ('requirements',
                        OrderedDict([('build', [
                            'git            # [False]',
                            'm2-git         # [win]', 'm2-filesystem  # [win]'
                        ])]))

        filename = os.path.join(testing_workdir, 'meta.yaml')
        data = OrderedDict([
            ('package',
             OrderedDict([('name', 'relative_submodules'),
                          ('version', '{{ GIT_DESCRIBE_TAG }}')])),
            ('source',
             OrderedDict([('git_url', toplevel),
                          ('git_tag', str(tag))])), requirements,
            ('build',
             OrderedDict([('script', [
                 'git --no-pager submodule --quiet foreach git log -n 1 --pretty=format:%%s > '
                 '%PREFIX%\\summaries.txt  # [win]',
                 'git --no-pager submodule --quiet foreach git log -n 1 --pretty=format:%s > '
                 '$PREFIX/summaries.txt   # [not win]'
             ])])),
            ('test',
             OrderedDict([('commands', [
                 'echo absolute{}relative{} > %PREFIX%\\expected_summaries.txt       # [win]'
                 .format(tag, tag),
                 'fc.exe /W %PREFIX%\\expected_summaries.txt %PREFIX%\\summaries.txt # [win]',
                 'echo absolute{}relative{} > $PREFIX/expected_summaries.txt         # [not win]'
                 .format(tag, tag),
                 'diff -wuN ${PREFIX}/expected_summaries.txt ${PREFIX}/summaries.txt # [not win]'
             ])]))
        ])

        with open(filename, 'w') as outfile:
            outfile.write(
                yaml.dump(data, default_flow_style=False, width=999999999))
        # Reset the path because our broken, dummy `git` would cause `render_recipe`
        # to fail, while no `git` will cause the build_dependencies to be installed.
        monkeypatch.undo()
        # This will (after one spin round the loop) install and run 'git' with the
        # build env prepended to os.environ[]
        metadata = api.render(testing_workdir)[0][0]
        output = api.get_output_file_path(metadata)[0]
        assert ("relative_submodules-{}-".format(tag) in output)
        api.build(metadata)
コード例 #33
0
def output_action(recipe, config):
    with LoggingContext(logging.CRITICAL + 1):
        metadata_tuples = api.render(recipe, config=config)
        paths = api.get_output_file_path(metadata_tuples)
        print('\n'.join(paths))
コード例 #34
0
def test_output_pkg_path_shows_all_subpackages(testing_metadata):
    testing_metadata.meta['outputs'] = [{'name': 'a'}, {'name': 'b'}]
    out_dicts_and_metadata = testing_metadata.get_output_metadata_set()
    outputs = api.get_output_file_path([(m, None, None)
                                        for (_, m) in out_dicts_and_metadata])
    assert len(outputs) == 2
コード例 #35
0
ファイル: test_render.py プロジェクト: yutiansut/conda-build
def test_output_with_noarch_says_noarch(testing_metadata):
    testing_metadata.meta['build']['noarch'] = 'python'
    output = api.get_output_file_path(testing_metadata)
    assert os.path.sep + "noarch" + os.path.sep in output[0]
コード例 #36
0
def test_numpy_setup_py_data(test_config):
    recipe_path = os.path.join(metadata_dir, '_numpy_setup_py_data')
    assert os.path.basename(api.get_output_file_path(recipe_path,
                            config=test_config, numpy="1.11")) == \
                            "load_setup_py_test-1.0a1-np111py{0}{1}_1.tar.bz2".format(
                                sys.version_info.major, sys.version_info.minor)
コード例 #37
0
def test_script_win_creates_exe(test_config):
    recipe = os.path.join(metadata_dir, "_script_win_creates_exe")
    fn = api.get_output_file_path(recipe, config=test_config)
    api.build(recipe, config=test_config)
    assert package_has_file(fn, 'Scripts/test-script.exe')
    assert package_has_file(fn, 'Scripts/test-script-script.py')
コード例 #38
0
ファイル: test_api_build.py プロジェクト: jerowe/conda-build
def test_noarch_foo_value(test_config):
    recipe = os.path.join(metadata_dir, "noarch_generic")
    fn = api.get_output_file_path(recipe, config=test_config)
    api.build(recipe, config=test_config)
    metadata = json.loads(package_has_file(fn, 'info/index.json').decode())
    assert metadata['noarch'] == "generic"
コード例 #39
0
def test_output_without_jinja_does_not_download(mock_source, testing_workdir,
                                                testing_config):
    api.get_output_file_path(os.path.join(metadata_dir, "source_git"),
                             config=testing_config)[0]
    mock_source.provide.assert_not_called()