Esempio n. 1
0
def test_develop(testing_env):
    f = "https://pypi.io/packages/source/c/conda_version_test/conda_version_test-0.1.0-1.tar.gz"
    download(f, "conda_version_test.tar.gz")
    tar_xf("conda_version_test.tar.gz", testing_env)
    extract_folder = 'conda_version_test-0.1.0-1'
    cwd = os.getcwd()
    args = ['-p', testing_env, extract_folder]
    main_develop.execute(args)
    py_ver = '.'.join((str(sys.version_info.major), str(sys.version_info.minor)))
    assert cwd in open(os.path.join(get_site_packages(testing_env, py_ver), 'conda.pth')).read()
    args = ['--uninstall', '-p', testing_env, extract_folder]
    main_develop.execute(args)
    assert (cwd not in open(os.path.join(get_site_packages(testing_env, py_ver),
                                         'conda.pth')).read())
Esempio n. 2
0
def test_develop(testing_env):
    f = "https://pypi.io/packages/source/c/conda_version_test/conda_version_test-0.1.0-1.tar.gz"
    download(f, "conda_version_test.tar.gz")
    from conda_build.utils import tar_xf
    tar_xf("conda_version_test.tar.gz", testing_env)
    extract_folder = 'conda_version_test-0.1.0-1'
    cwd = os.getcwd()
    args = ['-p', testing_env, extract_folder]
    main_develop.execute(args)
    assert cwd in open(os.path.join(get_site_packages(testing_env), 'conda.pth')).read()

    args = ['--uninstall', '-p', testing_env, extract_folder]
    main_develop.execute(args)
    assert (cwd not in open(os.path.join(get_site_packages(testing_env), 'conda.pth')).read())
Esempio n. 3
0
def test_develop(testing_env):
    f = "https://pypi.io/packages/source/c/conda_version_test/conda_version_test-0.1.0-1.tar.gz"
    download(f, "conda_version_test.tar.gz")
    tar_xf("conda_version_test.tar.gz", testing_env)
    extract_folder = 'conda_version_test-0.1.0-1'
    cwd = os.getcwd()
    args = ['-p', testing_env, extract_folder]
    main_develop.execute(args)
    py_ver = '.'.join((str(sys.version_info.major), str(sys.version_info.minor)))
    assert cwd in open(os.path.join(get_site_packages(testing_env, py_ver), 'conda.pth')).read()
    args = ['--uninstall', '-p', testing_env, extract_folder]
    main_develop.execute(args)
    assert (cwd not in open(os.path.join(get_site_packages(testing_env, py_ver),
                                         'conda.pth')).read())
Esempio n. 4
0
def test_develop(testing_env):
    f = "https://pypi.io/packages/source/c/conda_version_test/conda_version_test-0.1.0-1.tar.gz"
    download(f, "conda_version_test.tar.gz")
    from conda_build.utils import tar_xf
    tar_xf("conda_version_test.tar.gz", testing_env)
    extract_folder = 'conda_version_test-0.1.0-1'
    cwd = os.getcwd()
    args = ['-p', testing_env, extract_folder]
    main_develop.execute(args)
    assert cwd in open(
        os.path.join(get_site_packages(testing_env), 'conda.pth')).read()

    args = ['--uninstall', '-p', testing_env, extract_folder]
    main_develop.execute(args)
    assert (cwd not in open(
        os.path.join(get_site_packages(testing_env), 'conda.pth')).read())
Esempio n. 5
0
def python_vars(metadata, prefix, escape_backslash):
    py_ver = get_py_ver(metadata.config)
    stdlib_dir = utils.get_stdlib_dir(prefix, py_ver)
    sp_dir = utils.get_site_packages(prefix, py_ver)

    if utils.on_win and escape_backslash:
        stdlib_dir = stdlib_dir.replace('\\', '\\\\')
        sp_dir = sp_dir.replace('\\', '\\\\')

    vars_ = {
            'CONDA_PY': ''.join(py_ver.split('.')[:2]),
            'PY3K': str(int(int(py_ver[0]) >= 3)),
            'PY_VER': py_ver,
            'STDLIB_DIR': stdlib_dir,
            'SP_DIR': sp_dir,
            }
    build_or_host = 'host' if metadata.is_cross else 'build'
    deps = [str(ms.name) for ms in metadata.ms_depends(build_or_host)]
    if 'python' in deps or metadata.name(fail_ok=True) == 'python':
        python_bin = metadata.config.python_bin(prefix, metadata.config.host_subdir)

        if utils.on_win and escape_backslash:
            python_bin = python_bin.replace('\\', '\\\\')

        vars_.update({
            # host prefix is always fine, because it is the same as build when is_cross is False
            'PYTHON': python_bin,
        })

    np_ver = metadata.config.variant.get('numpy', get_default_variant(metadata.config)['numpy'])
    vars_['NPY_VER'] = '.'.join(np_ver.split('.')[:2])
    vars_['CONDA_NPY'] = ''.join(np_ver.split('.')[:2])
    vars_['NPY_DISTUTILS_APPEND_FLAGS'] = '1'
    return vars_
Esempio n. 6
0
def write_pth(egg_path, config):
    fn = os.path.basename(egg_path)
    py_ver = '.'.join(config.variant['python'].split('.')[:2])
    with open(
            os.path.join(utils.get_site_packages(config.host_prefix, py_ver),
                         '%s.pth' % (fn.split('-')[0])), 'w') as fo:
        fo.write('./%s\n' % fn)
Esempio n. 7
0
def test_pypi_installer_metadata(testing_config):
    recipe = os.path.join(metadata_dir, '_pypi_installer_metadata')
    pkg = api.build(recipe, config=testing_config, notest=True)[0]
    expected_installer = '{}/imagesize-1.1.0.dist-info/INSTALLER'.format(
        get_site_packages('', '3.9'))
    assert 'conda' == (package_has_file(pkg,
                                        expected_installer,
                                        refresh_mode='forced'))
Esempio n. 8
0
def test_get_site_packages(testing_workdir):
    # https://github.com/conda/conda-build/issues/1055#issuecomment-250961576

    # crazy unreal python version that should show up in a second
    crazy_path = os.path.join(testing_workdir, 'lib', 'python8.2', 'site-packages')
    os.makedirs(crazy_path)
    site_packages = utils.get_site_packages(testing_workdir)
    assert site_packages == crazy_path
Esempio n. 9
0
def test_get_site_packages(testing_workdir):
    # https://github.com/conda/conda-build/issues/1055#issuecomment-250961576

    # crazy unreal python version that should show up in a second
    crazy_path = os.path.join(testing_workdir, 'lib', 'python8.2', 'site-packages')
    os.makedirs(crazy_path)
    site_packages = utils.get_site_packages(testing_workdir)
    assert site_packages == crazy_path
Esempio n. 10
0
def remove_easy_install_pth(files, prefix, config, preserve_egg_dir=False):
    """
    remove the need for easy-install.pth and finally remove easy-install.pth
    itself
    """
    absfiles = [os.path.join(prefix, f) for f in files]
    py_ver = '.'.join(config.variant['python'].split('.')[:2])
    sp_dir = utils.get_site_packages(prefix, py_ver)
    for egg_path in glob(os.path.join(sp_dir, '*-py*.egg')):
        if os.path.isdir(egg_path):
            if preserve_egg_dir or not any(
                    os.path.join(egg_path, i) in absfiles for i in walk_prefix(
                        egg_path, False, windows_forward_slashes=False)):
                write_pth(egg_path, config=config)
                continue

            print('found egg dir:', egg_path)
            try:
                os.rename(os.path.join(egg_path, 'EGG-INFO'),
                          egg_path + '-info')
            except OSError:
                pass
            utils.rm_rf(os.path.join(egg_path, 'EGG-INFO'))
            for fn in os.listdir(egg_path):
                if fn == '__pycache__':
                    utils.rm_rf(os.path.join(egg_path, fn))
                else:
                    # this might be a name-space package
                    # so the package directory already exists
                    # from another installed dependency
                    if os.path.exists(os.path.join(sp_dir, fn)):
                        try:
                            utils.copy_into(os.path.join(egg_path, fn),
                                            os.path.join(sp_dir, fn),
                                            config.timeout,
                                            locking=config.locking)
                            utils.rm_rf(os.path.join(egg_path, fn))
                        except IOError as e:
                            fn = os.path.basename(str(e).split()[-1])
                            raise IOError(
                                "Tried to merge folder {egg_path} into {sp_dir}, but {fn}"
                                " exists in both locations.  Please either add "
                                "build/preserve_egg_dir: True to meta.yaml, or manually "
                                "remove the file during your install process to avoid "
                                "this conflict.".format(egg_path=egg_path,
                                                        sp_dir=sp_dir,
                                                        fn=fn))
                    else:
                        os.rename(os.path.join(egg_path, fn),
                                  os.path.join(sp_dir, fn))

        elif os.path.isfile(egg_path):
            if egg_path not in absfiles:
                continue
            print('found egg:', egg_path)
            write_pth(egg_path, config=config)

    utils.rm_rf(os.path.join(sp_dir, 'easy-install.pth'))
Esempio n. 11
0
def reparse(metadata, index):
    """Some things need to be parsed again after the build environment has been created
    and activated."""
    metadata.final = False
    sys.path.insert(0, metadata.config.build_prefix)
    py_ver = '.'.join(metadata.config.variant['python'].split('.')[:2])
    sys.path.insert(0, utils.get_site_packages(metadata.config.build_prefix, py_ver))
    metadata.parse_until_resolved()
    metadata = finalize_metadata(metadata, index)
    return metadata
Esempio n. 12
0
def reparse(metadata):
    """Some things need to be parsed again after the build environment has been created
    and activated."""
    metadata.final = False
    sys.path.insert(0, metadata.config.build_prefix)
    sys.path.insert(0, metadata.config.host_prefix)
    py_ver = '.'.join(metadata.config.variant['python'].split('.')[:2])
    sys.path.insert(0, utils.get_site_packages(metadata.config.host_prefix, py_ver))
    metadata.parse_until_resolved()
    metadata = finalize_metadata(metadata)
    return metadata
Esempio n. 13
0
def remove_easy_install_pth(files, prefix, config, preserve_egg_dir=False):
    """
    remove the need for easy-install.pth and finally remove easy-install.pth
    itself
    """
    absfiles = [os.path.join(prefix, f) for f in files]
    py_ver = '.'.join(config.variant['python'].split('.')[:2])
    sp_dir = utils.get_site_packages(prefix, py_ver)
    for egg_path in glob(os.path.join(sp_dir, '*-py*.egg')):
        if os.path.isdir(egg_path):
            if preserve_egg_dir or not any(os.path.join(egg_path, i) in absfiles for i
                    in walk_prefix(egg_path, False, windows_forward_slashes=False)):
                write_pth(egg_path, config=config)
                continue

            print('found egg dir:', egg_path)
            try:
                os.rename(os.path.join(egg_path, 'EGG-INFO'),
                          egg_path + '-info')
            except OSError:
                pass
            utils.rm_rf(os.path.join(egg_path, 'EGG-INFO'))
            for fn in os.listdir(egg_path):
                if fn == '__pycache__':
                    utils.rm_rf(os.path.join(egg_path, fn))
                else:
                    # this might be a name-space package
                    # so the package directory already exists
                    # from another installed dependency
                    if os.path.exists(os.path.join(sp_dir, fn)):
                        try:
                            utils.copy_into(os.path.join(egg_path, fn),
                                            os.path.join(sp_dir, fn), config.timeout,
                                            locking=config.locking)
                            utils.rm_rf(os.path.join(egg_path, fn))
                        except IOError as e:
                            fn = os.path.basename(str(e).split()[-1])
                            raise IOError("Tried to merge folder {egg_path} into {sp_dir}, but {fn}"
                                          " exists in both locations.  Please either add "
                                          "build/preserve_egg_dir: True to meta.yaml, or manually "
                                          "remove the file during your install process to avoid "
                                          "this conflict."
                                          .format(egg_path=egg_path, sp_dir=sp_dir, fn=fn))
                    else:
                        os.rename(os.path.join(egg_path, fn), os.path.join(sp_dir, fn))

        elif os.path.isfile(egg_path):
            if egg_path not in absfiles:
                continue
            print('found egg:', egg_path)
            write_pth(egg_path, config=config)

    utils.rm_rf(os.path.join(sp_dir, 'easy-install.pth'))
Esempio n. 14
0
def execute(recipe_dirs,
            prefix=sys.prefix,
            no_pth_file=False,
            build_ext=False,
            clean=False,
            uninstall=False):

    if not isdir(prefix):
        sys.exit("""\
Error: environment does not exist: %s
#
# Use 'conda create' to create the environment first.
#""" % prefix)

    assert find_executable('python', prefix=prefix)

    # current environment's site-packages directory
    sp_dir = get_site_packages(
        prefix, '.'.join(
            (str(sys.version_info.major), str(sys.version_info.minor))))

    if type(recipe_dirs) == string_types:
        recipe_dirs = [recipe_dirs]

    for path in recipe_dirs:
        pkg_path = abspath(expanduser(path))

        if uninstall:
            # uninstall then exit - does not do any other operations
            _uninstall(sp_dir, pkg_path)
            return

        if clean or build_ext:
            setup_py = get_setup_py(pkg_path)
            if clean:
                _clean(setup_py)
                if not build_ext:
                    return

            # build extensions before adding to conda.pth
            if build_ext:
                _build_ext(setup_py)

        if not no_pth_file:
            write_to_conda_pth(sp_dir, pkg_path)

        # go through the source looking for compiled extensions and make sure
        # they use the conda environment for loading libraries at runtime
        relink_sharedobjects(pkg_path, prefix)
        print("completed operation for: " + pkg_path)
Esempio n. 15
0
def python_vars(config, prefix):
    py_ver = get_py_ver(config)
    d = {
        'PYTHON': config.python_bin(prefix),
        'PY3K': str(int(py_ver[0]) >= 3),
        'STDLIB_DIR': utils.get_stdlib_dir(prefix, py_ver),
        'SP_DIR': utils.get_site_packages(prefix, py_ver),
        'PY_VER': py_ver,
        'CONDA_PY': ''.join(py_ver.split('.')[:2]),
    }

    np_ver = config.variant.get('numpy', get_default_variants()[0]['numpy'])
    d['NPY_VER'] = '.'.join(np_ver.split('.')[:2])
    d['CONDA_NPY'] = ''.join(np_ver.split('.')[:2])
    return d
Esempio n. 16
0
def python_vars(config):
    d = {
        'PYTHON': config.build_python,
        'PY3K': str(config.PY3K),
        'STDLIB_DIR': utils.get_stdlib_dir(config.build_prefix),
        'SP_DIR': utils.get_site_packages(config.build_prefix),
        'PY_VER': get_py_ver(config),
        'CONDA_PY': str(config.CONDA_PY),
    }
    # Only define these variables if '--numpy=X.Y' was provided,
    # otherwise any attempt to use them should be an error.
    if get_npy_ver(config):
        d['NPY_VER'] = get_npy_ver(config)
        d['CONDA_NPY'] = str(config.CONDA_NPY)
    return d
Esempio n. 17
0
def python_vars(config):
    d = {
        'PYTHON': config.build_python,
        'PY3K': str(config.PY3K),
        'STDLIB_DIR': utils.get_stdlib_dir(config.build_prefix),
        'SP_DIR': utils.get_site_packages(config.build_prefix),
        'PY_VER': get_py_ver(config),
        'CONDA_PY': str(config.CONDA_PY),
    }
    # Only define these variables if '--numpy=X.Y' was provided,
    # otherwise any attempt to use them should be an error.
    if get_npy_ver(config):
        d['NPY_VER'] = get_npy_ver(config)
        d['CONDA_NPY'] = str(config.CONDA_NPY)
    return d
Esempio n. 18
0
def python_vars(config):
    d = {
        "PYTHON": config.build_python,
        "PY3K": str(config.PY3K),
        "STDLIB_DIR": utils.get_stdlib_dir(config.build_prefix),
        "SP_DIR": utils.get_site_packages(config.build_prefix),
        "PY_VER": get_py_ver(config),
        "CONDA_PY": str(config.CONDA_PY),
    }
    # Only define these variables if '--numpy=X.Y' was provided,
    # otherwise any attempt to use them should be an error.
    if get_npy_ver(config):
        d["NPY_VER"] = get_npy_ver(config)
        d["CONDA_NPY"] = str(config.CONDA_NPY)
    return d
Esempio n. 19
0
def execute(recipe_dirs, prefix=sys.prefix, no_pth_file=False,
            build_ext=False, clean=False, uninstall=False):

    if not isdir(prefix):
        sys.exit("""\
Error: environment does not exist: %s
#
# Use 'conda create' to create the environment first.
#""" % prefix)

    assert find_executable('python', prefix=prefix)

    # current environment's site-packages directory
    sp_dir = get_site_packages(prefix, '.'.join((str(sys.version_info.major),
                                                 str(sys.version_info.minor))))

    if type(recipe_dirs) == string_types:
        recipe_dirs = [recipe_dirs]

    for path in recipe_dirs:
        pkg_path = abspath(expanduser(path))

        if uninstall:
            # uninstall then exit - does not do any other operations
            _uninstall(sp_dir, pkg_path)
            return

        if clean or build_ext:
            setup_py = get_setup_py(pkg_path)
            if clean:
                _clean(setup_py)
                if not build_ext:
                    return

            # build extensions before adding to conda.pth
            if build_ext:
                _build_ext(setup_py)

        if not no_pth_file:
            write_to_conda_pth(sp_dir, pkg_path)

        # go through the source looking for compiled extensions and make sure
        # they use the conda environment for loading libraries at runtime
        relink_sharedobjects(pkg_path, prefix)
        print("completed operation for: " + pkg_path)
Esempio n. 20
0
def python_vars(config, prefix):
    py_ver = get_py_ver(config)
    vars_ = {
        'CONDA_PY': ''.join(py_ver.split('.')[:2]),
        'PY3K': str(int(int(py_ver[0]) >= 3)),
        'PY_VER': py_ver,
        'STDLIB_DIR': utils.get_stdlib_dir(prefix, py_ver),
        'SP_DIR': utils.get_site_packages(prefix, py_ver),
    }
    if os.path.isfile(config.python_bin(prefix)):
        vars_.update({
            'PYTHON': config.python_bin(prefix),
        })

    np_ver = config.variant.get('numpy', get_default_variant(config)['numpy'])
    vars_['NPY_VER'] = '.'.join(np_ver.split('.')[:2])
    vars_['CONDA_NPY'] = ''.join(np_ver.split('.')[:2])
    return vars_
Esempio n. 21
0
def python_vars(config, prefix):
    py_ver = get_py_ver(config)
    vars_ = {
            'CONDA_PY': ''.join(py_ver.split('.')[:2]),
            'PY3K': str(int(py_ver[0]) >= 3),
            'PY_VER': py_ver,
            'STDLIB_DIR': utils.get_stdlib_dir(prefix, py_ver),
            'SP_DIR': utils.get_site_packages(prefix, py_ver),
            }
    if os.path.isfile(config.python_bin(prefix)):
        vars_.update({
            'PYTHON': config.python_bin(prefix),
        })

    np_ver = config.variant.get('numpy', get_default_variants()[0]['numpy'])
    vars_['NPY_VER'] = '.'.join(np_ver.split('.')[:2])
    vars_['CONDA_NPY'] = ''.join(np_ver.split('.')[:2])
    return vars_
Esempio n. 22
0
def remove_easy_install_pth(files, prefix, config, preserve_egg_dir=False):
    """
    remove the need for easy-install.pth and finally remove easy-install.pth
    itself
    """
    absfiles = [join(prefix, f) for f in files]
    sp_dir = utils.get_site_packages(prefix)
    for egg_path in glob(join(sp_dir, '*-py*.egg')):
        if isdir(egg_path):
            if preserve_egg_dir or not any(
                    join(egg_path, i) in absfiles for i in walk_prefix(
                        egg_path, False, windows_forward_slashes=False)):
                write_pth(egg_path, config=config)
                continue

            print('found egg dir:', egg_path)
            try:
                os.rename(join(egg_path, 'EGG-INFO'), egg_path + '-info')
            except OSError:
                pass
            utils.rm_rf(join(egg_path, 'EGG-INFO'))
            for fn in os.listdir(egg_path):
                if fn == '__pycache__':
                    utils.rm_rf(join(egg_path, fn))
                else:
                    # this might be a name-space package
                    # so the package directory already exists
                    # from another installed dependency
                    if os.path.exists(join(sp_dir, fn)):
                        utils.copy_into(join(egg_path, fn), join(sp_dir, fn),
                                        config.timeout)
                        utils.rm_rf(join(egg_path, fn))
                    else:
                        os.rename(join(egg_path, fn), join(sp_dir, fn))

        elif isfile(egg_path):
            if egg_path not in absfiles:
                continue
            print('found egg:', egg_path)
            write_pth(egg_path, config=config)

    utils.rm_rf(join(sp_dir, 'easy-install.pth'))
Esempio n. 23
0
def remove_easy_install_pth(files, prefix, config, preserve_egg_dir=False):
    """
    remove the need for easy-install.pth and finally remove easy-install.pth
    itself
    """
    absfiles = [join(prefix, f) for f in files]
    sp_dir = utils.get_site_packages(prefix)
    for egg_path in glob(join(sp_dir, '*-py*.egg')):
        if isdir(egg_path):
            if preserve_egg_dir or not any(join(egg_path, i) in absfiles for i
                    in walk_prefix(egg_path, False, windows_forward_slashes=False)):
                write_pth(egg_path, config=config)
                continue

            print('found egg dir:', egg_path)
            try:
                os.rename(join(egg_path, 'EGG-INFO'),
                          egg_path + '-info')
            except OSError:
                pass
            utils.rm_rf(join(egg_path, 'EGG-INFO'))
            for fn in os.listdir(egg_path):
                if fn == '__pycache__':
                    utils.rm_rf(join(egg_path, fn))
                else:
                    # this might be a name-space package
                    # so the package directory already exists
                    # from another installed dependency
                    if os.path.exists(join(sp_dir, fn)):
                        utils.copy_into(join(egg_path, fn), join(sp_dir, fn), config.timeout)
                        utils.rm_rf(join(egg_path, fn))
                    else:
                        os.rename(join(egg_path, fn), join(sp_dir, fn))

        elif isfile(egg_path):
            if egg_path not in absfiles:
                continue
            print('found egg:', egg_path)
            write_pth(egg_path, config=config)

    utils.rm_rf(join(sp_dir, 'easy-install.pth'))
Esempio n. 24
0
def python_vars(metadata, prefix):
    py_ver = get_py_ver(metadata.config)
    vars_ = {
            'CONDA_PY': ''.join(py_ver.split('.')[:2]),
            'PY3K': str(int(int(py_ver[0]) >= 3)),
            'PY_VER': py_ver,
            'STDLIB_DIR': utils.get_stdlib_dir(prefix, py_ver),
            'SP_DIR': utils.get_site_packages(prefix, py_ver),
            }
    build_or_host = 'host' if metadata.is_cross else 'build'
    deps = [str(ms.name) for ms in metadata.ms_depends(build_or_host)]
    if 'python' in deps:
        vars_.update({
            # host prefix is always fine, because it is the same as build when is_cross is False
            'PYTHON': metadata.config.python_bin(prefix, metadata.config.host_subdir),
        })

    np_ver = metadata.config.variant.get('numpy', get_default_variant(metadata.config)['numpy'])
    vars_['NPY_VER'] = '.'.join(np_ver.split('.')[:2])
    vars_['CONDA_NPY'] = ''.join(np_ver.split('.')[:2])
    return vars_
Esempio n. 25
0
def test_get_site_packages():
    # https://github.com/conda/conda-build/issues/1055#issuecomment-250961576
    # crazy unreal python version that should show up in a second
    crazy_path = os.path.join('/dummy', 'lib', 'python8.2', 'site-packages')
    site_packages = utils.get_site_packages('/dummy', '8.2')
    assert site_packages == crazy_path
Esempio n. 26
0
def write_pth(egg_path, config):
    fn = os.path.basename(egg_path)
    py_ver = '.'.join(config.variant['python'].split('.')[:2])
    with open(os.path.join(utils.get_site_packages(config.host_prefix, py_ver),
                           '%s.pth' % (fn.split('-')[0])), 'w') as fo:
        fo.write('./%s\n' % fn)
Esempio n. 27
0
def reparse(metadata, config):
    """Some things need to be parsed again after the build environment has been created
    and activated."""
    sys.path.insert(0, config.build_prefix)
    sys.path.insert(0, utils.get_site_packages(config.build_prefix))
    metadata.parse_again(config=config, permit_undefined_jinja=False)
Esempio n. 28
0
def test_get_site_packages():
    # https://github.com/conda/conda-build/issues/1055#issuecomment-250961576
    # crazy unreal python version that should show up in a second
    crazy_path = os.path.join('/dummy', 'lib', 'python8.2', 'site-packages')
    site_packages = utils.get_site_packages('/dummy', '8.2')
    assert site_packages == crazy_path
Esempio n. 29
0
def test_pypi_installer_metadata(testing_config):
    recipe = os.path.join(metadata_dir, '_pypi_installer_metadata')
    pkg = api.build(recipe, config=testing_config, notest=True)[0]
    expected_installer = '{}/imagesize-1.1.0.dist-info/INSTALLER'.format(get_site_packages('', 3.7))
    assert 'conda' == (package_has_file(pkg, expected_installer).decode('utf-8'))
Esempio n. 30
0
def write_pth(egg_path, config):
    fn = basename(egg_path)
    with open(join(utils.get_site_packages(config.build_prefix),
                   '%s.pth' % (fn.split('-')[0])), 'w') as fo:
        fo.write('./%s\n' % fn)
Esempio n. 31
0
def reparse(metadata, config):
    """Some things need to be parsed again after the build environment has been created
    and activated."""
    sys.path.insert(0, config.build_prefix)
    sys.path.insert(0, utils.get_site_packages(config.build_prefix))
    metadata.parse_again(config=config, permit_undefined_jinja=False)
Esempio n. 32
0
def write_pth(egg_path, config):
    fn = basename(egg_path)
    with open(
            join(utils.get_site_packages(config.build_prefix),
                 '%s.pth' % (fn.split('-')[0])), 'w') as fo:
        fo.write('./%s\n' % fn)