Fix for backtrace error when file not found in: src/fpm_source_parsing.f90#675
Fix for backtrace error when file not found in: src/fpm_source_parsing.f90#675awvwgk merged 3 commits intofortran-lang:mainfrom wiremoons:main
Conversation
|
We should already have a function called |
Fix indentation as corrected by @awvwgk Co-authored-by: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com>
Yes - that would be useful so it is available for any other file handling in Any suggestions on the best |
I meant we already have such a function: https://fortran-lang.github.io/fpm/proc/exists.html |
awvwgk
left a comment
There was a problem hiding this comment.
Thanks for sharing. This is a useful improvement.
Thanks @awvwgk. There is a lot of useful functions in that |
|
Fpm and stdlib have a somewhat ambivalent relation at the moment. While we would really like to use stdlib in fpm the size of the stdlib dependency would block us from bootstrapping fpm and on the other hand we have stdlib which currently can't be built with fpm directly but needs a separate deployment step. Both issues could be fixed on the fpm side:
Further, in fpm our development cycles so far were much faster than stdlib, when implementing features in fpm new filesystem functions are just a byproduct, while in stdlib it takes weeks to months to hammer out the API and get the required patches merged. I think this are the reasons why we didn't really see much overlap and exchange yet between fpm and stdlib, but this shouldn't discourage anyone from porting features available in fpm to stdlib to make them available for the wider Fortran ecosystem and in the long-run also in fpm again or even better try to make stdlib usage in fpm more feasible by improving fpm for stdlib. |
|
Great analysis. Can't the fpm modules also be used as a dependency in other fpm projects? |
|
Indeed you can depend on fpm like on every other fpm project. |
When using
fpm runand a source file stated in a projectsfpm.tomlis missing a backtrace would be generated - example below:This patch checks for the files existence, before any further parsing is attempted.
After applying this proposed fix, when a file is missing (as in the example above) then an error is shown instead of the backtrace:
Uses the fpm subroutine
file_not_found_errorwhich I hope is the correct action to perform on the error.