File tree Expand file tree Collapse file tree 2 files changed +10
-19
lines changed Expand file tree Collapse file tree 2 files changed +10
-19
lines changed Original file line number Diff line number Diff line change 1
1
Release notes
2
2
=============
3
3
4
+ Version 31.2.1 - (2024-05-16)
5
+ -----------------------------
6
+
7
+ - Remove ``commoncode.system.get_etc_os_release_info `` and replace it with ``commoncode.distro_os_release_parser ``.
8
+
9
+
4
10
Version 31.2.0 - (2024-05-16)
5
11
-----------------------------
6
12
Original file line number Diff line number Diff line change 6
6
# See https://aboutcode.org for more information about nexB OSS projects.
7
7
#
8
8
9
- import getpass
10
9
import os
11
10
import sys
12
11
12
+ from commoncode .distro import parse_os_release
13
+
13
14
14
15
def os_arch ():
15
16
"""
@@ -84,29 +85,13 @@ def is_on_macos_arm64():
84
85
del is_on_macos_arm64
85
86
86
87
87
- def get_etc_os_release_info (os_release_path = '/etc/os-release' ):
88
- """
89
- Return a dictionary of key-value pairs from /etc/os-release
90
- """
91
- os_release_data = {}
92
- with open (os_release_path ) as f :
93
- for line in f :
94
- split_line = line .split ('=' )
95
- if not split_line :
96
- continue
97
- k = split_line [0 ].strip ()
98
- v = split_line [- 1 ].strip ()
99
- os_release_data [k ] = v
100
- return os_release_data
101
-
102
-
103
- def is_on_ubuntu_22 ():
88
+ def is_on_ubuntu_22 (os_release_location = '/etc/os-release' ):
104
89
"""
105
90
Return True if the current OS is Ubuntu 22.XX.
106
91
"""
107
92
if not on_linux :
108
93
return False
109
- os_release_info = get_etc_os_release_info ( )
94
+ os_release_info = parse_os_release ( os_release_location )
110
95
return os_release_info ['ID' ] == 'ubuntu' and '22' in os_release_info ['VERSION_ID' ]
111
96
112
97
on_ubuntu_22 = is_on_ubuntu_22 ()
You can’t perform that action at this time.
0 commit comments