hbutils.system.os¶
is_linux¶
is_windows¶
is_darwin¶
-
hbutils.system.os.
is_darwin
() → bool[source]¶ - Overview:
Return
True
if current operating system is darwin, otherwise returnFalse
.
- Returns:
This OS is darwin or not.
Note
Darwin is macos.
is_macos¶
-
hbutils.system.os.
is_macos
= <function is_darwin>¶ - Overview:
Return
True
if current operating system is darwin, otherwise returnFalse
.
- Returns:
This OS is darwin or not.
Note
Darwin is macos.
which¶
-
hbutils.system.os.
which
(execfile: str) → Optional[str][source]¶ - Overview:
Returns first matching file path, which is the one when we operate in terminal.
- Parameters:
execfile – Executable file to locate (such as
python
).- Returns:
Absolute path fo the executable file.
- Examples::
>>> from hbutils.system import which >>> >>> which('apt-get') '/usr/bin/apt-get' >>> which('bash') '/usr/bin/bash' >>> which('not_installed') None
Deprecated since version 0.9: This will be removed in 1.0. Use the native
shutil.which()
instead
where¶
-
hbutils.system.os.
where
(execfile: str) → List[str][source]¶ - Overview:
Returns all matching file paths.
- Parameters:
execfile – Executable file to locate (such as
python
).- Returns:
The list of absolute paths of the executable files.
- Examples::
>>> from hbutils.system import where >>> >>> where('apt-get') ['/usr/bin/apt-get', '/bin/apt-get'] >>> where('bash') ['/usr/bin/bash', '/bin/bash'] >>> where('not_installed') []