mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-25 01:25:55 +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'
|
tag_str = '|'.join([f'%{{{tag}}}' for tag in query_tags]) + r'\n'
|
||||||
opts.append(tag_str)
|
opts.append(tag_str)
|
||||||
package_list_str, stderr = await run_rpm('-qa', *opts, sudo=False)
|
package_list_str, stderr = await run_rpm('-qa', *opts, sudo=False)
|
||||||
for package_str in package_list_str.split('\n'):
|
for package_str in package_list_str.splitlines():
|
||||||
if not package_str:
|
|
||||||
continue
|
|
||||||
tags = package_str.split('|')
|
tags = package_str.split('|')
|
||||||
ret.append(Package(name=tags[0], vendor=tags[1], packager=tags[2], url=tags[3]))
|
ret.append(Package(name=tags[0], vendor=tags[1], packager=tags[2], url=tags[3]))
|
||||||
return ret
|
return ret
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,7 @@ class CmdGetAuthInfo(Cmd): # export
|
||||||
return
|
return
|
||||||
remotes, stderr = await run_cmd('git', '-C', jw_pkg_dir, 'remote', '-v')
|
remotes, stderr = await run_cmd('git', '-C', jw_pkg_dir, 'remote', '-v')
|
||||||
result: dict[str, str] = {}
|
result: dict[str, str] = {}
|
||||||
for line in remotes.split('\n'):
|
for line in remotes.splitlines():
|
||||||
if re.match(r'^\s*$', line):
|
|
||||||
continue
|
|
||||||
name, url, typ = re.split(r'\s+', line)
|
name, url, typ = re.split(r'\s+', line)
|
||||||
if name == 'origin' and typ in ['(pull)', '(fetch)']: # TODO: Use other remotes, too?
|
if name == 'origin' and typ in ['(pull)', '(fetch)']: # TODO: Use other remotes, too?
|
||||||
parsed = urlparse(url)
|
parsed = urlparse(url)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue