(
prefix: Prefix,
version: str,
additional_dependencies: Sequence[str],
)
| 128 | |
| 129 | |
| 130 | def install_environment( |
| 131 | prefix: Prefix, |
| 132 | version: str, |
| 133 | additional_dependencies: Sequence[str], |
| 134 | ) -> None: |
| 135 | env_dir = lang_base.environment_dir(prefix, ENVIRONMENT_DIR, version) |
| 136 | |
| 137 | if version != 'system': |
| 138 | _install_go(version, env_dir) |
| 139 | |
| 140 | if sys.platform == 'cygwin': # pragma: no cover |
| 141 | gopath = cmd_output('cygpath', '-w', env_dir)[1].strip() |
| 142 | else: |
| 143 | gopath = env_dir |
| 144 | |
| 145 | env = no_git_env(dict(os.environ, GOPATH=gopath)) |
| 146 | env.pop('GOBIN', None) |
| 147 | if version != 'system': |
| 148 | env['GOTOOLCHAIN'] = 'local' |
| 149 | env['GOROOT'] = os.path.join(env_dir, '.go') |
| 150 | env['PATH'] = os.pathsep.join(( |
| 151 | os.path.join(env_dir, '.go', 'bin'), os.environ['PATH'], |
| 152 | )) |
| 153 | |
| 154 | lang_base.setup_cmd(prefix, ('go', 'install', './...'), env=env) |
| 155 | for dependency in additional_dependencies: |
| 156 | lang_base.setup_cmd(prefix, ('go', 'install', dependency), env=env) |
| 157 | |
| 158 | # save some disk space -- we don't need this after installation |
| 159 | pkgdir = os.path.join(env_dir, 'pkg') |
| 160 | if os.path.exists(pkgdir): # pragma: no branch (always true on windows?) |
| 161 | rmtree(pkgdir) |
nothing calls this directly
no test coverage detected