Skip to content
Snippets Groups Projects
Commit d24f093a authored by Luke Naylor's avatar Luke Naylor
Browse files

Refactor py lib make targets and add unified target

parent 7183adfc
No related branches found
No related tags found
No related merge requests found
Pipeline #32181 passed
...@@ -3,51 +3,36 @@ ...@@ -3,51 +3,36 @@
MAINTEXFILE = main.tex MAINTEXFILE = main.tex
TEXFILES = ${MAINTEXFILE} TEXFILES = ${MAINTEXFILE}
SAGETEXSCRIPT = main.sagetex.sage NOTEBOOKBASENAMES = plots_and_expressions examples characteristic_curves rank_zero_case other_P_choice
main.pdf: ${TEXFILES} main.sagetex.sout.tmp main.pdf: ${TEXFILES} main.sagetex.sout.tmp
latexmk latexmk
main.sagetex.sout.tmp: ${SAGETEXSCRIPT} plots_and_expressions.py examples.py characteristic_curves.py rank_zero_case.py other_P_choice.py sage_artifacts: main.sagetex.sout.tmp
SAGETEXSCRIPT = main.sagetex.sage
main.sagetex.sout.tmp: ${SAGETEXSCRIPT} notebook_py_libs
PYTHONPATH=./sagetexscripts/ sage ${SAGETEXSCRIPT} PYTHONPATH=./sagetexscripts/ sage ${SAGETEXSCRIPT}
${SAGETEXSCRIPT}: ${TEXFILES} ${SAGETEXSCRIPT}: ${TEXFILES}
latexmk || echo this shoud fail latexmk || echo this shoud fail
plots_and_expressions.py: plots_and_expressions.ipynb # PYTHON LIBS FROM NOTEBOOKS
jupyter nbconvert --to script plots_and_expressions.ipynb
mv plots_and_expressions.py plots_and_expressions.sage define NOTEBOOK_TO_LIB_RULE
sed -e "/get_ipython/d" -i plots_and_expressions.sage $(1).py: $(1).ipynb
sage --preparse plots_and_expressions.sage jupyter nbconvert --to script $(1).ipynb
mv plots_and_expressions.sage.py plots_and_expressions.py mv $(1).py $(1).sage
sed -e "/get_ipython/d" -i $(1).sage
examples.py: plots_and_expressions.py examples.ipynb sage --preparse $(1).sage
jupyter nbconvert --to script examples.ipynb mv $(1).sage.py $(1).py
mv examples.py examples.sage endef
sed -e "/get_ipython/d" -i examples.sage
sage --preparse examples.sage $(foreach _base, $(NOTEBOOKBASENAMES), $(eval $(call NOTEBOOK_TO_LIB_RULE, $(_base))))
mv examples.sage.py examples.py
notebook_py_libs: $(addsuffix .py, $(NOTEBOOKBASENAMES))
characteristic_curves.py: characteristic_curves.ipynb
jupyter nbconvert --to script characteristic_curves.ipynb # MISCELANEOUS
mv characteristic_curves.py characteristic_curves.sage
sed -e "/get_ipython/d" -i characteristic_curves.sage
sage --preparse characteristic_curves.sage
mv characteristic_curves.sage.py characteristic_curves.py
rank_zero_case.py: rank_zero_case.ipynb
jupyter nbconvert --to script rank_zero_case.ipynb
mv rank_zero_case.py rank_zero_case.sage
sed -e "/get_ipython/d" -i rank_zero_case.sage
sage --preparse rank_zero_case.sage
mv rank_zero_case.sage.py rank_zero_case.py
other_P_choice.py: other_P_choice.ipynb
jupyter nbconvert --to script other_P_choice.ipynb
mv other_P_choice.py other_P_choice.sage
sed -e "/get_ipython/d" -i other_P_choice.sage
sage --preparse other_P_choice.sage
mv other_P_choice.sage.py other_P_choice.py
.PHONY: clean nosage noappendix .PHONY: clean nosage noappendix
clean: clean:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment