Use walrus more
It was already used in other places, so this doesn't change much. Walrus was added in 3.8, so drop 3.7 from the compat list.
This commit is contained in:
parent
cd1281d709
commit
365d47a843
3 changed files with 4 additions and 10 deletions
|
@ -62,8 +62,7 @@ def read_os_release():
|
||||||
line = line.rstrip()
|
line = line.rstrip()
|
||||||
if not line or line.startswith('#'):
|
if not line or line.startswith('#'):
|
||||||
continue
|
continue
|
||||||
m = re.match(r'([A-Z][A-Z_0-9]+)=(.*)', line)
|
if m := re.match(r'([A-Z][A-Z_0-9]+)=(.*)', line):
|
||||||
if m:
|
|
||||||
name, val = m.groups()
|
name, val = m.groups()
|
||||||
if val and val[0] in '"\'':
|
if val and val[0] in '"\'':
|
||||||
val = ast.literal_eval(val)
|
val = ast.literal_eval(val)
|
||||||
|
@ -517,9 +516,7 @@ def main():
|
||||||
|
|
||||||
if args.target in {"fedora"} and args.existence_check and not os.path.exists(spec_file):
|
if args.target in {"fedora"} and args.existence_check and not os.path.exists(spec_file):
|
||||||
# No specfile, so this is probably a new package
|
# No specfile, so this is probably a new package
|
||||||
package_info = get_package_info(pkg_name)
|
if package_info := get_package_info(pkg_name):
|
||||||
|
|
||||||
if package_info:
|
|
||||||
if args.suffix:
|
if args.suffix:
|
||||||
print(f"Versions {args.suffix}.* of the crate '{metadata.name}' are already")
|
print(f"Versions {args.suffix}.* of the crate '{metadata.name}' are already")
|
||||||
print(f"packaged for Fedora: {package_info['full_url']}")
|
print(f"packaged for Fedora: {package_info['full_url']}")
|
||||||
|
|
|
@ -54,13 +54,11 @@ def detect_packager():
|
||||||
return packager
|
return packager
|
||||||
|
|
||||||
# If we're detecting packager identity through rpmdev-packager...
|
# If we're detecting packager identity through rpmdev-packager...
|
||||||
rpmdev_packager = shutil.which('rpmdev-packager')
|
if rpmdev_packager := shutil.which('rpmdev-packager'):
|
||||||
if rpmdev_packager is not None:
|
|
||||||
return subprocess.check_output(rpmdev_packager, text=True).strip()
|
return subprocess.check_output(rpmdev_packager, text=True).strip()
|
||||||
|
|
||||||
# If we're detecting packager identity through git configuration...
|
# If we're detecting packager identity through git configuration...
|
||||||
git = shutil.which('git')
|
if git := shutil.which('git'):
|
||||||
if git is not None:
|
|
||||||
name = subprocess.check_output([git, 'config', 'user.name'], text=True).strip()
|
name = subprocess.check_output([git, 'config', 'user.name'], text=True).strip()
|
||||||
email = subprocess.check_output([git, 'config', 'user.email'], text=True).strip()
|
email = subprocess.check_output([git, 'config', 'user.email'], text=True).strip()
|
||||||
return f'{name} <{email}>'
|
return f'{name} <{email}>'
|
||||||
|
|
1
setup.py
1
setup.py
|
@ -49,7 +49,6 @@ ARGS = dict(
|
||||||
"License :: OSI Approved :: MIT License",
|
"License :: OSI Approved :: MIT License",
|
||||||
"Operating System :: POSIX :: Linux",
|
"Operating System :: POSIX :: Linux",
|
||||||
"Programming Language :: Python :: 3 :: Only",
|
"Programming Language :: Python :: 3 :: Only",
|
||||||
"Programming Language :: Python :: 3.7",
|
|
||||||
"Programming Language :: Python :: 3.8",
|
"Programming Language :: Python :: 3.8",
|
||||||
"Programming Language :: Python :: 3.9",
|
"Programming Language :: Python :: 3.9",
|
||||||
"Programming Language :: Python :: 3.10",
|
"Programming Language :: Python :: 3.10",
|
||||||
|
|
Loading…
Reference in a new issue