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
)
try:
if len(python_configurations) > 0:
before_all_options_identifier = python_configurations[0].identifier
before_all_options = options.build_options(before_all_options_identifier)
if len(python_configurations) == 0:
return
if before_all_options.before_all:
log.step("Running before_all...")
env = before_all_options.environment.as_dictionary(prev_environment=os.environ)
env.setdefault("MACOSX_DEPLOYMENT_TARGET", "10.9")
before_all_prepared = prepare_command(
before_all_options.before_all,
project=".",
package=before_all_options.package_dir,
)
shell(before_all_prepared, env=env)
try:
before_all_options_identifier = python_configurations[0].identifier
before_all_options = options.build_options(before_all_options_identifier)
if before_all_options.before_all:
log.step("Running before_all...")
env = before_all_options.environment.as_dictionary(prev_environment=os.environ)
env.setdefault("MACOSX_DEPLOYMENT_TARGET", "10.9")
before_all_prepared = prepare_command(
before_all_options.before_all,
project=".",
package=before_all_options.package_dir,
)
shell(before_all_prepared, env=env)
for config in python_configurations:
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
)
try:
if len(python_configurations) > 0:
before_all_options_identifier = python_configurations[0].identifier
before_all_options = options.build_options(before_all_options_identifier)
if len(python_configurations) == 0:
return
if before_all_options.before_all:
log.step("Running before_all...")
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)
try:
before_all_options_identifier = python_configurations[0].identifier
before_all_options = options.build_options(before_all_options_identifier)
if before_all_options.before_all:
log.step("Running before_all...")
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:
build_options = options.build_options(config.identifier)