mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-13 19:08:34 +00:00
trivial: fixup black on a few more python files without python extensions
This commit is contained in:
parent
433034d675
commit
1ed118d22f
@ -11,15 +11,22 @@ import sys
|
||||
|
||||
def format_title(title):
|
||||
box = {
|
||||
'tl': '╔', 'tr': '╗', 'bl': '╚', 'br': '╝', 'h': '═', 'v': '║',
|
||||
"tl": "╔",
|
||||
"tr": "╗",
|
||||
"bl": "╚",
|
||||
"br": "╝",
|
||||
"h": "═",
|
||||
"v": "║",
|
||||
}
|
||||
hline = box['h'] * (len(title) + 2)
|
||||
hline = box["h"] * (len(title) + 2)
|
||||
|
||||
return '\n'.join([
|
||||
return "\n".join(
|
||||
[
|
||||
f"{box['tl']}{hline}{box['tr']}",
|
||||
f"{box['v']} {title} {box['v']}",
|
||||
f"{box['bl']}{hline}{box['br']}",
|
||||
])
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
def rm_rf(path):
|
||||
@ -30,16 +37,21 @@ def rm_rf(path):
|
||||
|
||||
|
||||
def sanitize_path(name):
|
||||
return name.replace('/', '-')
|
||||
return name.replace("/", "-")
|
||||
|
||||
|
||||
def get_current_revision():
|
||||
revision = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
|
||||
encoding='utf-8').strip()
|
||||
revision = subprocess.check_output(
|
||||
["git", "rev-parse", "--abbrev-ref", "HEAD"], encoding="utf-8"
|
||||
).strip()
|
||||
|
||||
if revision == 'HEAD':
|
||||
if revision == "HEAD":
|
||||
# This is a detached HEAD, get the commit hash
|
||||
revision = subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip().decode('utf-8')
|
||||
revision = (
|
||||
subprocess.check_output(["git", "rev-parse", "HEAD"])
|
||||
.strip()
|
||||
.decode("utf-8")
|
||||
)
|
||||
|
||||
return revision
|
||||
|
||||
@ -47,54 +59,78 @@ def get_current_revision():
|
||||
@contextlib.contextmanager
|
||||
def checkout_git_revision(revision):
|
||||
current_revision = get_current_revision()
|
||||
subprocess.check_call(['git', 'checkout', '-q', revision])
|
||||
subprocess.check_call(["git", "checkout", "-q", revision])
|
||||
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
subprocess.check_call(['git', 'checkout', '-q', current_revision])
|
||||
subprocess.check_call(["git", "checkout", "-q", current_revision])
|
||||
|
||||
|
||||
def build_install(revision):
|
||||
build_dir = '_build'
|
||||
build_dir = "_build"
|
||||
dest_dir = os.path.abspath(sanitize_path(revision))
|
||||
print(format_title(f'# Building and installing {revision} in {dest_dir}'),
|
||||
end='\n\n', flush=True)
|
||||
print(
|
||||
format_title(f"# Building and installing {revision} in {dest_dir}"),
|
||||
end="\n\n",
|
||||
flush=True,
|
||||
)
|
||||
|
||||
with checkout_git_revision(revision):
|
||||
rm_rf(build_dir)
|
||||
rm_rf(revision)
|
||||
|
||||
subprocess.check_call(['meson', build_dir,
|
||||
'--prefix=/usr', '--libdir=lib',
|
||||
'-Db_coverage=false', '-Dgtkdoc=false', '-Dtests=false'])
|
||||
subprocess.check_call(['ninja', '-v', '-C', build_dir])
|
||||
subprocess.check_call(['ninja', '-v', '-C', build_dir, 'install'],
|
||||
env={'DESTDIR': dest_dir})
|
||||
subprocess.check_call(
|
||||
[
|
||||
"meson",
|
||||
build_dir,
|
||||
"--prefix=/usr",
|
||||
"--libdir=lib",
|
||||
"-Db_coverage=false",
|
||||
"-Dgtkdoc=false",
|
||||
"-Dtests=false",
|
||||
]
|
||||
)
|
||||
subprocess.check_call(["ninja", "-v", "-C", build_dir])
|
||||
subprocess.check_call(
|
||||
["ninja", "-v", "-C", build_dir, "install"], env={"DESTDIR": dest_dir}
|
||||
)
|
||||
|
||||
return dest_dir
|
||||
|
||||
|
||||
def compare(old_tree, new_tree):
|
||||
print(format_title(f'# Comparing the two ABIs'), end='\n\n', flush=True)
|
||||
print(format_title(f"# Comparing the two ABIs"), end="\n\n", flush=True)
|
||||
|
||||
old_headers = os.path.join(old_tree, 'usr', 'include')
|
||||
old_lib = os.path.join(old_tree, 'usr', 'lib', 'libfwupd.so')
|
||||
old_headers = os.path.join(old_tree, "usr", "include")
|
||||
old_lib = os.path.join(old_tree, "usr", "lib", "libfwupd.so")
|
||||
|
||||
new_headers = os.path.join(new_tree, 'usr', 'include')
|
||||
new_lib = os.path.join(new_tree, 'usr', 'lib', 'libfwupd.so')
|
||||
new_headers = os.path.join(new_tree, "usr", "include")
|
||||
new_lib = os.path.join(new_tree, "usr", "lib", "libfwupd.so")
|
||||
|
||||
subprocess.check_call([
|
||||
'abidiff', '--headers-dir1', old_headers, '--headers-dir2', new_headers,
|
||||
'--drop-private-types', '--suppressions', 'contrib/ci/abidiff.suppr',
|
||||
'--fail-no-debug-info', '--no-added-syms', old_lib, new_lib])
|
||||
subprocess.check_call(
|
||||
[
|
||||
"abidiff",
|
||||
"--headers-dir1",
|
||||
old_headers,
|
||||
"--headers-dir2",
|
||||
new_headers,
|
||||
"--drop-private-types",
|
||||
"--suppressions",
|
||||
"contrib/ci/abidiff.suppr",
|
||||
"--fail-no-debug-info",
|
||||
"--no-added-syms",
|
||||
old_lib,
|
||||
new_lib,
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
parser.add_argument('old', help='the previous revision, considered the reference')
|
||||
parser.add_argument('new', help='the new revision, to compare to the reference')
|
||||
parser.add_argument("old", help="the previous revision, considered the reference")
|
||||
parser.add_argument("new", help="the new revision, to compare to the reference")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
@ -111,4 +147,4 @@ if __name__ == '__main__':
|
||||
except subprocess.CalledProcessError:
|
||||
sys.exit(1)
|
||||
|
||||
print(f'Hurray! {args.old} and {args.new} are ABI-compatible!')
|
||||
print(f"Hurray! {args.old} and {args.new} are ABI-compatible!")
|
||||
|
@ -9,22 +9,21 @@ import apt
|
||||
import apt_pkg
|
||||
|
||||
ARCH_TO_EFI_NAME = {
|
||||
'amd64': 'x64',
|
||||
'i386': 'ia32',
|
||||
'arm64': 'aa64',
|
||||
'armhf': 'arm',
|
||||
"amd64": "x64",
|
||||
"i386": "ia32",
|
||||
"arm64": "aa64",
|
||||
"armhf": "arm",
|
||||
}
|
||||
arch = apt_pkg.config['Apt::Architecture']
|
||||
arch = apt_pkg.config["Apt::Architecture"]
|
||||
efi_name = ARCH_TO_EFI_NAME[arch]
|
||||
cache = apt.Cache()
|
||||
fwupd_efi = cache["fwupd"].candidate
|
||||
pool_parsed = urlparse(fwupd_efi.uri)
|
||||
dists_dir = "/dists/devel/main/uefi/fwupd-%s/current/" % (
|
||||
fwupd_efi.architecture)
|
||||
dists_dir = "/dists/devel/main/uefi/fwupd-%s/current/" % (fwupd_efi.architecture)
|
||||
|
||||
DOWNLOAD_LIST = {
|
||||
"fwupd%s.efi.signed" % efi_name: "fwupd%s.efi.signed" % efi_name,
|
||||
"version": "fwupd%s.efi.signed.version" % efi_name
|
||||
"version": "fwupd%s.efi.signed.version" % efi_name,
|
||||
}
|
||||
for base in DOWNLOAD_LIST:
|
||||
dists_parsed = list(pool_parsed)
|
||||
|
21
po/test-deps
21
po/test-deps
@ -1,12 +1,11 @@
|
||||
#!/usr/bin/python3
|
||||
""" Check dependencies needed for rasterization """
|
||||
# SPDX-License-Identifier: LGPL-2.1+
|
||||
|
||||
"""
|
||||
SPDX-License-Identifier: LGPL-2.1+
|
||||
"""
|
||||
""" Check dependencies needed for rasterization """
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
err = 0
|
||||
|
||||
try:
|
||||
@ -15,20 +14,20 @@ except ImportError:
|
||||
print("Error: missing dependency python gobject introspection (python3-gi)")
|
||||
err = 1
|
||||
try:
|
||||
gi.require_version('Pango', '1.0')
|
||||
gi.require_version("Pango", "1.0")
|
||||
from gi.repository import Pango
|
||||
except ValueError:
|
||||
print("Error: missing pango gobject introspection library")
|
||||
err = 1
|
||||
try:
|
||||
gi.require_version('PangoCairo', '1.0')
|
||||
gi.require_version("PangoCairo", "1.0")
|
||||
from gi.repository import PangoCairo
|
||||
except ValueError:
|
||||
print("Error: missing pangocairo gobject introspection library")
|
||||
err = 1
|
||||
|
||||
try:
|
||||
gi.require_version("cairo", '1.0')
|
||||
gi.require_version("cairo", "1.0")
|
||||
from gi.repository import cairo
|
||||
except ValueError:
|
||||
print("Error: missing cairo gobject introspection library")
|
||||
@ -41,13 +40,13 @@ except ImportError:
|
||||
err = 1
|
||||
|
||||
# check that LINUGAS lists every language with a .po file
|
||||
with open('po/LINGUAS') as f:
|
||||
with open("po/LINGUAS") as f:
|
||||
langs = f.read().splitlines()
|
||||
for root, dirs, files in os.walk('po'):
|
||||
for root, dirs, files in os.walk("po"):
|
||||
for file in files:
|
||||
if not file.endswith('.po'):
|
||||
if not file.endswith(".po"):
|
||||
continue
|
||||
l = file.split('.po')
|
||||
l = file.split(".po")
|
||||
if len(l) > 1 and not l[0] in langs:
|
||||
err = 1
|
||||
print("Error: missing translations for %s" % l[0])
|
||||
|
Loading…
Reference in New Issue
Block a user