mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-24 09:13:37 +02:00
jw.pkg.cmds: Replace split('\n') by splitlines()
splitlines() removes empty lines, so use it and save some lines of code. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
c8036ad216
commit
595995e084
2 changed files with 2 additions and 6 deletions
|
|
@ -26,9 +26,7 @@ async def all_installed_packages() -> Iterable[Package]:
|
|||
tag_str = '|'.join([f'%{{{tag}}}' for tag in query_tags]) + r'\n'
|
||||
opts.append(tag_str)
|
||||
package_list_str, stderr = await run_rpm('-qa', *opts, sudo=False)
|
||||
for package_str in package_list_str.split('\n'):
|
||||
if not package_str:
|
||||
continue
|
||||
for package_str in package_list_str.splitlines():
|
||||
tags = package_str.split('|')
|
||||
ret.append(Package(name=tags[0], vendor=tags[1], packager=tags[2], url=tags[3]))
|
||||
return ret
|
||||
|
|
|
|||
|
|
@ -31,9 +31,7 @@ class CmdGetAuthInfo(Cmd): # export
|
|||
return
|
||||
remotes, stderr = await run_cmd('git', '-C', jw_pkg_dir, 'remote', '-v')
|
||||
result: dict[str, str] = {}
|
||||
for line in remotes.split('\n'):
|
||||
if re.match(r'^\s*$', line):
|
||||
continue
|
||||
for line in remotes.splitlines():
|
||||
name, url, typ = re.split(r'\s+', line)
|
||||
if name == 'origin' and typ in ['(pull)', '(fetch)']: # TODO: Use other remotes, too?
|
||||
parsed = urlparse(url)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue