Skip to content

Commit b595bee

Browse files
committed
Makefile: reduce the number of git operations
Running `git checkout CPYTHON_CURRENT_COMMIT` and then `git checkout -c` can render the spinx build slower because many sources may seem out of date. It's better to check if we are at the correct revision and not run *any* git operations if there's nothing to be done
1 parent 26361e7 commit b595bee

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,13 @@ endif
5858

5959
.PHONY: all
6060
all: ensure_prerequisites
61-
git -C $(CPYTHON_PATH) checkout $(CPYTHON_CURRENT_COMMIT)
61+
@if [ $(shell git -C $(CPYTHON_PATH) rev-parse HEAD) != $(CPYTHON_CURRENT_COMMIT) ]; then \
62+
echo "Your $(CPYTHON_PATH) repositoy is not at the currect revision"; \
63+
echo "You can run try and run "; \
64+
echo "git -C $(CPYTHON_PATH) checkout $(CPYTHON_CURRENT_COMMIT)"; \
65+
echo "to fix the problem"; \
66+
exit 1; \
67+
fi
6268
mkdir -p locales/$(LANGUAGE)/LC_MESSAGES/
6369
$(CP_CMD) -u --parents *.po */*.po locales/$(LANGUAGE)/LC_MESSAGES/
6470
$(MAKE) -C $(CPYTHON_PATH)/Doc/ \
@@ -70,7 +76,6 @@ all: ensure_prerequisites
7076
-D latex_elements.inputenc= \
7177
-D latex_elements.fontenc=' \
7278
$(MODE)
73-
git -C $(CPYTHON_PATH) checkout -
7479
@echo "Build success, open file://$(abspath $(CPYTHON_PATH))/Doc/build/html/index.html or run 'make serve' to see them."
7580

7681

0 commit comments

Comments
 (0)