@@ -546,9 +546,21 @@ def distro_release_info() -> Dict[str, str]:
546546
547547def uname_info () -> Dict [str , str ]:
548548 """
549+ .. deprecated:: 1.10.0
550+
551+ :func:`distro.uname_info()` is deprecated and will be removed in a
552+ future version. Please use :func:`os.uname()` or :func:`platform.uname()`
553+ instead.
554+
549555 Return a dictionary containing key-value pairs for the information items
550556 from the distro release file data source of the current OS distribution.
551557 """
558+ warnings .warn (
559+ "distro.uname_info() is deprecated and will be removed in a future version. "
560+ "Please use os.uname() or platform.uname() instead." ,
561+ DeprecationWarning ,
562+ stacklevel = 2 ,
563+ )
552564 return _distro .uname_info ()
553565
554566
@@ -612,6 +624,12 @@ def distro_release_attr(attribute: str) -> str:
612624
613625def uname_attr (attribute : str ) -> str :
614626 """
627+ .. deprecated:: 1.10.0
628+
629+ :func:`distro.uname_attr()` is deprecated and will be removed in a
630+ future version. Please use :func:`os.uname()` or :func:`platform.uname()`
631+ instead.
632+
615633 Return a single named information item from the distro release file
616634 data source of the current OS distribution.
617635
@@ -624,6 +642,12 @@ def uname_attr(attribute: str) -> str:
624642 * (string): Value of the information item, if the item exists.
625643 The empty string, if the item does not exist.
626644 """
645+ warnings .warn (
646+ "distro.uname_attr() is deprecated and will be removed in a future version. "
647+ "Please use os.uname() or platform.uname() instead." ,
648+ DeprecationWarning ,
649+ stacklevel = 2 ,
650+ )
627651 return _distro .uname_attr (attribute )
628652
629653
@@ -853,7 +877,7 @@ def normalize(distro_id: str, table: Dict[str, str]) -> str:
853877 if distro_id :
854878 return normalize (distro_id , NORMALIZED_DISTRO_ID )
855879
856- distro_id = self .uname_attr ("id" )
880+ distro_id = self ._uname_attr ("id" )
857881 if distro_id :
858882 return normalize (distro_id , NORMALIZED_DISTRO_ID )
859883
@@ -869,14 +893,14 @@ def name(self, pretty: bool = False) -> str:
869893 self .os_release_attr ("name" )
870894 or self .lsb_release_attr ("distributor_id" )
871895 or self .distro_release_attr ("name" )
872- or self .uname_attr ("name" )
896+ or self ._uname_attr ("name" )
873897 )
874898 if pretty :
875899 name = self .os_release_attr ("pretty_name" ) or self .lsb_release_attr (
876900 "description"
877901 )
878902 if not name :
879- name = self .distro_release_attr ("name" ) or self .uname_attr ("name" )
903+ name = self .distro_release_attr ("name" ) or self ._uname_attr ("name" )
880904 version = self .version (pretty = True )
881905 if version :
882906 name = f"{ name } { version } "
@@ -898,9 +922,9 @@ def version(self, pretty: bool = False, best: bool = False) -> str:
898922 self ._parse_distro_release_content (
899923 self .lsb_release_attr ("description" )
900924 ).get ("version_id" , "" ),
901- self .uname_attr ("release" ),
925+ self ._uname_attr ("release" ),
902926 ]
903- if self .uname_attr ("id" ).startswith ("aix" ):
927+ if self ._uname_attr ("id" ).startswith ("aix" ):
904928 # On AIX platforms, prefer oslevel command output.
905929 versions .insert (0 , self .oslevel_info ())
906930 elif self .id () == "debian" or "debian" in self .like ().split ():
@@ -1042,11 +1066,25 @@ def distro_release_info(self) -> Dict[str, str]:
10421066
10431067 def uname_info (self ) -> Dict [str , str ]:
10441068 """
1069+ .. deprecated:: 1.10.0
1070+
1071+ :func:`LinuxDistribution.uname_info()` is deprecated and will be removed
1072+ in a future version. Please use :func:`os.uname()` or :func:`platform.uname()`
1073+ instead.
1074+
10451075 Return a dictionary containing key-value pairs for the information
10461076 items from the uname command data source of the OS distribution.
10471077
10481078 For details, see :func:`distro.uname_info`.
10491079 """
1080+ warnings .warn (
1081+ (
1082+ "LinuxDistribution.uname_info() is deprecated and will be removed in a"
1083+ " future version. Please use os.uname() or platform.uname() instead."
1084+ ),
1085+ DeprecationWarning ,
1086+ stacklevel = 2 ,
1087+ )
10501088 return self ._uname_info
10511089
10521090 def oslevel_info (self ) -> str :
@@ -1083,6 +1121,29 @@ def distro_release_attr(self, attribute: str) -> str:
10831121 return self ._distro_release_info .get (attribute , "" )
10841122
10851123 def uname_attr (self , attribute : str ) -> str :
1124+ """
1125+ .. deprecated:: 1.10.0
1126+
1127+ :func:`LinuxDistribution.uname_attr()` is deprecated and will be removed in
1128+ a future version. Please use :func:`os.uname()` or :func:`platform.uname()`
1129+ instead.
1130+
1131+ Return a single named information item from the uname command
1132+ output data source of the OS distribution.
1133+
1134+ For details, see :func:`distro.uname_attr`.
1135+ """
1136+ warnings .warn (
1137+ (
1138+ "LinuxDistribution.uname_attr() is deprecated and will be removed in a"
1139+ " future version. Please use os.uname() or platform.uname() instead."
1140+ ),
1141+ DeprecationWarning ,
1142+ stacklevel = 2 ,
1143+ )
1144+ return self ._uname_attr (attribute )
1145+
1146+ def _uname_attr (self , attribute : str ) -> str :
10861147 """
10871148 Return a single named information item from the uname command
10881149 output data source of the OS distribution.
0 commit comments