fgerlits commented on code in PR #2307:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2307#discussion_r4600537098
##########
bootstrap/package_manager.py:
##########
@@ -31,11 +32,35 @@ def _query_yes_no(question: str, no_confirm: bool) -> bool:
print("Please respond with 'yes' or 'no' (or 'y' or 'n').")
+def _is_rust_installed() -> bool:
+ cargo_bin = os.path.expanduser("~/.cargo/bin")
+ search_path = os.environ.get("PATH", "") + os.pathsep + cargo_bin
+ rustc = shutil.which("rustc", path=search_path)
+ cargo = shutil.which("cargo", path=search_path)
+ if not rustc or not cargo:
+ return False
+
+ try:
+ subprocess.run([rustc, "--version"], check=True, capture_output=True)
+ subprocess.run([cargo, "--version"], check=True, capture_output=True)
+ except (subprocess.CalledProcessError, OSError):
+ return False
Review Comment:
We should log the captured output at least in the case of an exception (it
could be useful to log it in the case of success, too). Or if we don't want to
log it, then let's not capture it.
##########
bootstrap/package_manager.py:
##########
@@ -178,14 +224,18 @@ def __init__(self, no_confirm):
PackageManager.__init__(self, no_confirm)
def install(self, dependencies: dict[str, set[str]]) -> bool:
- return self._install(
+ install_result = self._install(
dependencies=dependencies,
install_cmd="sudo zypper install -y",
replace_dict={
"libarchive": {"libarchive-devel"},
"python": {"python3-devel"},
+ "rust_toolchain": {"curl", "clang", "clang-devel"},
},
)
+ if not install_result:
+ return False
+ return "rust_toolchain" not in dependencies or
_install_rust_on_unix(self.no_confirm)
Review Comment:
this is repeated 4 times; could we move it inside `_install`? or maybe
create an `_install_on_unix()` wrapper?
##########
bootstrap/package_manager.py:
##########
@@ -266,6 +323,7 @@ def _get_activate_venv_path():
def _minifi_setup_env_str(vs_where_location: VsWhereLocation) -> str:
return f"""
call refreshenv
+set _OLD_VIRTUAL_PATH=
Review Comment:
what does this do? it could be worth adding a comment
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]