1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-08-08 22:36:48 +02:00

fix for contiguous packages with the same name

This commit is contained in:
Kelly Brazil
2024-11-18 16:21:40 -08:00
parent a8f769eea3
commit e858faa746
3 changed files with 11 additions and 16 deletions

View File

@ -1,6 +1,6 @@
jc changelog jc changelog
20241018 v1.25.4 20241118 v1.25.4
- Add `ipconfig` command parser (`ipconfig` for Windows) - Add `ipconfig` command parser (`ipconfig` for Windows)
- Enhance `ping-s` streaming parser to support error replies - Enhance `ping-s` streaming parser to support error replies
- Enhance `ethtool` parser to support `link_partner_advertised_link_modes` - Enhance `ethtool` parser to support `link_partner_advertised_link_modes`
@ -9,6 +9,7 @@ jc changelog
- Fix `df` parser to correctly output binary vs. decimal size outputs - Fix `df` parser to correctly output binary vs. decimal size outputs
- Fix `mount` parser for cases where there are spaces in the filesystem name - Fix `mount` parser for cases where there are spaces in the filesystem name
- Fix `ip-address` parser for Python 3.13 changes to IPv4 mapped IPv6 addresses - Fix `ip-address` parser for Python 3.13 changes to IPv4 mapped IPv6 addresses
- Fix `pkg-index-deb`, `apt-cache-show`, and `rpm-qi` parsers to correctly convert contiguous packages with the same name
- Fix `uptime` parser for data that contains `user` instead of `users` - Fix `uptime` parser for data that contains `user` instead of `users`
- Enhance `jc.utils.convert_size_to_int()` to add `posix_mode` and `decimal_bias` parameters - Enhance `jc.utils.convert_size_to_int()` to add `posix_mode` and `decimal_bias` parameters

View File

@ -185,7 +185,7 @@ import jc.utils
class info(): class info():
"""Provides parser metadata (version, author, etc.)""" """Provides parser metadata (version, author, etc.)"""
version = '1.8' version = '1.9'
description = '`rpm -qi` command parser' description = '`rpm -qi` command parser'
author = 'Kelly Brazil' author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com' author_email = 'kellyjonbrazil@gmail.com'
@ -256,8 +256,6 @@ def parse(data, raw=False, quiet=False):
raw_output = [] raw_output = []
entry_obj = {} entry_obj = {}
last_entry = None
this_entry = None
desc_entry = False desc_entry = False
desc_en_entry = False desc_en_entry = False
description = [] description = []
@ -268,15 +266,11 @@ def parse(data, raw=False, quiet=False):
split_line = line.split(': ', maxsplit=1) split_line = line.split(': ', maxsplit=1)
if (split_line[0].startswith('Name') or split_line[0] == 'Package') and len(split_line) == 2: if (split_line[0].startswith('Name') or split_line[0] == 'Package') and len(split_line) == 2:
this_entry = split_line[1].strip()
if this_entry != last_entry:
if entry_obj: if entry_obj:
if description: if description:
entry_obj['description'] = ' '.join(description) entry_obj['description'] = ' '.join(description)
raw_output.append(entry_obj) raw_output.append(entry_obj)
entry_obj = {} entry_obj = {}
last_entry = this_entry
desc_entry = False desc_entry = False
desc_en_entry = False desc_en_entry = False

File diff suppressed because one or more lines are too long