precommit

This commit is contained in:
Elijah 2024-05-14 13:45:33 +00:00
parent 9c5078595c
commit 3d4129d9c1

View File

@ -181,7 +181,11 @@ def get_install_package_manager() -> str | None:
Returns: Returns:
The path to the package manager. The path to the package manager.
""" """
if constants.IS_WINDOWS and not is_windows_bun_supported() or windows_check_onedrive_in_path(): if (
constants.IS_WINDOWS
and not is_windows_bun_supported()
or windows_check_onedrive_in_path()
):
return get_package_manager() return get_package_manager()
return get_config().bun_path return get_config().bun_path
@ -199,7 +203,7 @@ def get_package_manager() -> str | None:
return npm_path return npm_path
def windows_check_onedrive_in_path(): def windows_check_onedrive_in_path() -> bool:
"""For windows, check if oneDrive is present in the project dir path. """For windows, check if oneDrive is present in the project dir path.
Returns: Returns:
@ -207,6 +211,7 @@ def windows_check_onedrive_in_path():
""" """
return "onedrive" in str(Path.cwd()).lower() return "onedrive" in str(Path.cwd()).lower()
def get_app(reload: bool = False) -> ModuleType: def get_app(reload: bool = False) -> ModuleType:
"""Get the app module based on the default config. """Get the app module based on the default config.
@ -752,7 +757,9 @@ def install_bun():
Raises: Raises:
FileNotFoundError: If required packages are not found. FileNotFoundError: If required packages are not found.
""" """
if constants.IS_WINDOWS and not (win_supported := is_windows_bun_supported()) or (one_drive_in_path := windows_check_onedrive_in_path()): win_supported = is_windows_bun_supported()
one_drive_in_path = windows_check_onedrive_in_path()
if constants.IS_WINDOWS and not win_supported or one_drive_in_path:
if not win_supported: if not win_supported:
console.warn( console.warn(
"Bun for Windows is currently only available for x86 64-bit Windows. Installation will fall back on npm." "Bun for Windows is currently only available for x86 64-bit Windows. Installation will fall back on npm."