Skip to content

Commit 78c7910

Browse files
committed
Update cca_inline.py
1 parent cea915f commit 78c7910

1 file changed

Lines changed: 12 additions & 14 deletions

File tree

.control/hooks/cca_inline.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,27 +102,25 @@ def binder_config_file(self, source: Literal["conda", "apt", "bash"]) -> str:
102102
"""Create environment dependencies for binder."""
103103
if self._binder_files:
104104
return self._binder_files.get(source, "")
105-
install = _import_module_from_path(self.repo_path / ".dev/install.py")
106-
pyver = self.get("pypkg_main.python.version")
107-
pkg_path = self.get("pypkg_main.path.root")
108-
test_path = self.get("pypkg_test.path.root")
109-
pkg_dep = self.get("pypkg_main.dependency")
105+
package_keys = ("pypkg_main", "pypkg_test")
106+
package_data = {k: self.get(k) for k in package_keys}
110107
env_path = self.get(".path")
111108
dir_depth = len(env_path.removesuffix("/").split("/")) - 1
112109
path_to_root = f"{'../' * dir_depth}" if dir_depth else "./"
113110
pip_specs = [
114-
f"-e {path_to_root}{app_path}" for app_path in (pkg_path, test_path) if app_path
111+
f"-e {path_to_root}{package_data[package_key]["path"]["root"]}" for package_key in package_keys
115112
]
116-
_, self._binder_files = install.DependencyInstaller(
117-
python_version=pyver,
118-
pkg_dep=pkg_dep,
119-
test_dep=self.get("pypkg_test.dependency", {}),
120-
).run(
121-
platform="linux-64",
122-
sources=["conda", "apt", "bash"],
113+
install = _import_module_from_path(self.repo_path / ".dev/install.py")
114+
_, self._binder_files = install.DependencyInstaller(package_data).run(
115+
packages=package_keys,
116+
build_platform="linux-64",
117+
target_platform="linux-64",
123118
# Oldest supported Python version, since repo2docker does not support brand new Python versions.
124-
python_version=pyver["minors"][0],
119+
python_version=package_data["pypkg_main"]["python"]["version"]["minors"][0],
120+
sources=["conda", "apt", "bash"],
125121
extra_pip_specs=pip_specs,
122+
indent_json=self.get("default.file_setting.json.indent"),
123+
indent_yaml=self.get("default.file_setting.yaml.sequence_indent_offset"),
126124
)
127125
if "bash" in self._binder_files:
128126
self._binder_files["bash"] = f"#!/bin/bash\n\n{self._binder_files['bash']}"

0 commit comments

Comments
 (0)