aradi / fypp

Python powered Fortran preprocessor
http://fypp.readthedocs.io
BSD 2-Clause "Simplified" License
188 stars 30 forks source link

Dependency generation for fypp #13

Closed rhdtownsend closed 3 years ago

rhdtownsend commented 3 years ago

Is there a straightfoward way for fypp to generate dependency information? That is, process a file and print out a list of other files that get in included by #:include directives.

It looks like this can be done by subclassing Parser and overriding handle_include(), but how do I then get the Fypp class to use my Parser subclass rather than the default class?

Thanks!

Rich

aradi commented 3 years ago

Indeed, the current API does not allow for customizing on the Fypp object level. The Fypp object initializes the parser, the builder and the render, based on the options it gets via the FyppOptions object (the command line arguments) and then creates a Processor object with them. So, depending what you are planning to do, you have two options:

In case you choose the 2nd option, you might consider to make a PR on the API change of Fypp.

aradi commented 3 years ago

Implemented in f97100b5f