@@ -333,11 +333,23 @@ def process_eb_args(eb_args, eb_go, cfg_settings, modtool, testing, init_session
333333
334334 categorized_paths = categorize_files_by_type (eb_args )
335335
336+ set_pr_options = [opt for opt in (
337+ 'new_branch_github' ,
338+ 'new_pr' ,
339+ 'new_pr_from_branch' ,
340+ 'preview_pr' ,
341+ 'sync_branch_with_develop' ,
342+ 'sync_pr_with_develop' ,
343+ 'update_branch_github' ,
344+ 'update_pr' ,
345+ ) if getattr (options , opt )
346+ ]
347+ any_pr_option_set = len (set_pr_options ) > 0
348+ if len (set_pr_options ) > 1 :
349+ raise EasyBuildError ("The following options are set but incompatible: %s.\n You can only use one at a time!" ,
350+ ', ' .join (['--' + opt .replace ('_' , '-' ) for opt in set_pr_options ]))
336351 # command line options that do not require any easyconfigs to be specified
337- pr_options = options .new_branch_github or options .new_pr or options .new_pr_from_branch or options .preview_pr
338- pr_options = pr_options or options .sync_branch_with_develop or options .sync_pr_with_develop
339- pr_options = pr_options or options .update_branch_github or options .update_pr
340- no_ec_opts = [options .aggregate_regtest , options .regtest , pr_options , search_query ]
352+ no_ec_opts = [options .aggregate_regtest , options .regtest , any_pr_option_set , search_query ]
341353
342354 # determine paths to easyconfigs
343355 determined_paths = det_easyconfig_paths (categorized_paths ['easyconfigs' ])
@@ -427,9 +439,10 @@ def process_eb_args(eb_args, eb_go, cfg_settings, modtool, testing, init_session
427439 forced = options .force or options .rebuild
428440 dry_run_mode = options .dry_run or options .dry_run_short or options .missing_modules
429441
430- keep_available_modules = forced or dry_run_mode or options .extended_dry_run or pr_options or options .copy_ec
431- keep_available_modules = keep_available_modules or options .inject_checksums or options .sanity_check_only
432- keep_available_modules = keep_available_modules or options .inject_checksums_to_json
442+ keep_available_modules = any ((
443+ forced , dry_run_mode , options .extended_dry_run , any_pr_option_set , options .copy_ec , options .inject_checksums ,
444+ options .sanity_check_only , options .inject_checksums_to_json )
445+ )
433446
434447 # skip modules that are already installed unless forced, or unless an option is used that warrants not skipping
435448 if not keep_available_modules :
@@ -448,12 +461,12 @@ def process_eb_args(eb_args, eb_go, cfg_settings, modtool, testing, init_session
448461 if len (easyconfigs ) > 0 :
449462 # resolve dependencies if robot is enabled, except in dry run mode
450463 # one exception: deps *are* resolved with --new-pr or --update-pr when dry run mode is enabled
451- if options .robot and (not dry_run_mode or pr_options ):
464+ if options .robot and (not dry_run_mode or any_pr_option_set ):
452465 print_msg ("resolving dependencies ..." , log = _log , silent = testing )
453466 ordered_ecs = resolve_dependencies (easyconfigs , modtool )
454467 else :
455468 ordered_ecs = easyconfigs
456- elif pr_options :
469+ elif any_pr_option_set :
457470 ordered_ecs = None
458471 else :
459472 print_msg ("No easyconfigs left to be built." , log = _log , silent = testing )
@@ -472,7 +485,7 @@ def process_eb_args(eb_args, eb_go, cfg_settings, modtool, testing, init_session
472485 return True
473486
474487 # creating/updating PRs
475- if pr_options :
488+ if any_pr_option_set :
476489 if options .new_pr :
477490 new_pr (categorized_paths , ordered_ecs )
478491 elif options .new_branch_github :
0 commit comments