git_remote_helpers: force rebuild if python version changes
authorJohn Keeping <john@keeping.me.uk>
Sun, 20 Jan 2013 13:15:33 +0000 (13:15 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 25 Jan 2013 03:32:29 +0000 (19:32 -0800)
When different version of python are used to build via distutils, the
behaviour can change.  Detect changes in version and pass --force in
this case.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git_remote_helpers/.gitignore
git_remote_helpers/Makefile

index 2247d5f95a7193c7221b9464debe167763b4fae3..cf040af3f5858948c871310ae1a23108900500d6 100644 (file)
@@ -1,2 +1,3 @@
+/GIT-PYTHON-VERSION
 /build
 /dist
index f65f0645ee995a3be98ba3e48b2e3ba86c9b9213..0d2ae740b3242d38bf1aa3fca6c5f90e00d95547 100644 (file)
@@ -25,8 +25,14 @@ PYLIBDIR=$(shell $(PYTHON_PATH) -c \
         "import sys; \
         print('lib/python%i.%i/site-packages' % sys.version_info[:2])")
 
+py_version=$(shell $(PYTHON_PATH) -c \
+       'import sys; print("%i.%i" % sys.version_info[:2])')
+
 all: $(pysetupfile)
-       $(QUIET)$(PYTHON_PATH) $(pysetupfile) $(QUIETSETUP) build
+       $(QUIET)test "$$(cat GIT-PYTHON-VERSION 2>/dev/null)" = "$(py_version)" || \
+       flags=--force; \
+       $(PYTHON_PATH) $(pysetupfile) $(QUIETSETUP) build $$flags
+       $(QUIET)echo "$(py_version)" >GIT-PYTHON-VERSION
 
 install: $(pysetupfile)
        $(PYTHON_PATH) $(pysetupfile) install --prefix $(DESTDIR_SQ)$(prefix)