Merge pull request #84 from benjamin-weiss/makefile-optimization
optimized Makefile structure and improved install/uninstall
This commit is contained in:
commit
3d6ffa8208
|
@ -1,6 +1,5 @@
|
||||||
demo.pdf
|
demo.pdf
|
||||||
mtheme.pdf
|
mtheme.pdf
|
||||||
login.json
|
|
||||||
|
|
||||||
*.fls
|
*.fls
|
||||||
*.acn
|
*.acn
|
||||||
|
|
34
Makefile
34
Makefile
|
@ -5,6 +5,7 @@ DTX = $(wildcard *.dtx)
|
||||||
STY = $(patsubst %.dtx,%.sty,$(wildcard beamer*.dtx))
|
STY = $(patsubst %.dtx,%.sty,$(wildcard beamer*.dtx))
|
||||||
TEXMFHOME = $(shell kpsewhich -var-value=TEXMFHOME)
|
TEXMFHOME = $(shell kpsewhich -var-value=TEXMFHOME)
|
||||||
INSTALL_DIR = $(TEXMFHOME)/tex/latex/mtheme
|
INSTALL_DIR = $(TEXMFHOME)/tex/latex/mtheme
|
||||||
|
MANUAL_DIR = $(TEXMFHOME)/doc/latex/mtheme
|
||||||
TEMP_DIR = .temptex
|
TEMP_DIR = .temptex
|
||||||
|
|
||||||
DEMO_SRC = demo.tex
|
DEMO_SRC = demo.tex
|
||||||
|
@ -17,31 +18,44 @@ DOCKER_IMAGE = latex-image
|
||||||
DOCKER_CONTAINER = latex-container
|
DOCKER_CONTAINER = latex-container
|
||||||
|
|
||||||
|
|
||||||
.PHONY: clean install manual sty docker-run docker-rm
|
.PHONY: sty manual demo ctan clean install uninstall docker-run docker-build docker-rm
|
||||||
|
|
||||||
|
all: sty manual demo
|
||||||
|
|
||||||
all: sty demo contributors manual
|
$(STY): $(DTX) $(INS)
|
||||||
|
|
||||||
sty: $(DTX) $(INS)
|
|
||||||
@latex $(INS)
|
@latex $(INS)
|
||||||
|
|
||||||
demo: $(STY) $(DEMO_SRC)
|
$(DEMO_PDF): $(STY) $(DEMO_SRC)
|
||||||
$(TEXC) $(DEMO_SRC)
|
$(TEXC) $(DEMO_SRC)
|
||||||
@cp $(TEMP_DIR)/$(DEMO_PDF) .
|
@cp $(TEMP_DIR)/$(DEMO_PDF) .
|
||||||
|
|
||||||
$(CONTRIB_TEX):$(CONTRIB_SRC)
|
$(MANUAL_PDF): $(MANUAL_SRC)
|
||||||
@python $(CONTRIB_SRC)
|
|
||||||
|
|
||||||
manual: $(MANUAL_SRC) $(CONTRIB_TEX)
|
|
||||||
@$(TEXC) $(MANUAL_SRC)
|
@$(TEXC) $(MANUAL_SRC)
|
||||||
@cp $(TEMP_DIR)/$(MANUAL_PDF) .
|
@cp $(TEMP_DIR)/$(MANUAL_PDF) .
|
||||||
|
|
||||||
|
sty: $(STY)
|
||||||
|
|
||||||
|
manual: $(MANUAL_PDF)
|
||||||
|
|
||||||
|
demo: $(DEMO_PDF)
|
||||||
|
|
||||||
|
ctan:
|
||||||
|
@echo Not yet implemented.
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@git clean -xfd
|
@git clean -xfd
|
||||||
|
|
||||||
install: $(STY)
|
install: $(STY) $(MANUAL_PDF)
|
||||||
@mkdir -p $(INSTALL_DIR)
|
@mkdir -p $(INSTALL_DIR)
|
||||||
@cp $(STY) $(INSTALL_DIR)
|
@cp $(STY) $(INSTALL_DIR)
|
||||||
|
@mkdir -p $(MANUAL_DIR)
|
||||||
|
@cp $(MANUAL_PDF) $(MANUAL_DIR)
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
@rm -f $(addprefix $(INSTALL_DIR)/, $(STY))
|
||||||
|
@rm -f $(MANUAL_DIR)/$(MANUAL_PDF)
|
||||||
|
@rmdir $(INSTALL_DIR)
|
||||||
|
@rmdir $(MANUAL_DIR)
|
||||||
|
|
||||||
docker-run: docker-build
|
docker-run: docker-build
|
||||||
docker run --rm=true --name $(DOCKER_CONTAINER) -i -t -v `pwd`:/data $(DOCKER_IMAGE) /data/build.sh
|
docker run --rm=true --name $(DOCKER_CONTAINER) -i -t -v `pwd`:/data $(DOCKER_IMAGE) /data/build.sh
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
import sys
|
|
||||||
import requests
|
|
||||||
import json
|
|
||||||
|
|
||||||
LOGIN = None
|
|
||||||
try:
|
|
||||||
with open("login.json", "r") as f:
|
|
||||||
login_data = json.load(f)
|
|
||||||
if (login_data['user'] and login_data['password']):
|
|
||||||
LOGIN = (login_data['user'],
|
|
||||||
login_data['password'])
|
|
||||||
except:
|
|
||||||
print("Couldn't open file 'login.json'.")
|
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
|
|
||||||
def apiRequestLeft():
|
|
||||||
resp = requests.get("https://api.github.com/rate_limit",
|
|
||||||
auth=LOGIN)
|
|
||||||
if(resp.ok):
|
|
||||||
data = json.loads(resp.content)
|
|
||||||
return data['rate']['remaining']
|
|
||||||
else:
|
|
||||||
return 0
|
|
||||||
|
|
||||||
if not (apiRequestLeft):
|
|
||||||
print("No API requests left to load contributors list. ")
|
|
||||||
if(LOGIN is None):
|
|
||||||
print ("To get more API requests enter your login data into " +
|
|
||||||
"'login.json'")
|
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
resp = requests.get("https://api.github.com/repos/matze/mtheme/contributors",
|
|
||||||
auth=LOGIN)
|
|
||||||
|
|
||||||
latex_string = "\\begin{itemize}\n"
|
|
||||||
if(resp.ok):
|
|
||||||
data = json.loads(resp.content)
|
|
||||||
extracted_data = ((c['login'], c['html_url'], c['url']) for c in data)
|
|
||||||
for user_name, html_url, url in extracted_data:
|
|
||||||
resp = requests.get(url, auth=LOGIN)
|
|
||||||
if(resp.ok):
|
|
||||||
user_data = json.loads(resp.content)
|
|
||||||
try:
|
|
||||||
name = user_data['name']
|
|
||||||
except:
|
|
||||||
name = ""
|
|
||||||
else:
|
|
||||||
if not (apiRequestLeft):
|
|
||||||
name = "Couldn't load name. API request limit exceeded."
|
|
||||||
else:
|
|
||||||
"Couldn't load name."
|
|
||||||
latex_string += str(" \\item \\href{%s}{%s} %s\n" % (html_url,
|
|
||||||
user_name,
|
|
||||||
name))
|
|
||||||
else:
|
|
||||||
latex_string += " \\item Couldn't load contributors.\n"
|
|
||||||
latex_string += "\\end{itemize}\n"
|
|
||||||
|
|
||||||
try:
|
|
||||||
with open("contributors.tex", "w") as f:
|
|
||||||
f.write(latex_string)
|
|
||||||
print("Successfully written data to file.")
|
|
||||||
print(latex_string)
|
|
||||||
except IOError:
|
|
||||||
print("Error writing to file.")
|
|
|
@ -1,17 +0,0 @@
|
||||||
\begin{itemize}
|
|
||||||
\item \href{https://github.com/matze}{matze} Matthias Vogelgesang
|
|
||||||
\item \href{https://github.com/rchurchley}{rchurchley} Ross Churchley
|
|
||||||
\item \href{https://github.com/benjamin-weiss}{benjamin-weiss} Benjamin Weiss
|
|
||||||
\item \href{https://github.com/eddelbuettel}{eddelbuettel} Dirk Eddelbuettel
|
|
||||||
\item \href{https://github.com/ronnychevalier}{ronnychevalier} Ronny Chevalier
|
|
||||||
\item \href{https://github.com/jdahm}{jdahm} Johann Dahm
|
|
||||||
\item \href{https://github.com/Schwefelsaeure}{Schwefelsaeure}
|
|
||||||
\item \href{https://github.com/awalterschulze}{awalterschulze} Walter Schulze
|
|
||||||
\item \href{https://github.com/ehahn}{ehahn} Erik Hahn
|
|
||||||
\item \href{https://github.com/ChipmunkMath}{ChipmunkMath}
|
|
||||||
\item \href{https://github.com/timbers}{timbers} Finbarr Timbers
|
|
||||||
\item \href{https://github.com/kdungs}{kdungs} Kevin Dungs
|
|
||||||
\item \href{https://github.com/Leonidas-from-XIV}{Leonidas-from-XIV} Marek Kubica
|
|
||||||
\item \href{https://github.com/0ip}{0ip} Robin Buse
|
|
||||||
\item \href{https://github.com/cuzcomd}{cuzcomd}
|
|
||||||
\end{itemize}
|
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"user": "",
|
|
||||||
"password": ""
|
|
||||||
}
|
|
Loading…
Reference in New Issue