(
name,
version,
download_dir,
platform,
channel_urls=(),
channels_remap=(),
specs=(),
exclude=(),
menu_packages=None,
environment=None,
environment_file=None,
verbose=True,
conda_exe="conda.exe",
extra_env=False,
input_dir="",
base_needs_python=True,
)
| 260 | |
| 261 | |
| 262 | def _solve_precs( |
| 263 | name, |
| 264 | version, |
| 265 | download_dir, |
| 266 | platform, |
| 267 | channel_urls=(), |
| 268 | channels_remap=(), |
| 269 | specs=(), |
| 270 | exclude=(), |
| 271 | menu_packages=None, |
| 272 | environment=None, |
| 273 | environment_file=None, |
| 274 | verbose=True, |
| 275 | conda_exe="conda.exe", |
| 276 | extra_env=False, |
| 277 | input_dir="", |
| 278 | base_needs_python=True, |
| 279 | ): |
| 280 | if not extra_env and base_needs_python: |
| 281 | specs = (*specs, "python") |
| 282 | if environment: |
| 283 | logger.debug("specs: <from existing environment '%s'>", environment) |
| 284 | elif environment_file: |
| 285 | logger.debug("specs: <from environment file '%s'>", environment_file) |
| 286 | else: |
| 287 | logger.debug("specs: %s", specs) |
| 288 | |
| 289 | # Append channels_remap srcs to channel_urls |
| 290 | channel_urls = (*channel_urls, *(x["src"] for x in channels_remap)) |
| 291 | |
| 292 | if environment_file or environment: |
| 293 | # set conda to be the user's conda (what is in the environment) |
| 294 | # for purpose of getting & building environments, rather |
| 295 | # than the standalone conda (conda_exe). Fallback to the |
| 296 | # standalone, if needed |
| 297 | user_conda = os.environ.get("CONDA_EXE", "") |
| 298 | if not user_conda: |
| 299 | if cc_platform == platform: |
| 300 | # We can use the standalone conda for native platforms if there is no |
| 301 | # conda to be installed in the environment. |
| 302 | user_conda = conda_exe |
| 303 | else: |
| 304 | # We need a conda for the native platform in order to do environment |
| 305 | # based installations. |
| 306 | sys.exit("CONDA_EXE env variable is empty. Need to activate a conda env.") |
| 307 | # make the environment, if needed |
| 308 | if environment_file: |
| 309 | environment = tempfile.mkdtemp() |
| 310 | new_env = os.environ.copy() |
| 311 | new_env["CONDA_SUBDIR"] = platform |
| 312 | # use conda env for yaml, and standard conda create otherwise |
| 313 | subcommand = ( |
| 314 | ["env", "create"] |
| 315 | if environment_file.endswith((".yml", ".yaml")) |
| 316 | else ["create", "--yes"] |
| 317 | ) |
| 318 | if channel_urls: |
| 319 | logger.warning( |
no test coverage detected