Пример #1
0
def install_environment(
    prefix: Prefix,
    version: str,
    additional_dependencies: Sequence[str],
) -> None:
    additional_dependencies = tuple(additional_dependencies)
    directory = helpers.environment_dir(ENVIRONMENT_DIR, version)
    with clean_path_on_failure(prefix.path(directory)):
        if version != 'system':  # pragma: win32 no cover
            _install_rbenv(prefix, version)
            with in_env(prefix, version):
                # Need to call this before installing so rbenv's directories
                # are set up
                helpers.run_setup_cmd(prefix, ('rbenv', 'init', '-'))
                # XXX: this will *always* fail if `version == C.DEFAULT`
                _install_ruby(prefix, version)
                # Need to call this after installing to set up the shims
                helpers.run_setup_cmd(prefix, ('rbenv', 'rehash'))

        with in_env(prefix, version):
            helpers.run_setup_cmd(
                prefix,
                ('gem', 'build', *prefix.star('.gemspec')),
            )
            helpers.run_setup_cmd(
                prefix,
                (
                    'gem',
                    'install',
                    '--no-document',
                    '--no-format-executable',
                    *prefix.star('.gem'),
                    *additional_dependencies,
                ),
            )
Пример #2
0
def install_environment(
    prefix: Prefix,
    version: str,
    additional_dependencies: Sequence[str],
) -> None:
    additional_dependencies = tuple(additional_dependencies)
    directory = helpers.environment_dir(ENVIRONMENT_DIR, version)
    with clean_path_on_failure(prefix.path(directory)):
        if version != "system":  # pragma: win32 no cover
            _install_rbenv(prefix, version)
            with in_env(prefix, version):
                # Need to call this before installing so rbenv's directories
                # are set up
                helpers.run_setup_cmd(prefix, ("rbenv", "init", "-"))
                # XXX: this will *always* fail if `version == C.DEFAULT`
                _install_ruby(prefix, version)
                # Need to call this after installing to set up the shims
                helpers.run_setup_cmd(prefix, ("rbenv", "rehash"))

        with in_env(prefix, version):
            helpers.run_setup_cmd(
                prefix,
                ("gem", "build", *prefix.star(".gemspec")),
            )
            helpers.run_setup_cmd(
                prefix,
                (
                    "gem",
                    "install",
                    "--no-document",
                    *prefix.star(".gem"),
                    *additional_dependencies,
                ),
            )
Пример #3
0
def install_environment(
        prefix: Prefix, version: str, additional_dependencies: Sequence[str],
) -> None:  # pragma: win32 no cover
    additional_dependencies = tuple(additional_dependencies)
    directory = helpers.environment_dir(ENVIRONMENT_DIR, version)
    with clean_path_on_failure(prefix.path(directory)):
        # TODO: this currently will fail if there's no version specified and
        # there's no system ruby installed.  Is this ok?
        _install_rbenv(prefix, version=version)
        with in_env(prefix, version):
            # Need to call this before installing so rbenv's directories are
            # set up
            helpers.run_setup_cmd(prefix, ('rbenv', 'init', '-'))
            if version != C.DEFAULT:
                _install_ruby(prefix, version)
            # Need to call this after installing to set up the shims
            helpers.run_setup_cmd(prefix, ('rbenv', 'rehash'))
            helpers.run_setup_cmd(
                prefix, ('gem', 'build', *prefix.star('.gemspec')),
            )
            helpers.run_setup_cmd(
                prefix,
                (
                    'gem', 'install', '--no-document',
                    *prefix.star('.gem'), *additional_dependencies,
                ),
            )
Пример #4
0
def install_environment(
    prefix: Prefix,
    version: str,
    additional_dependencies: Sequence[str],
) -> None:  # pragma: win32 no cover
    helpers.assert_version_default('lua', version)

    envdir = _envdir(prefix)
    with clean_path_on_failure(envdir):
        with in_env(prefix):
            # luarocks doesn't bootstrap a tree prior to installing
            # so ensure the directory exists.
            os.makedirs(envdir, exist_ok=True)

            # Older luarocks (e.g., 2.4.2) expect the rockspec as an arg
            for rockspec in prefix.star('.rockspec'):
                make_cmd = ('luarocks', '--tree', envdir, 'make', rockspec)
                helpers.run_setup_cmd(prefix, make_cmd)

            # luarocks can't install multiple packages at once
            # so install them individually.
            for dependency in additional_dependencies:
                cmd = ('luarocks', '--tree', envdir, 'install', dependency)
                helpers.run_setup_cmd(prefix, cmd)