Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure proper data types for command line arguments to fix #601 #602

Merged
merged 4 commits into from
Dec 8, 2023

Conversation

haraldkl
Copy link
Contributor

@haraldkl haraldkl commented Dec 7, 2023

The command line arguments also have to conform with the ProjectSettings data types. With these changes they are also passed through the converter that is also used for the MD meta data. I am not quite sure if this is the proper way to go about it, but it resolves #601 for me.

@haraldkl
Copy link
Contributor Author

haraldkl commented Dec 8, 2023

Looks like this fails the test "test_extra_mods_empty":

string_list = [''], name = 'extra_mods', sep = ':'

    def _parse_to_dict(string_list: List[str], name: str, sep: str) -> Dict[str, str]:
        """Parse a list of strings of form "key = value" into a dict
    
        Parameters
        ----------
        string_list : List[str]
            List of strings to parse
        name : str
            Name in parent settings object, only used for error message
        sep: str
            Separator between key and value
    
        """
    
        result = {}
        for string in string_list:
            try:
>               key, value = string.split(sep, 1)
E               ValueError: not enough values to unpack (expected 2, got 1)

/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/ford/settings.py:430: ValueError
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/ford/ford/test/test_md_inputs.py:22: in run_ford
    ford.run()
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/ford/__init__.py:486: in run
    proj_data, proj_docs = initialize()
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/ford/__init__.py:137: in initialize
    proj_docs, proj_data = load_settings(proj_docs, directory, args.project_file.name)
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/ford/__init__.py:316: in load_settings
    proj_data, proj_docs = load_markdown_settings(directory, proj_docs, filename)
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/ford/settings.py:312: in load_markdown_settings
    settings = convert_types_from_metapreprocessor(ProjectSettings, settings, filename)
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/ford/settings.py:386: in convert_types_from_metapreprocessor
    settings[key] = convert_setting(default_type, key, value)
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/ford/settings.py:362: in convert_setting
    return _parse_to_dict(value, name=key, sep=sep)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

@ZedThree
Copy link
Member

ZedThree commented Dec 8, 2023

Thanks @haraldkl ! There was just a typo in the call to _parse_to_dict, I've fixed that and added a test to cover --external_links explicitly

@ZedThree ZedThree merged commit 825b8e8 into Fortran-FOSS-Programmers:master Dec 8, 2023
5 checks passed
@haraldkl
Copy link
Contributor Author

haraldkl commented Dec 8, 2023

Thanks a lot for the quick look into this, the fixes and merging!

@haraldkl haraldkl deleted the fix-Lopt branch December 8, 2023 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--external_link option broken after redesign of external project handling
2 participants