style: exit early to reduce indentation

This commit is contained in:
Paul McCarthy
2022-04-19 16:00:12 +01:00
parent 30627ae04f
commit baf3ead650
2 changed files with 29 additions and 25 deletions
+16 -14
View File
@@ -275,21 +275,23 @@ def build(options: Options, tmp_path: Path) -> None:
options.globals.build_selector, options.globals.architectures options.globals.build_selector, options.globals.architectures
) )
try: if len(python_configurations) == 0:
if len(python_configurations) > 0: return
before_all_options_identifier = python_configurations[0].identifier
before_all_options = options.build_options(before_all_options_identifier)
if before_all_options.before_all: try:
log.step("Running before_all...") before_all_options_identifier = python_configurations[0].identifier
env = before_all_options.environment.as_dictionary(prev_environment=os.environ) before_all_options = options.build_options(before_all_options_identifier)
env.setdefault("MACOSX_DEPLOYMENT_TARGET", "10.9")
before_all_prepared = prepare_command( if before_all_options.before_all:
before_all_options.before_all, log.step("Running before_all...")
project=".", env = before_all_options.environment.as_dictionary(prev_environment=os.environ)
package=before_all_options.package_dir, env.setdefault("MACOSX_DEPLOYMENT_TARGET", "10.9")
) before_all_prepared = prepare_command(
shell(before_all_prepared, env=env) before_all_options.before_all,
project=".",
package=before_all_options.package_dir,
)
shell(before_all_prepared, env=env)
for config in python_configurations: for config in python_configurations:
build_options = options.build_options(config.identifier) build_options = options.build_options(config.identifier)
+13 -11
View File
@@ -234,18 +234,20 @@ def build(options: Options, tmp_path: Path) -> None:
options.globals.build_selector, options.globals.architectures options.globals.build_selector, options.globals.architectures
) )
try: if len(python_configurations) == 0:
if len(python_configurations) > 0: return
before_all_options_identifier = python_configurations[0].identifier
before_all_options = options.build_options(before_all_options_identifier)
if before_all_options.before_all: try:
log.step("Running before_all...") before_all_options_identifier = python_configurations[0].identifier
env = before_all_options.environment.as_dictionary(prev_environment=os.environ) before_all_options = options.build_options(before_all_options_identifier)
before_all_prepared = prepare_command(
before_all_options.before_all, project=".", package=options.globals.package_dir if before_all_options.before_all:
) log.step("Running before_all...")
shell(before_all_prepared, env=env) env = before_all_options.environment.as_dictionary(prev_environment=os.environ)
before_all_prepared = prepare_command(
before_all_options.before_all, project=".", package=options.globals.package_dir
)
shell(before_all_prepared, env=env)
for config in python_configurations: for config in python_configurations:
build_options = options.build_options(config.identifier) build_options = options.build_options(config.identifier)