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:
@ -1,6 +1,6 @@
|
||||
jc changelog
|
||||
|
||||
20241018 v1.25.4
|
||||
20241118 v1.25.4
|
||||
- Add `ipconfig` command parser (`ipconfig` for Windows)
|
||||
- Enhance `ping-s` streaming parser to support error replies
|
||||
- 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 `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 `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`
|
||||
- Enhance `jc.utils.convert_size_to_int()` to add `posix_mode` and `decimal_bias` parameters
|
||||
|
||||
|
@ -185,7 +185,7 @@ import jc.utils
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '1.8'
|
||||
version = '1.9'
|
||||
description = '`rpm -qi` command parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
@ -256,8 +256,6 @@ def parse(data, raw=False, quiet=False):
|
||||
|
||||
raw_output = []
|
||||
entry_obj = {}
|
||||
last_entry = None
|
||||
this_entry = None
|
||||
desc_entry = False
|
||||
desc_en_entry = False
|
||||
description = []
|
||||
@ -268,17 +266,13 @@ def parse(data, raw=False, quiet=False):
|
||||
split_line = line.split(': ', maxsplit=1)
|
||||
|
||||
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 description:
|
||||
entry_obj['description'] = ' '.join(description)
|
||||
raw_output.append(entry_obj)
|
||||
entry_obj = {}
|
||||
last_entry = this_entry
|
||||
desc_entry = False
|
||||
desc_en_entry = False
|
||||
if entry_obj:
|
||||
if description:
|
||||
entry_obj['description'] = ' '.join(description)
|
||||
raw_output.append(entry_obj)
|
||||
entry_obj = {}
|
||||
desc_entry = False
|
||||
desc_en_entry = False
|
||||
|
||||
if line.startswith('Description :'):
|
||||
desc_entry = True
|
||||
|
2
tests/fixtures/generic/pkg-index-deb.json
vendored
2
tests/fixtures/generic/pkg-index-deb.json
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user