diff --git a/src/how_to_contribute/Makefile b/src/how_to_contribute/Makefile index b5cce220b08410a4ac13808c036386f9e0011738..1f2315c0f899d0ad75402f7ee76b83e47d997524 100644 --- a/src/how_to_contribute/Makefile +++ b/src/how_to_contribute/Makefile @@ -10,6 +10,13 @@ MAIN_NAME=how_to_contribute PDF_NAME=$(MAIN_NAME).pdf OUT_MAIN_NAME=How_to_Contribute +# Operating system +ifeq ($(OS),Windows_NT) + MYPYTHON:=python +else + MYPYTHON:=python3 +endif + # You want latexmk to *always* run, because make does not have all the info. .PHONY: clean @@ -48,5 +55,5 @@ release: $(PDF_NAME) clean prerelease echo $(ALL_RELEASE) prerelease: - $(eval MYPATH:=$(shell python3 ../mysmartcp.py -1)) + $(eval MYPATH:=$(shell $(MYPYTHON) ../mysmartcp.py -1)) mkdir -p "${MYPATH}" diff --git a/src/myencode.py b/src/myencode.py new file mode 100644 index 0000000000000000000000000000000000000000..56ba91022e804cdf0f266241e83c7dfecc606a27 --- /dev/null +++ b/src/myencode.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Created on Sat Apr 11 10:31:33 2020 + +@author: Martin Braquet +""" + +import sys + +if sys.platform.startswith('win32'): + print(sys.argv[1].encode("latin-1").decode("utf-8")) +else: + print(sys.argv[1]) diff --git a/src/mysmartcp.py b/src/mysmartcp.py index 63e4d496ab7c9c756822a9ec0010fe5f38bdf8a1..6313e3585f8103d4a40f1351e7ea147ef2532247 100644 --- a/src/mysmartcp.py +++ b/src/mysmartcp.py @@ -50,4 +50,7 @@ with open(os.path.dirname(os.path.realpath(__file__)) + '/config.yml', 'r') as s out_path = abspath + '/' + cycle + '/' + option_map + '/Q' + str(quadri) + '/L' + option + str(code) \ + ' - ' + titre + '/' + type_map - print(out_path) \ No newline at end of file + if sys.platform.startswith('win32'): + print(out_path.encode("latin-1").decode("utf-8")) + else: + print(out_path) diff --git a/src/root.mk b/src/root.mk index f53044d3e56abc25b48486ec91edf0b5e7e2647c..1ec34bb0ce4565a594715a9e9b445375cd6daf6d 100644 --- a/src/root.mk +++ b/src/root.mk @@ -67,6 +67,13 @@ endef # Directory of the script mysmartcp.py SMARTCP:=$(BASE_DIR)../../../mysmartcp.py +# Operating system +ifeq ($(OS),Windows_NT) + MYPYTHON:=python +else + MYPYTHON:=python3 +endif + # 1e: make all # 2e: make only out-of-date # .PHONY: clean cleanaux $(ALL) @@ -82,11 +89,12 @@ pdf: $(ALL) cleanaux release: $(ALL) cleanaux prerelease $(ALL_RELEASE) prerelease: - $(eval MYPATH:=$(shell python3 ${SMARTCP} ${INPUT})) # Obtain the path/location of the output folder for this PDF - mkdir -p "${MYPATH}" # Create the output folder (if not existing yet) + $(eval MYPATH:=$(shell $(MYPYTHON) ${SMARTCP} ${INPUT})) # Obtain the path/location of the output folder for this PDF + mkdir -p "${MYPATH}" # Create the output folder (if not existing yet) release_$(MAIN_NAME): - cp "$(MAIN_NAME).pdf" "${MYPATH}/$(OUT_MAIN_NAME).pdf" # Copy the PDF in the output folder + $(eval OUT_MAIN_NAME_ENCODED:=$(shell $(MYPYTHON) $(BASE_DIR)../../../myencode.py ${OUT_MAIN_NAME})) # Encode special characters in OUT_MAIN_NAME + cp "$(MAIN_NAME).pdf" "${MYPATH}/$(OUT_MAIN_NAME_ENCODED).pdf" # Copy the PDF in the output folder release_$(MAIN_NAME_SOL): cp "$(MAIN_NAME_SOL).pdf" "${MYPATH}/$(OUT_MAIN_NAME_SOL).pdf" # Copy the solution of the PDF in the output folder