Skip to content

Commit 2be8f7e

Browse files
committed
format using black
1 parent 181a64d commit 2be8f7e

File tree

10 files changed

+39
-29
lines changed

10 files changed

+39
-29
lines changed

appimagebuilder/commands/run_test.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,14 @@ def _load_tests(self, test_settings: {}):
4747
if isinstance(env, dict):
4848
env = ["%s=%s" % (k, v) for k, v in env.items()]
4949

50-
test = ExecutionTest(appdir=self.app_dir, name=name, image=data_accessor.image(),
51-
command=data_accessor.command(), before_command=data_accessor.before_command(),
52-
env=env)
50+
test = ExecutionTest(
51+
appdir=self.app_dir,
52+
name=name,
53+
image=data_accessor.image(),
54+
command=data_accessor.command(),
55+
before_command=data_accessor.before_command(),
56+
env=env,
57+
)
5358
test_cases.append(test)
5459

5560
return test_cases

appimagebuilder/modules/appimage.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ def __init__(self, context: Context):
2525
self.app_version = context.app_info.version
2626

2727
self.target_arch = context.recipe.AppImage.arch()
28-
self.update_information = context.recipe.AppImage["update-information"]() or "None"
28+
self.update_information = (
29+
context.recipe.AppImage["update-information"]() or "None"
30+
)
2931
self.guess_update_information = False
3032

3133
if self.update_information == "None":

appimagebuilder/modules/deploy/files/dependencies_resolver/elf_resolver.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,21 @@ def _resolved_needed_using_ldd(file):
4848

4949
# set locale to C to avoid output variations due localizations
5050
_proc_env = os.environ.copy()
51-
_proc_env['LC_ALL'] = "C"
51+
_proc_env["LC_ALL"] = "C"
5252

53-
_proc = subprocess.run([ldd_bin, str(file)], stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=_proc_env)
53+
_proc = subprocess.run(
54+
[ldd_bin, str(file)],
55+
stdout=subprocess.PIPE,
56+
stderr=subprocess.PIPE,
57+
env=_proc_env,
58+
)
5459

5560
# process output
5661
output = _proc.stdout.decode()
5762
needed_libraries = []
5863
for line in output.splitlines():
5964
# match paths in lines
60-
path_search = re.search(r'(/.*)\s?\(', line)
65+
path_search = re.search(r"(/.*)\s?\(", line)
6166
if path_search:
6267
path = path_search.group(1)
6368
needed_libraries.append(path.strip())

appimagebuilder/modules/deploy/files/dependencies_resolver/resolver.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ class Resolver(BaseResolver):
2121
"""
2222

2323
def __init__(self):
24-
self.resolvers = [
25-
ElfResolver()
26-
]
24+
self.resolvers = [ElfResolver()]
2725

2826
def resolve(self, files: [pathlib.Path]) -> [pathlib.Path]:
2927
results = set()

appimagebuilder/modules/generate/recipe_sections/test_section_generator.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,5 @@ def generate(self):
2525
section = {}
2626
for image in self.docker_images:
2727
test_case_title = image.rsplit(":", maxsplit=1)[1]
28-
section[test_case_title] = {
29-
"image": image,
30-
"command": "./AppRun"
31-
}
28+
section[test_case_title] = {"image": image, "command": "./AppRun"}
3229
return section

appimagebuilder/modules/setup/generator.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ def generate(self):
6161
runtime_env = self._configure_runtime_environment()
6262

6363
scanner = ExecutablesScanner(self.appdir_path, self.finder)
64-
resolver = AppRunBinariesResolver(self.apprun_version, self.apprun_debug, self.context.build_dir)
64+
resolver = AppRunBinariesResolver(
65+
self.apprun_version, self.apprun_debug, self.context.build_dir
66+
)
6567
patcher = ExecutablesPatcher()
6668

6769
executables = self._find_executables(scanner)
@@ -216,9 +218,9 @@ def parse_env_input(self, user_env_input):
216218
v = v.replace("${APPDIR}", self.appdir_path.__str__())
217219

218220
if (
219-
k == "PATH"
220-
or k == "APPDIR_LIBRARY_PATH"
221-
or k == "APPDIR_LIBC_LIBRARY_PATH"
221+
k == "PATH"
222+
or k == "APPDIR_LIBRARY_PATH"
223+
or k == "APPDIR_LIBC_LIBRARY_PATH"
222224
):
223225
v = v.split(":")
224226

@@ -227,7 +229,7 @@ def parse_env_input(self, user_env_input):
227229
return env
228230

229231
def _deploy_apprun_hooks(
230-
self, apprun_binaries_resolver: AppRunBinariesResolver, runtime_env: Environment
232+
self, apprun_binaries_resolver: AppRunBinariesResolver, runtime_env: Environment
231233
):
232234

233235
for arch in self.apprun_arch:

appimagebuilder/modules/setup/icon_bundler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ def _get_icon_path(self):
4747
# include target AppDir paths
4848
search_paths = [
4949
os.path.join(self.app_dir, "usr", "share"),
50-
os.path.join(self.app_dir, "usr", "local", "share")
50+
os.path.join(self.app_dir, "usr", "local", "share"),
5151
]
5252

5353
# include system data dirs
54-
data_dirs = os.getenv('XDG_DATA_DIRS', default="")
54+
data_dirs = os.getenv("XDG_DATA_DIRS", default="")
5555
search_paths.extend(data_dirs.split(":"))
5656

5757
refined_search_paths = []

appimagebuilder/modules/test/execution_test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121

2222

2323
class ExecutionTest:
24-
def __init__(self, appdir: Path, name, image, command, before_command=None, env: [str] = None):
24+
def __init__(
25+
self, appdir: Path, name, image, command, before_command=None, env: [str] = None
26+
):
2527
if env is None:
2628
env = []
2729

@@ -98,7 +100,7 @@ def _print_container_logs(self, ctr):
98100
def _get_container_volumes(self):
99101
volumes = {
100102
self.appdir: {"bind": "/app", "mode": "ro"},
101-
"/tmp/.X11-unix": {"bind": "/tmp/.X11-unix", "mode": "rw"}
103+
"/tmp/.X11-unix": {"bind": "/tmp/.X11-unix", "mode": "rw"},
102104
}
103105

104106
dbus_session_address = os.getenv("DBUS_SESSION_BUS_ADDRESS")

tests/commands/run_script.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ def test_use_pass_env(self):
4444
"fi",
4545
]
4646
)
47-
command = RunScriptCommand(
48-
self.fake_context, script, env={"var": "value"}
49-
)
47+
command = RunScriptCommand(self.fake_context, script, env={"var": "value"})
5048
command()
5149

5250
def test_builder_env_set(self):

tests/modules/deploy/file/dependencies_resolver/TestElfResolver.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
import unittest
1414
from shutil import which
1515

16-
from appimagebuilder.modules.deploy.files.dependencies_resolver.elf_resolver import ElfResolver
16+
from appimagebuilder.modules.deploy.files.dependencies_resolver.elf_resolver import (
17+
ElfResolver,
18+
)
1719

1820

1921
class ElfResolverTestCase(unittest.TestCase):
20-
2122
def setUp(self) -> None:
2223
self.bash_path = pathlib.Path(which("bash"))
2324
self.resolver = ElfResolver()
@@ -28,5 +29,5 @@ def test_resolve_needed_recursively(self):
2829
self.assertIn("/lib/x86_64-linux-gnu/libc.so.6", results)
2930

3031

31-
if __name__ == '__main__':
32+
if __name__ == "__main__":
3233
unittest.main()

0 commit comments

Comments
 (0)