Make rerender compatible with conda-lock>=1.3
This commit is contained in:
parent
0a8b8962a6
commit
9dbdabf5da
|
@ -1,4 +1,5 @@
|
||||||
name: radioconda
|
name: radioconda
|
||||||
|
category: main
|
||||||
channels:
|
channels:
|
||||||
- conda-forge
|
- conda-forge
|
||||||
- ryanvolz
|
- ryanvolz
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
name: radioconda_installer
|
name: radioconda_installer
|
||||||
|
category: installer
|
||||||
channels:
|
channels:
|
||||||
- conda-forge
|
- conda-forge
|
||||||
- ryanvolz # [win]
|
- ryanvolz
|
||||||
dependencies:
|
dependencies:
|
||||||
- mamba
|
- mamba
|
||||||
- radioconda_console_shortcut # [win]
|
- radioconda_console_shortcut # [win]
|
||||||
|
|
461
rerender.py
461
rerender.py
|
@ -1,56 +1,34 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import pathlib
|
import pathlib
|
||||||
import shutil
|
import shutil
|
||||||
from typing import List, Optional
|
from typing import Any, Dict, Optional
|
||||||
|
|
||||||
import conda_lock
|
import conda_lock
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
def name_from_pkg_spec(spec: str):
|
def name_from_pkg_spec(spec: str):
|
||||||
return spec.split(sep=None, maxsplit=1)[0].split(sep="=", maxsplit=1)[0]
|
return (
|
||||||
|
spec.split(sep=None, maxsplit=1)[0]
|
||||||
|
.split(sep="=", maxsplit=1)[0]
|
||||||
def lock_env_spec(
|
.split(sep="::", maxsplit=1)[-1]
|
||||||
lock_spec: conda_lock.src_parser.LockSpecification, conda_exe: str
|
|
||||||
) -> conda_lock.src_parser.LockSpecification:
|
|
||||||
create_env_dict = conda_lock.conda_lock.solve_specs_for_arch(
|
|
||||||
conda=conda_exe,
|
|
||||||
channels=lock_spec.channels,
|
|
||||||
specs=lock_spec.specs,
|
|
||||||
platform=lock_spec.platform,
|
|
||||||
)
|
)
|
||||||
pkgs = create_env_dict["actions"]["LINK"]
|
|
||||||
locked_specs = ["{name}={version}={build_string}".format(**pkg) for pkg in pkgs]
|
|
||||||
|
|
||||||
locked_env_spec = conda_lock.src_parser.LockSpecification(
|
|
||||||
specs=sorted(locked_specs),
|
|
||||||
channels=lock_spec.channels,
|
|
||||||
platform=lock_spec.platform,
|
|
||||||
virtual_package_repo=conda_lock.virtual_package.default_virtual_package_repodata(),
|
|
||||||
)
|
|
||||||
|
|
||||||
return locked_env_spec
|
|
||||||
|
|
||||||
|
|
||||||
def write_env_file(
|
def write_env_file(
|
||||||
env_spec: conda_lock.src_parser.LockSpecification,
|
env_dict: Dict[str, Any],
|
||||||
file_path: pathlib.Path,
|
file_path: pathlib.Path,
|
||||||
name: Optional[str] = None,
|
name: Optional[str] = None,
|
||||||
version: Optional[str] = None,
|
version: Optional[str] = None,
|
||||||
|
platform: Optional[str] = None,
|
||||||
variables: Optional[dict] = None,
|
variables: Optional[dict] = None,
|
||||||
):
|
):
|
||||||
env_dict = dict(
|
|
||||||
name=name,
|
|
||||||
version=version,
|
|
||||||
platform=env_spec.platform,
|
|
||||||
channels=env_spec.channels,
|
|
||||||
dependencies=env_spec.specs,
|
|
||||||
)
|
|
||||||
if name:
|
if name:
|
||||||
env_dict["name"] = name
|
env_dict["name"] = name
|
||||||
if version:
|
if version:
|
||||||
env_dict["version"] = version
|
env_dict["version"] = version
|
||||||
|
if platform:
|
||||||
|
env_dict["platform"] = platform
|
||||||
if variables:
|
if variables:
|
||||||
env_dict["variables"] = variables
|
env_dict["variables"] = variables
|
||||||
with file_path.open("w") as f:
|
with file_path.open("w") as f:
|
||||||
|
@ -59,142 +37,37 @@ def write_env_file(
|
||||||
return env_dict
|
return env_dict
|
||||||
|
|
||||||
|
|
||||||
def write_lock_file(
|
def render_metapackage_environments(
|
||||||
lock_spec: conda_lock.src_parser.LockSpecification,
|
lockfile_path: pathlib.Path,
|
||||||
file_path: pathlib.Path,
|
requested_pkg_names: Dict[str, Any],
|
||||||
conda_exe: str,
|
|
||||||
):
|
|
||||||
lockfile_contents = conda_lock.conda_lock.create_lockfile_from_spec(
|
|
||||||
conda=conda_exe, spec=lock_spec, kind="explicit"
|
|
||||||
)
|
|
||||||
|
|
||||||
def sanitize_lockfile_line(line):
|
|
||||||
line = line.strip()
|
|
||||||
if line == "":
|
|
||||||
return "#"
|
|
||||||
else:
|
|
||||||
return line
|
|
||||||
|
|
||||||
lockfile_contents = [sanitize_lockfile_line(ln) for ln in lockfile_contents]
|
|
||||||
|
|
||||||
with file_path.open("w") as f:
|
|
||||||
f.write("\n".join(lockfile_contents) + "\n")
|
|
||||||
|
|
||||||
return lockfile_contents
|
|
||||||
|
|
||||||
|
|
||||||
def render_constructor(
|
|
||||||
lock_spec: conda_lock.src_parser.LockSpecification,
|
|
||||||
name: str,
|
name: str,
|
||||||
version: str,
|
version: str,
|
||||||
company: str,
|
|
||||||
license_file: pathlib.Path,
|
|
||||||
output_dir: pathlib.Path,
|
output_dir: pathlib.Path,
|
||||||
) -> dict:
|
) -> None:
|
||||||
platform = lock_spec.platform
|
lock_content = conda_lock.conda_lock.parse_conda_lock_file(lockfile_path)
|
||||||
constructor_name = f"{name}-{platform}"
|
lock_work_dir = lockfile_path.parent
|
||||||
|
|
||||||
construct_dict = dict(
|
# render main env spec into environment file for creating metapackage
|
||||||
name=name,
|
conda_lock.conda_lock.do_render(
|
||||||
version=version,
|
lockfile=lock_content,
|
||||||
company=company,
|
kinds=("env",),
|
||||||
condarc=dict(
|
filename_template=f"{lock_work_dir}/{name}-{{platform}}.metapackage",
|
||||||
channels=lock_spec.channels,
|
|
||||||
channel_priority="strict",
|
|
||||||
),
|
|
||||||
channels=lock_spec.channels,
|
|
||||||
specs=lock_spec.specs,
|
|
||||||
initialize_by_default=False if platform.startswith("win") else True,
|
|
||||||
installer_type="all",
|
|
||||||
keep_pkgs=True,
|
|
||||||
license_file="LICENSE",
|
|
||||||
register_python_default=False,
|
|
||||||
write_condarc=True,
|
|
||||||
)
|
)
|
||||||
if platform.startswith("win"):
|
# process and save rendered platform env files to the output directory
|
||||||
construct_dict["post_install"] = "post_install.bat"
|
for platform_env_yaml_path in lock_work_dir.glob("*.metapackage.yml"):
|
||||||
# point to template that we generate at build time with a patch over default
|
platform_env_yaml_name = platform_env_yaml_path.name.partition(".")[0]
|
||||||
construct_dict["nsis_template"] = "main.nsi.tmpl"
|
platform = platform_env_yaml_name.split(sep="-", maxsplit=1)[1]
|
||||||
else:
|
|
||||||
construct_dict["post_install"] = "post_install.sh"
|
|
||||||
|
|
||||||
constructor_dir = output_dir / constructor_name
|
with platform_env_yaml_path.open("r") as f:
|
||||||
if constructor_dir.exists():
|
platform_env_dict = yaml.safe_load(f)
|
||||||
shutil.rmtree(constructor_dir)
|
|
||||||
constructor_dir.mkdir(parents=True)
|
|
||||||
|
|
||||||
# copy license to the constructor directory
|
dependencies = sorted(platform_env_dict["dependencies"])
|
||||||
shutil.copy(license_file, constructor_dir / "LICENSE")
|
# filter the dependency list by the explicitly listed package names
|
||||||
|
platform_env_dict["dependencies"] = [
|
||||||
# write the post_install scripts referenced in the construct dict
|
spec
|
||||||
if platform.startswith("win"):
|
for spec in dependencies
|
||||||
with (constructor_dir / "post_install.bat").open("w") as f:
|
if name_from_pkg_spec(spec) in requested_pkg_names
|
||||||
f.write(
|
]
|
||||||
"\n".join(
|
|
||||||
(
|
|
||||||
r'echo {"env_vars": {"GR_PREFIX": "", "GRC_BLOCKS_PATH": "", "UHD_PKG_PATH": "", "VOLK_PREFIX": ""}}>%PREFIX%\conda-meta\state',
|
|
||||||
r"del /q %PREFIX%\pkgs\*.tar.bz2",
|
|
||||||
"exit 0",
|
|
||||||
"",
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
with (constructor_dir / "post_install.sh").open("w") as f:
|
|
||||||
f.write(
|
|
||||||
"\n".join(
|
|
||||||
(
|
|
||||||
"#!/bin/sh",
|
|
||||||
f'PREFIX="${{PREFIX:-$2/{name}}}"',
|
|
||||||
r"rm -f $PREFIX/pkgs/*.tar.bz2",
|
|
||||||
"exit 0",
|
|
||||||
"",
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
construct_yaml_path = constructor_dir / "construct.yaml"
|
|
||||||
with construct_yaml_path.open("w") as f:
|
|
||||||
yaml.safe_dump(construct_dict, stream=f)
|
|
||||||
|
|
||||||
return construct_dict
|
|
||||||
|
|
||||||
|
|
||||||
def render_platforms(
|
|
||||||
environment_file: pathlib.Path,
|
|
||||||
installer_environment_file: pathlib.Path,
|
|
||||||
version: str,
|
|
||||||
company: str,
|
|
||||||
license_file: pathlib.Path,
|
|
||||||
output_dir: pathlib.Path,
|
|
||||||
conda_exe: str,
|
|
||||||
) -> dict:
|
|
||||||
with environment_file.open("r") as f:
|
|
||||||
env_yaml_data = yaml.safe_load(f)
|
|
||||||
|
|
||||||
env_name = env_yaml_data["name"]
|
|
||||||
platforms = env_yaml_data["platforms"]
|
|
||||||
|
|
||||||
if not license_file.exists():
|
|
||||||
raise ValueError(f"Cannot find license file: {license_file}")
|
|
||||||
|
|
||||||
if output_dir.exists():
|
|
||||||
shutil.rmtree(output_dir)
|
|
||||||
output_dir.mkdir(parents=True)
|
|
||||||
|
|
||||||
rendered_platforms = {}
|
|
||||||
|
|
||||||
for platform in platforms:
|
|
||||||
output_name = f"{env_name}-{platform}"
|
|
||||||
|
|
||||||
# get the environment specification for the list of packages from the env file
|
|
||||||
env_spec = conda_lock.conda_lock.parse_environment_file(
|
|
||||||
environment_file=environment_file, platform=platform
|
|
||||||
)
|
|
||||||
env_pkg_names = [name_from_pkg_spec(spec) for spec in env_spec.specs]
|
|
||||||
|
|
||||||
# lock the full environment specification to specific versions and builds
|
|
||||||
locked_env_spec = lock_env_spec(env_spec, conda_exe)
|
|
||||||
|
|
||||||
if platform.startswith("win"):
|
if platform.startswith("win"):
|
||||||
variables = dict(
|
variables = dict(
|
||||||
|
@ -202,87 +75,192 @@ def render_platforms(
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
variables = None
|
variables = None
|
||||||
|
write_env_file(
|
||||||
# write the full environment specification to a lock file (to install from file)
|
env_dict=platform_env_dict,
|
||||||
lockfile_contents = write_lock_file(
|
file_path=output_dir / f"{platform_env_yaml_name}.yml",
|
||||||
lock_spec=locked_env_spec,
|
name=name,
|
||||||
file_path=output_dir / f"{output_name}.lock",
|
|
||||||
conda_exe=conda_exe,
|
|
||||||
)
|
|
||||||
|
|
||||||
# filter the full package spec by the explicitly listed package names
|
|
||||||
metapackage_pkg_specs = [
|
|
||||||
spec
|
|
||||||
for spec in locked_env_spec.specs
|
|
||||||
if name_from_pkg_spec(spec) in env_pkg_names
|
|
||||||
]
|
|
||||||
metapackage_spec = conda_lock.src_parser.LockSpecification(
|
|
||||||
specs=metapackage_pkg_specs,
|
|
||||||
channels=locked_env_spec.channels,
|
|
||||||
platform=locked_env_spec.platform,
|
|
||||||
)
|
|
||||||
|
|
||||||
# write the filtered environment spec to a yaml file (to build metapackage)
|
|
||||||
locked_env_dict = write_env_file(
|
|
||||||
env_spec=metapackage_spec,
|
|
||||||
file_path=output_dir / f"{output_name}.yml",
|
|
||||||
name=env_name,
|
|
||||||
version=version,
|
version=version,
|
||||||
|
platform=platform,
|
||||||
variables=variables,
|
variables=variables,
|
||||||
)
|
)
|
||||||
|
|
||||||
# add installer-only (base environment) packages and lock those too
|
|
||||||
installer_pkg_spec = conda_lock.conda_lock.parse_environment_file(
|
|
||||||
environment_file=installer_environment_file, platform=platform
|
|
||||||
)
|
|
||||||
installer_spec = conda_lock.src_parser.LockSpecification(
|
|
||||||
specs=sorted(locked_env_spec.specs + installer_pkg_spec.specs),
|
|
||||||
channels=sorted(
|
|
||||||
set(locked_env_spec.channels) | set(installer_pkg_spec.channels)
|
|
||||||
),
|
|
||||||
platform=locked_env_spec.platform,
|
|
||||||
)
|
|
||||||
locked_installer_spec = lock_env_spec(installer_spec, conda_exe)
|
|
||||||
|
|
||||||
# get a set of only the packages to put in the constructor specification
|
def render_constructors(
|
||||||
# taken from the installer-only list and those explicitly selected originally
|
lockfile_path: pathlib.Path,
|
||||||
constructor_pkg_names = set(
|
requested_pkg_names: Dict[str, Any],
|
||||||
name_from_pkg_spec(spec)
|
name: str,
|
||||||
for spec in env_spec.specs + installer_pkg_spec.specs
|
version: str,
|
||||||
)
|
company: str,
|
||||||
|
license_file: pathlib.Path,
|
||||||
|
output_dir: pathlib.Path,
|
||||||
|
) -> None:
|
||||||
|
lock_content = conda_lock.conda_lock.parse_conda_lock_file(lockfile_path)
|
||||||
|
lock_work_dir = lockfile_path.parent
|
||||||
|
|
||||||
# filter the installer spec by the constructor package names
|
# render main + installer env specs into environment file for creating installer
|
||||||
constructor_pkg_specs = [
|
conda_lock.conda_lock.do_render(
|
||||||
spec
|
lockfile=lock_content,
|
||||||
for spec in locked_installer_spec.specs
|
kinds=("env",),
|
||||||
if name_from_pkg_spec(spec) in constructor_pkg_names
|
filename_template=f"{lock_work_dir}/{name}-{{platform}}.constructor",
|
||||||
|
extras=("installer",),
|
||||||
|
)
|
||||||
|
|
||||||
|
for platform_env_yaml_path in lock_work_dir.glob("*.constructor.yml"):
|
||||||
|
constructor_name = platform_env_yaml_path.name.partition(".")[0]
|
||||||
|
platform = constructor_name.split(sep="-", maxsplit=1)[1]
|
||||||
|
|
||||||
|
with platform_env_yaml_path.open("r") as f:
|
||||||
|
platform_env_dict = yaml.safe_load(f)
|
||||||
|
|
||||||
|
# filter requested_pkg_names by locked environment to account for selectors
|
||||||
|
platform_env_pkg_names = [
|
||||||
|
name_from_pkg_spec(spec) for spec in platform_env_dict["dependencies"]
|
||||||
|
]
|
||||||
|
user_requested_specs = [
|
||||||
|
name for name in requested_pkg_names if name in platform_env_pkg_names
|
||||||
]
|
]
|
||||||
constructor_spec = conda_lock.src_parser.LockSpecification(
|
|
||||||
specs=constructor_pkg_specs,
|
|
||||||
channels=locked_installer_spec.channels,
|
|
||||||
platform=locked_installer_spec.platform,
|
|
||||||
)
|
|
||||||
|
|
||||||
# create the rendered constructor directory
|
construct_dict = dict(
|
||||||
constructor_dict = render_constructor(
|
name=name,
|
||||||
lock_spec=constructor_spec,
|
|
||||||
name=env_name,
|
|
||||||
version=version,
|
version=version,
|
||||||
company=company,
|
company=company,
|
||||||
license_file=license_file,
|
channels=platform_env_dict["channels"],
|
||||||
output_dir=output_dir,
|
specs=sorted(platform_env_dict["dependencies"]),
|
||||||
|
user_requested_specs=user_requested_specs,
|
||||||
|
initialize_by_default=False if platform.startswith("win") else True,
|
||||||
|
installer_type="all",
|
||||||
|
keep_pkgs=True,
|
||||||
|
license_file="LICENSE",
|
||||||
|
register_python_default=False,
|
||||||
|
write_condarc=True,
|
||||||
|
condarc=dict(
|
||||||
|
channels=platform_env_dict["channels"],
|
||||||
|
channel_priority="strict",
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
if platform.startswith("win"):
|
||||||
|
construct_dict["post_install"] = "post_install.bat"
|
||||||
|
# point to template that we generate at build time with a patch over default
|
||||||
|
construct_dict["nsis_template"] = "main.nsi.tmpl"
|
||||||
|
else:
|
||||||
|
construct_dict["post_install"] = "post_install.sh"
|
||||||
|
|
||||||
# aggregate output
|
constructor_dir = output_dir / constructor_name
|
||||||
rendered_platforms[output_name] = dict(
|
if constructor_dir.exists():
|
||||||
locked_env_spec=locked_env_spec,
|
shutil.rmtree(constructor_dir)
|
||||||
locked_env_dict=locked_env_dict,
|
constructor_dir.mkdir(parents=True)
|
||||||
lockfile_contents=lockfile_contents,
|
|
||||||
locked_installer_spec=locked_installer_spec,
|
|
||||||
constructor_dict=constructor_dict,
|
|
||||||
)
|
|
||||||
|
|
||||||
return rendered_platforms
|
# copy license to the constructor directory
|
||||||
|
shutil.copy(license_file, constructor_dir / "LICENSE")
|
||||||
|
|
||||||
|
# write the post_install scripts referenced in the construct dict
|
||||||
|
if platform.startswith("win"):
|
||||||
|
with (constructor_dir / "post_install.bat").open("w") as f:
|
||||||
|
f.write(
|
||||||
|
"\n".join(
|
||||||
|
(
|
||||||
|
r'echo {"env_vars": {"GR_PREFIX": "", "GRC_BLOCKS_PATH": "", "UHD_PKG_PATH": "", "VOLK_PREFIX": ""}}>%PREFIX%\conda-meta\state',
|
||||||
|
r"del /q %PREFIX%\pkgs\*.tar.bz2",
|
||||||
|
r"del /q %PREFIX%\pkgs\*.conda",
|
||||||
|
"exit 0",
|
||||||
|
"",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
with (constructor_dir / "post_install.sh").open("w") as f:
|
||||||
|
f.write(
|
||||||
|
"\n".join(
|
||||||
|
(
|
||||||
|
"#!/bin/sh",
|
||||||
|
f'PREFIX="${{PREFIX:-$2/{name}}}"',
|
||||||
|
r"rm -f $PREFIX/pkgs/*.tar.bz2 $PREFIX/pkgs/*.conda",
|
||||||
|
"exit 0",
|
||||||
|
"",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
construct_yaml_path = constructor_dir / "construct.yaml"
|
||||||
|
with construct_yaml_path.open("w") as f:
|
||||||
|
yaml.safe_dump(construct_dict, stream=f)
|
||||||
|
|
||||||
|
|
||||||
|
def render(
|
||||||
|
environment_file: pathlib.Path,
|
||||||
|
installer_environment_file: pathlib.Path,
|
||||||
|
version: str,
|
||||||
|
company: str,
|
||||||
|
license_file: pathlib.Path,
|
||||||
|
output_dir: pathlib.Path,
|
||||||
|
conda_exe: pathlib.Path,
|
||||||
|
dirty: Optional[bool] = False,
|
||||||
|
keep_workdir: Optional[bool] = False,
|
||||||
|
) -> None:
|
||||||
|
with environment_file.open("r") as f:
|
||||||
|
env_yaml_data = yaml.safe_load(f)
|
||||||
|
with installer_environment_file.open("r") as f:
|
||||||
|
base_env_yaml_data = yaml.safe_load(f)
|
||||||
|
|
||||||
|
env_name = env_yaml_data["name"]
|
||||||
|
env_pkg_names = [name_from_pkg_spec(spec) for spec in env_yaml_data["dependencies"]]
|
||||||
|
base_env_pkg_names = [
|
||||||
|
name_from_pkg_spec(spec) for spec in base_env_yaml_data["dependencies"]
|
||||||
|
]
|
||||||
|
|
||||||
|
if not license_file.exists():
|
||||||
|
raise ValueError(f"Cannot find license file: {license_file}")
|
||||||
|
|
||||||
|
if output_dir.exists() and not dirty:
|
||||||
|
shutil.rmtree(output_dir)
|
||||||
|
output_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
# working dir for conda-lock outputs that we use as intermediates
|
||||||
|
lock_work_dir = output_dir / "lockwork"
|
||||||
|
lock_work_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
# read environment files and create the lock file
|
||||||
|
lockfile_path = lock_work_dir / f"{env_name}.conda-lock.yml"
|
||||||
|
conda_lock.conda_lock.run_lock(
|
||||||
|
environment_files=[environment_file, installer_environment_file],
|
||||||
|
conda_exe=conda_exe,
|
||||||
|
mamba=True,
|
||||||
|
micromamba=True,
|
||||||
|
kinds=("lock",),
|
||||||
|
lockfile_path=lockfile_path,
|
||||||
|
)
|
||||||
|
|
||||||
|
# render main environment specs into explicit .lock files for reproducibility
|
||||||
|
lock_content = conda_lock.conda_lock.parse_conda_lock_file(lockfile_path)
|
||||||
|
conda_lock.conda_lock.do_render(
|
||||||
|
lockfile=lock_content,
|
||||||
|
kinds=("explicit",),
|
||||||
|
filename_template=f"{output_dir}/{env_name}-{{platform}}.lock",
|
||||||
|
)
|
||||||
|
|
||||||
|
# create the environment specification files for the metapackages
|
||||||
|
render_metapackage_environments(
|
||||||
|
lockfile_path=lockfile_path,
|
||||||
|
requested_pkg_names=env_pkg_names,
|
||||||
|
name=env_name,
|
||||||
|
version=version,
|
||||||
|
output_dir=output_dir,
|
||||||
|
)
|
||||||
|
|
||||||
|
# create the rendered constructor directories
|
||||||
|
render_constructors(
|
||||||
|
lockfile_path=lockfile_path,
|
||||||
|
requested_pkg_names=sorted(env_pkg_names + base_env_pkg_names),
|
||||||
|
name=env_name,
|
||||||
|
version=version,
|
||||||
|
company=company,
|
||||||
|
license_file=license_file,
|
||||||
|
output_dir=output_dir,
|
||||||
|
)
|
||||||
|
|
||||||
|
# clean up conda-lock work dir
|
||||||
|
if not keep_workdir:
|
||||||
|
shutil.rmtree(lock_work_dir)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -370,9 +348,24 @@ if __name__ == "__main__":
|
||||||
" (default: %(default)s)"
|
" (default: %(default)s)"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--dirty",
|
||||||
|
action="store_true",
|
||||||
|
default=False,
|
||||||
|
help=("Do not clean up output_dir before rendering. (default: %(default)s)"),
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--keep-workdir",
|
||||||
|
action="store_true",
|
||||||
|
default=False,
|
||||||
|
help=(
|
||||||
|
"Keep conda-lock working directory ({output_dir}/lockwork) of intermediate"
|
||||||
|
" outputs. (default: %(default)s)"
|
||||||
|
),
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--conda-exe",
|
"--conda-exe",
|
||||||
type=str,
|
type=pathlib.Path,
|
||||||
default=None,
|
default=None,
|
||||||
help=(
|
help=(
|
||||||
"Path to the conda (or mamba or micromamba) executable to use."
|
"Path to the conda (or mamba or micromamba) executable to use."
|
||||||
|
@ -382,16 +375,14 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
conda_exe = conda_lock.conda_lock.determine_conda_executable(
|
render(
|
||||||
conda_executable=args.conda_exe, mamba=True, micromamba=True
|
|
||||||
)
|
|
||||||
|
|
||||||
constructor_specs = render_platforms(
|
|
||||||
environment_file=args.environment_file,
|
environment_file=args.environment_file,
|
||||||
installer_environment_file=args.installer_environment_file,
|
installer_environment_file=args.installer_environment_file,
|
||||||
version=args.version,
|
version=args.version,
|
||||||
company=args.company,
|
company=args.company,
|
||||||
license_file=args.license_file,
|
license_file=args.license_file,
|
||||||
output_dir=args.output_dir,
|
output_dir=args.output_dir,
|
||||||
conda_exe=conda_exe,
|
conda_exe=args.conda_exe,
|
||||||
|
dirty=args.dirty,
|
||||||
|
keep_workdir=args.keep_workdir,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue