@@ -546,9 +546,19 @@ def distro_release_info() -> Dict[str, str]:
546
546
547
547
def uname_info () -> Dict [str , str ]:
548
548
"""
549
+ .. deprecated:: 1.11.0
550
+
551
+ :func:`distro.uname_info()` is deprecated and will be removed in a
552
+ future version.
553
+
549
554
Return a dictionary containing key-value pairs for the information items
550
555
from the distro release file data source of the current OS distribution.
551
556
"""
557
+ warnings .warn (
558
+ "distro.uname_info() is deprecated and will be removed in a future version." ,
559
+ DeprecationWarning ,
560
+ stacklevel = 2 ,
561
+ )
552
562
return _distro .uname_info ()
553
563
554
564
@@ -612,6 +622,11 @@ def distro_release_attr(attribute: str) -> str:
612
622
613
623
def uname_attr (attribute : str ) -> str :
614
624
"""
625
+ .. deprecated:: 1.11.0
626
+
627
+ :func:`distro.uname_attr()` is deprecated and will be removed in a
628
+ future version.
629
+
615
630
Return a single named information item from the distro release file
616
631
data source of the current OS distribution.
617
632
@@ -624,6 +639,11 @@ def uname_attr(attribute: str) -> str:
624
639
* (string): Value of the information item, if the item exists.
625
640
The empty string, if the item does not exist.
626
641
"""
642
+ warnings .warn (
643
+ "distro.uname_attr() is deprecated and will be removed in a future version." ,
644
+ DeprecationWarning ,
645
+ stacklevel = 2 ,
646
+ )
627
647
return _distro .uname_attr (attribute )
628
648
629
649
@@ -853,7 +873,7 @@ def normalize(distro_id: str, table: Dict[str, str]) -> str:
853
873
if distro_id :
854
874
return normalize (distro_id , NORMALIZED_DISTRO_ID )
855
875
856
- distro_id = self .uname_attr ("id" )
876
+ distro_id = self ._uname_attr ("id" )
857
877
if distro_id :
858
878
return normalize (distro_id , NORMALIZED_DISTRO_ID )
859
879
@@ -869,14 +889,14 @@ def name(self, pretty: bool = False) -> str:
869
889
self .os_release_attr ("name" )
870
890
or self .lsb_release_attr ("distributor_id" )
871
891
or self .distro_release_attr ("name" )
872
- or self .uname_attr ("name" )
892
+ or self ._uname_attr ("name" )
873
893
)
874
894
if pretty :
875
895
name = self .os_release_attr ("pretty_name" ) or self .lsb_release_attr (
876
896
"description"
877
897
)
878
898
if not name :
879
- name = self .distro_release_attr ("name" ) or self .uname_attr ("name" )
899
+ name = self .distro_release_attr ("name" ) or self ._uname_attr ("name" )
880
900
version = self .version (pretty = True )
881
901
if version :
882
902
name = f"{ name } { version } "
@@ -898,9 +918,9 @@ def version(self, pretty: bool = False, best: bool = False) -> str:
898
918
self ._parse_distro_release_content (
899
919
self .lsb_release_attr ("description" )
900
920
).get ("version_id" , "" ),
901
- self .uname_attr ("release" ),
921
+ self ._uname_attr ("release" ),
902
922
]
903
- if self .uname_attr ("id" ).startswith ("aix" ):
923
+ if self ._uname_attr ("id" ).startswith ("aix" ):
904
924
# On AIX platforms, prefer oslevel command output.
905
925
versions .insert (0 , self .oslevel_info ())
906
926
elif self .id () == "debian" or "debian" in self .like ().split ():
@@ -1042,11 +1062,24 @@ def distro_release_info(self) -> Dict[str, str]:
1042
1062
1043
1063
def uname_info (self ) -> Dict [str , str ]:
1044
1064
"""
1065
+ .. deprecated:: 1.11.0
1066
+
1067
+ :func:`LinuxDistribution.uname_info()` is deprecated and will be removed
1068
+ in a future version.
1069
+
1045
1070
Return a dictionary containing key-value pairs for the information
1046
1071
items from the uname command data source of the OS distribution.
1047
1072
1048
1073
For details, see :func:`distro.uname_info`.
1049
1074
"""
1075
+ warnings .warn (
1076
+ (
1077
+ "LinuxDistribution.uname_info() is deprecated and will be removed in a"
1078
+ " future version."
1079
+ ),
1080
+ DeprecationWarning ,
1081
+ stacklevel = 2 ,
1082
+ )
1050
1083
return self ._uname_info
1051
1084
1052
1085
def oslevel_info (self ) -> str :
@@ -1083,6 +1116,28 @@ def distro_release_attr(self, attribute: str) -> str:
1083
1116
return self ._distro_release_info .get (attribute , "" )
1084
1117
1085
1118
def uname_attr (self , attribute : str ) -> str :
1119
+ """
1120
+ .. deprecated:: 1.11.0
1121
+
1122
+ :func:`LinuxDistribution.uname_attr()` is deprecated and will be removed in
1123
+ a future version.
1124
+
1125
+ Return a single named information item from the uname command
1126
+ output data source of the OS distribution.
1127
+
1128
+ For details, see :func:`distro.uname_attr`.
1129
+ """
1130
+ warnings .warn (
1131
+ (
1132
+ "LinuxDistribution.uname_attr() is deprecated and will be removed in a"
1133
+ " future version."
1134
+ ),
1135
+ DeprecationWarning ,
1136
+ stacklevel = 2 ,
1137
+ )
1138
+ return self ._uname_attr (attribute )
1139
+
1140
+ def _uname_attr (self , attribute : str ) -> str :
1086
1141
"""
1087
1142
Return a single named information item from the uname command
1088
1143
output data source of the OS distribution.
0 commit comments