Skip to content

Commit

Permalink
Makethird: fix Extract build error if python not 3.6 or later.
Browse files Browse the repository at this point in the history
Don't attempt to run thirdparty/extract/src/docx_template_build.py if we don't
have python-3.6 or later. The generated files are in git so this works ok.
  • Loading branch information
julian-smith-artifex-com committed Sep 6, 2021
1 parent 9d8c5ae commit 0c23ece
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions Makethird
Original file line number Diff line number Diff line change
Expand Up @@ -244,18 +244,27 @@ THIRD_SRC += $(EXTRACT_SRC)
$(OUT)/thirdparty/extract/%.o: thirdparty/extract/%.c
$(CC_CMD) $(WARNING_CFLAGS) $(LIB_CFLAGS) $(EXTRACT_CFLAGS) $(ZLIB_CFLAGS) $(EXTRACT_BUILD_CFLAGS)

# The first python3 command in the next two rules returns 0 (success) iff
# python3 exists and is version 3.6 or later.

thirdparty/extract/src/docx_template.c: thirdparty/extract/src/template.docx thirdparty/extract/src/docx_template_build.py
$(QUIET_GEN) python3 thirdparty/extract/src/docx_template_build.py \
-i thirdparty/extract/src/template.docx \
-n docx \
-o thirdparty/extract/src/docx_template
$(QUIET_GEN) if python3 -c 'import sys; sys.exit(sys.version_info < (3,6))'; \
then python3 thirdparty/extract/src/docx_template_build.py \
-i thirdparty/extract/src/template.docx \
-n docx \
-o thirdparty/extract/src/docx_template ; \
else echo python3 is older than 3.6 so not running docx_template_build.py; \
fi
@touch $@

thirdparty/extract/src/odt_template.c: thirdparty/extract/src/template.odt thirdparty/extract/src/docx_template_build.py
$(QUIET_GEN) python3 thirdparty/extract/src/docx_template_build.py \
-i thirdparty/extract/src/template.odt \
-n odt \
-o thirdparty/extract/src/odt_template
$(QUIET_GEN) if python3 -c 'import sys; sys.exit(sys.version_info < (3,6))'; \
then python3 thirdparty/extract/src/docx_template_build.py \
-i thirdparty/extract/src/template.odt \
-n odt \
-o thirdparty/extract/src/odt_template ; \
else echo python3 is older than 3.6 so not running docx_template_build.py; \
fi
@touch $@

generate: thirdparty/extract/src/docx_template.c

0 comments on commit 0c23ece

Please sign in to comment.