Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions easybuild/framework/easyconfig/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@
from easybuild.tools.utilities import only_if_module_is_available, quote_str
from easybuild.tools.version import VERSION as EASYBUILD_VERSION

# Belongs in this file and should be imported from here
# but needs to be defined in the github module to avoid cyclic imports
from easybuild.tools.github import CategorizedPaths


# optional Python packages, these might be missing
# failing imports are just ignored
# a NameError should be caught where these are used
Expand Down Expand Up @@ -622,39 +627,32 @@ def dump_env_script(easyconfigs):
dump_env_easyblock(app, orig_env=orig_env, ec_path=ec.path, script_path=script_path)


def categorize_files_by_type(paths: List[PathOrStr]):
def categorize_files_by_type(paths: List[PathOrStr]) -> CategorizedPaths:
"""
Splits list of filepaths into a 4 separate lists: easyconfigs, files to delete, patch files and
files with extension .py
"""
res = {
'easyconfigs': [],
'files_to_delete': [],
'patch_files': [],
'py_files': [],
}
res = CategorizedPaths([], [], [], [])

for path in paths:
if isinstance(path, Path):
path = str(path)
if path.startswith(':'):
res['files_to_delete'].append(path[1:])
res.files_to_delete.append(path[1:])
elif path.endswith('.py'):
res['py_files'].append(path)
res.py_files.append(path)
# file must exist in order to check whether it's a patch file
elif os.path.isfile(path) and is_patch_file(path):
res['patch_files'].append(path)
res.patch_files.append(path)
elif path.endswith('.patch'):
if not os.path.exists(path):
raise EasyBuildError('File %s does not exist, did you mistype the path?', path)
elif not os.path.isfile(path):
if not os.path.isfile(path):
raise EasyBuildError('File %s is expected to be a regular file, but is a folder instead', path)
else:
raise EasyBuildError('%s is not detected as a valid patch file. Please verify its contents!',
path)
raise EasyBuildError('%s is not detected as a valid patch file. Please verify its contents!', path)
else:
# anything else is considered to be an easyconfig file
res['easyconfigs'].append(path)
res.easyconfigs.append(path)

return res

Expand Down
2 changes: 1 addition & 1 deletion easybuild/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def process_eb_args(eb_args, eb_go, cfg_settings, modtool, testing, init_session
no_ec_opts = [options.aggregate_regtest, options.regtest, any_pr_option_set, search_query]

# determine paths to easyconfigs
determined_paths = det_easyconfig_paths(categorized_paths['easyconfigs'])
determined_paths = det_easyconfig_paths(categorized_paths.easyconfigs)

# only copy easyconfigs here if we're not using --try-* (that's handled below)
copy_ec = options.copy_ec and not tweaked_ecs_paths
Expand Down
Loading
Loading