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