Skip to content

Prefere package found in working dir if multiple were found #135

Description

@simontaurus

controller/page_package.py

search_paths= [params.creation_config.working_dir.parent]
search_paths.extend(params.additional_package_dirs)
try:
package_dir=find_package_dir(package_to_process, search_paths)
package_info=read_package_info_file(package_dir)
new_listed_pages=get_listed_pages_from_package_info(package_info)
required_packages=get_required_packages_from_package_info_file(
package_info
)
exceptExceptionase:
warn(f"Error reading package info for {package_to_process}: {e}")
new_listed_pages= []
required_packages= []

should search the workdir first, then the additional path one by one and take the first match found:

search_paths= [params.creation_config.working_dir.parent]
search_paths.extend(params.additional_package_dirs)
found_package_info=Falseforsearch_pathinsearch_paths:
try:
package_dir=find_package_dir(package_to_process, [search_path])
package_info=read_package_info_file(package_dir)
new_listed_pages=get_listed_pages_from_package_info(package_info)
required_packages=get_required_packages_from_package_info_file(
package_info
)
found_package_info=Truebreak# break the loop if package info is foundexceptFileNotFoundErrorase:
pass# non found error is expected for some search paths, so we just continue searchingexceptValueErrorase:
warn(f"Multiple package info files found for {package_to_process} in {search_path}: {e}")
ifnotfound_package_info:
warn(f"Package info for {package_to_process} not found in any of the search paths: {search_paths}")
new_listed_pages= []
required_packages= []

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions