Skip to content

Commit

Permalink
deprecate simple host_os_get_* methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jmlapre committed Sep 17, 2024
1 parent 8a4b4d9 commit 2d349c0
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion 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 @@ -141,7 +142,6 @@ def testing_is_PIN_Compiled():
return rtn

def testing_is_PIN2_used():
from warnings import warn
warn("testing_is_PIN2_used() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)

Expand Down Expand Up @@ -188,6 +188,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 +200,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 +210,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 +220,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 +278,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 +288,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 +298,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 +308,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 +318,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 +328,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 +338,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 +351,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

0 comments on commit 2d349c0

Please sign in to comment.