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

In docs makefile: move declaration of CURRENT_PATH variable up, this … #8

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

lisajulia
Copy link
Collaborator

…was causing an error for me before

@lisajulia lisajulia requested a review from hakonhagland January 9, 2025 06:52
@hakonhagland
Copy link
Collaborator

was causing an error for me before

@lisajulia What kind of error did you get?

@lisajulia
Copy link
Collaborator Author

lisajulia commented Jan 9, 2025

was causing an error for me before

@lisajulia What kind of error did you get?

The variable was not set, i.e.:

opm-python-documentation/python/sphinx_docs$ make
sphinx-versioned -m $CURRENT_BRANCH -b $CURRENT_BRANCH --git-root ../../
| SUCCESS  | - latched into the git repo
| SUCCESS  | - located conf.py
| WARNING  | - git head detached: True
| INFO     | - pre-building: master
/home/lnebel/git_repos/opm-pyaction/opm-python-documentation/python/docstrings_common.json
/home/lnebel/git_repos/opm-pyaction/opm-python-documentation/python/docstrings_simulators.json
| SUCCESS  | - pre-build succeded for master :)
| SUCCESS  | - Prebuilding successful for master
| INFO     | - Building: master
| INFO     | - Theme: sphinx_rtd_theme
/home/lnebel/git_repos/opm-pyaction/opm-python-documentation/python/docstrings_common.json
/home/lnebel/git_repos/opm-pyaction/opm-python-documentation/python/docstrings_simulators.json
| SUCCESS  | - build succeded for master ;)
| CRITICAL | - main branch `-b` not found!! / not building `-b`; top-level `index.html` will not be generated!

 Successfully built master 

@hakonhagland
Copy link
Collaborator

Thanks! I think I see the problem now: each line in a Makefile recipe is executed in its own shell, so the second line in docs will not know about the variable set in the first line. Then, we could also fix this by converting the two lines into a single line like this:

   @CURRENT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD) && \
    sphinx-versioned -m $$CURRENT_BRANCH -b $$CURRENT_BRANCH --git-root ../../

Or make CURRENT_BRANCH a global variable as proposed in this PR.

@hakonhagland hakonhagland merged commit 892f35c into OPM:master Jan 9, 2025
@lisajulia lisajulia deleted the fix/docs-Makefile branch January 9, 2025 07:54
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.

2 participants