Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate simple host_os_get_* methods #1137

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/sst/core/testingframework/sst_unittest_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from test_engine_support import OSCommand
from test_engine_support import check_param_type

from warnings import warn
if not sys.warnoptions:
import os, warnings
warnings.simplefilter("once") # Change the filter in this process
Expand Down Expand Up @@ -188,6 +189,8 @@ def host_os_get_system_node_name():
Returns:
(str) Returns the system node name
"""
warn("host_os_get_system_node_name() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)
return platform.node()

###
Expand All @@ -198,6 +201,8 @@ def host_os_get_kernel_type():
Returns:
(str) 'Linux' or 'Darwin' as the Kernel Type
"""
warn("host_os_get_kernel_type() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)
return platform.system()

def host_os_get_kernel_release():
Expand All @@ -206,6 +211,8 @@ def host_os_get_kernel_release():
Returns:
(str) Kernel Release Number. Note: This is not the same as OS version
"""
warn("host_os_get_kernel_release() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)
return platform.release()

def host_os_get_kernel_arch():
Expand All @@ -214,6 +221,8 @@ def host_os_get_kernel_arch():
Returns:
(str) 'x86_64' on Linux; 'i386' on OSX as the Kernel Architecture
"""
warn("host_os_get_kernel_arch() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)
return platform.machine()

def host_os_get_distribution_type():
Expand Down Expand Up @@ -270,6 +279,8 @@ def host_os_is_osx():
Returns:
(bool) True if OS Distribution is OSX
"""
warn("host_os_is_osx() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)
return host_os_get_distribution_type() == OS_DIST_OSX

def host_os_is_linux():
Expand All @@ -278,6 +289,8 @@ def host_os_is_linux():
Returns:
(bool) True if OS Distribution is Linux
"""
warn("host_os_is_linux() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)
return not host_os_get_distribution_type() == OS_DIST_OSX

def host_os_is_centos():
Expand All @@ -286,6 +299,8 @@ def host_os_is_centos():
Returns:
(bool) True if OS Distribution is CentOS
"""
warn("host_os_is_centos() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)
return host_os_get_distribution_type() == OS_DIST_CENTOS

def host_os_is_rhel():
Expand All @@ -294,6 +309,8 @@ def host_os_is_rhel():
Returns:
(bool) True if OS Distribution is RHEL
"""
warn("host_os_is_rhel() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)
return host_os_get_distribution_type() == OS_DIST_RHEL

def host_os_is_toss():
Expand All @@ -302,6 +319,8 @@ def host_os_is_toss():
Returns:
(bool) True if OS Distribution is Toss
"""
warn("host_os_is_toss() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)
return host_os_get_distribution_type() == OS_DIST_TOSS

def host_os_is_ubuntu():
Expand All @@ -310,6 +329,8 @@ def host_os_is_ubuntu():
Returns:
(bool) True if OS Distribution is Ubuntu
"""
warn("host_os_is_ubuntu() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)
return host_os_get_distribution_type() == OS_DIST_UBUNTU

def host_os_is_rocky():
Expand All @@ -318,6 +339,8 @@ def host_os_is_rocky():
Returns:
(bool) True if OS Distribution is Rocky
"""
warn("host_os_is_rocky() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)
return host_os_get_distribution_type() == OS_DIST_ROCKY


Expand All @@ -329,6 +352,8 @@ def host_os_get_num_cores_on_system():
Returns:
(int) Number of cores on the system
"""
warn("host_os_get_num_cores_on_system() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)
num_cores = multiprocessing.cpu_count()
return num_cores

Expand Down
Loading