diff --git a/py_utils/py_utils/system/__init__.py b/py_utils/py_utils/system/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/py_utils/py_utils/system/system_utils.py b/py_utils/py_utils/system/system_utils.py new file mode 100644 index 00000000..027f2eb4 --- /dev/null +++ b/py_utils/py_utils/system/system_utils.py @@ -0,0 +1,35 @@ +# Copyright 2023 Proyectos y Sistemas de Mantenimiento SL (eProsima). +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +This file contains system utils. +""" + +import os + +def is_linux() -> bool: + """ + @brief Check if the script is running in a Linux environment. + + @return: True if the script is running in a Linux environment, False otherwise. + """ + return os.name == 'posix' + +def is_windows() -> bool: + """ + @brief Check if the script is running in a Windows environment. + + @return: True if the script is running in a Windows environment, False otherwise. + """ + return os.name == 'nt' diff --git a/py_utils/setup.py b/py_utils/setup.py index 73807c1d..e4514c17 100644 --- a/py_utils/setup.py +++ b/py_utils/setup.py @@ -10,6 +10,7 @@ package_name, package_name + '/debugging', package_name + '/logging', + package_name + '/system', package_name + '/time', package_name + '/wait', ]