@@ -546,9 +546,20 @@ 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 `os.uname()` or `platform.uname()` instead.
553+
549554 Return a dictionary containing key-value pairs for the information items
550555 from the distro release file data source of the current OS distribution.
551556 """
557+ warnings .warn (
558+ "distro.uname_info() is deprecated and will be removed in a future version. "
559+ "Please use os.uname() or platform.uname() instead." ,
560+ DeprecationWarning ,
561+ stacklevel = 2 ,
562+ )
552563 return _distro .uname_info ()
553564
554565
@@ -612,6 +623,11 @@ def distro_release_attr(attribute: str) -> str:
612623
613624def uname_attr (attribute : str ) -> str :
614625 """
626+ .. deprecated:: 1.10.0
627+
628+ :func:`distro.uname_attr()` is deprecated and will be removed in a
629+ future version. Please use `os.uname()` or `platform.uname()` instead.
630+
615631 Return a single named information item from the distro release file
616632 data source of the current OS distribution.
617633
@@ -624,6 +640,12 @@ def uname_attr(attribute: str) -> str:
624640 * (string): Value of the information item, if the item exists.
625641 The empty string, if the item does not exist.
626642 """
643+ warnings .warn (
644+ "distro.uname_attr() is deprecated and will be removed in a future version. "
645+ "Please use os.uname() or platform.uname() instead." ,
646+ DeprecationWarning ,
647+ stacklevel = 2 ,
648+ )
627649 return _distro .uname_attr (attribute )
628650
629651
@@ -853,7 +875,7 @@ def normalize(distro_id: str, table: Dict[str, str]) -> str:
853875 if distro_id :
854876 return normalize (distro_id , NORMALIZED_DISTRO_ID )
855877
856- distro_id = self .uname_attr ("id" )
878+ distro_id = self ._uname_attr ("id" )
857879 if distro_id :
858880 return normalize (distro_id , NORMALIZED_DISTRO_ID )
859881
@@ -869,14 +891,14 @@ def name(self, pretty: bool = False) -> str:
869891 self .os_release_attr ("name" )
870892 or self .lsb_release_attr ("distributor_id" )
871893 or self .distro_release_attr ("name" )
872- or self .uname_attr ("name" )
894+ or self ._uname_attr ("name" )
873895 )
874896 if pretty :
875897 name = self .os_release_attr ("pretty_name" ) or self .lsb_release_attr (
876898 "description"
877899 )
878900 if not name :
879- name = self .distro_release_attr ("name" ) or self .uname_attr ("name" )
901+ name = self .distro_release_attr ("name" ) or self ._uname_attr ("name" )
880902 version = self .version (pretty = True )
881903 if version :
882904 name = f"{ name } { version } "
@@ -898,9 +920,9 @@ def version(self, pretty: bool = False, best: bool = False) -> str:
898920 self ._parse_distro_release_content (
899921 self .lsb_release_attr ("description" )
900922 ).get ("version_id" , "" ),
901- self .uname_attr ("release" ),
923+ self ._uname_attr ("release" ),
902924 ]
903- if self .uname_attr ("id" ).startswith ("aix" ):
925+ if self ._uname_attr ("id" ).startswith ("aix" ):
904926 # On AIX platforms, prefer oslevel command output.
905927 versions .insert (0 , self .oslevel_info ())
906928 elif self .id () == "debian" or "debian" in self .like ().split ():
@@ -1042,11 +1064,24 @@ def distro_release_info(self) -> Dict[str, str]:
10421064
10431065 def uname_info (self ) -> Dict [str , str ]:
10441066 """
1067+ .. deprecated:: 1.10.0
1068+
1069+ :func:`LinuxDistribution.uname_info()` is deprecated and will be removed
1070+ in a future version. Please use `os.uname()` or `platform.uname()` instead.
1071+
10451072 Return a dictionary containing key-value pairs for the information
10461073 items from the uname command data source of the OS distribution.
10471074
10481075 For details, see :func:`distro.uname_info`.
10491076 """
1077+ warnings .warn (
1078+ (
1079+ "LinuxDistribution.uname_info() is deprecated and will be removed in a"
1080+ " future version. Please use os.uname() or platform.uname() instead."
1081+ ),
1082+ DeprecationWarning ,
1083+ stacklevel = 2 ,
1084+ )
10501085 return self ._uname_info
10511086
10521087 def oslevel_info (self ) -> str :
@@ -1083,6 +1118,28 @@ def distro_release_attr(self, attribute: str) -> str:
10831118 return self ._distro_release_info .get (attribute , "" )
10841119
10851120 def uname_attr (self , attribute : str ) -> str :
1121+ """
1122+ .. deprecated:: 1.10.0
1123+
1124+ :func:`LinuxDistribution.uname_attr()` is deprecated and will be removed in
1125+ a future version. Please use `os.uname()` or `platform.uname()` instead.
1126+
1127+ Return a single named information item from the uname command
1128+ output data source of the OS distribution.
1129+
1130+ For details, see :func:`distro.uname_attr`.
1131+ """
1132+ warnings .warn (
1133+ (
1134+ "LinuxDistribution.uname_attr() is deprecated and will be removed in a"
1135+ " future version. Please use os.uname() or platform.uname() instead."
1136+ ),
1137+ DeprecationWarning ,
1138+ stacklevel = 2 ,
1139+ )
1140+ return self ._uname_attr (attribute )
1141+
1142+ def _uname_attr (self , attribute : str ) -> str :
10861143 """
10871144 Return a single named information item from the uname command
10881145 output data source of the OS distribution.
0 commit comments