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 11Release notes
22=============
33
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+
410Version 31.2.0 - (2024-05-16)
511-----------------------------
612
Original file line number Diff line number Diff line change 66# See https://aboutcode.org for more information about nexB OSS projects.
77#
88
9- import getpass
109import os
1110import sys
1211
12+ from commoncode .distro import parse_os_release
13+
1314
1415def os_arch ():
1516 """
@@ -84,29 +85,13 @@ def is_on_macos_arm64():
8485del is_on_macos_arm64
8586
8687
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' ):
10489 """
10590 Return True if the current OS is Ubuntu 22.XX.
10691 """
10792 if not on_linux :
10893 return False
109- os_release_info = get_etc_os_release_info ( )
94+ os_release_info = parse_os_release ( os_release_location )
11095 return os_release_info ['ID' ] == 'ubuntu' and '22' in os_release_info ['VERSION_ID' ]
11196
11297on_ubuntu_22 = is_on_ubuntu_22 ()
You can’t perform that action at this time.
0 commit comments