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

Need to expand environment variables while copying referenced files #127

Closed
thomthom opened this issue Mar 18, 2020 · 4 comments
Closed

Comments

@thomthom
Copy link

I was trying out m.css and it looks really promising. I found one issue in while testing this, we use environment variables in the Doxygen config for some of the reference files.

m.css/documentation/doxygen.py

Lines 3642 to 3660 in 6eefd92

# Copy all referenced files
for i in state.images + state.doxyfile['HTML_EXTRA_STYLESHEET'] + state.doxyfile['HTML_EXTRA_FILES'] + ([state.doxyfile['PROJECT_LOGO']] if state.doxyfile['PROJECT_LOGO'] else []) + ([state.doxyfile['M_FAVICON'][0]] if state.doxyfile['M_FAVICON'] else []) + ([] if state.doxyfile['M_SEARCH_DISABLED'] else ['search.js']):
# Skip absolute URLs
if urllib.parse.urlparse(i).netloc: continue
# The search.js is special, we encode the version information into its
# filename
file_out = search_filename if i == 'search.js' else i
# If file is found relative to the Doxyfile, use that
if os.path.exists(os.path.join(state.basedir, i)):
i = os.path.join(state.basedir, i)
# Otherwise use path relative to script directory
else:
i = os.path.join(os.path.dirname(os.path.realpath(__file__)), i)
logging.debug("copying {} to output".format(i))
shutil.copy(i, os.path.join(html_output, os.path.basename(file_out)))

I think this can be addressed by having the script expand the environment variables. I could give it a stab to create a PR if that sounds acceptable.

@mosra
Copy link
Owner

mosra commented Jun 8, 2020

Hi,

this should be possible since 1c133b1 -- there's now a possibility to supply most of the options from a python config file, which is done to alllow a lot more flexibility (among the planned features is supplying URL formatter functions, hooks for code processing etc.) and should also make your case possible -- in particular, take a "template" input Doxyfile, expand env vars in it and save it to a Doxyfile that then gets processed further. Or if you need that in the EXTRA_FILES / STYLESHEETS / FAVICON ... options that can be specified directly through Python, you don't even need to do any Doxyfile processing.

The original way through the Doxyfile is still supported for backwards compatibility of course, but the Python file is the preferred way going forward.

@mosra mosra closed this as completed Jun 8, 2020
@thomthom
Copy link
Author

thomthom commented Jun 8, 2020

That sounds great! Having the config for m.css makes sense as well. I'm in the process of converting our current docs to m.css and I have a separate Doxyfile that inherits from the main one just for that.
Having the config file in python allows for even more flexibility. 👍

@mosra
Copy link
Owner

mosra commented Jun 8, 2020

The split is a bit weird at this point (you still need to patch the original Doxyfile to enable the XML output and disable the HTML output) so you most probably end up with three files anyway. In the future I might consider adding an ability to generate a Doxyfile from a pure-python config, but right now it's like this.

@thomthom
Copy link
Author

thomthom commented Jun 8, 2020

That's fine, an extra file doesn't hurt. Main value is being able to use environment variable to account for local dev environment vs build machine environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants