Thread (39 messages) flat view 39 messages, 4 authors, 2016-06-15

Re: [PATCH 3/8] git_remote_helpers: Force rebuild if python version changes

From: Pete Wyckoff <hidden>
Date: 2016-06-15 22:55:48

john@keeping.me.uk wrote on Tue, 15 Jan 2013 22:58 +0000:
quoted hunk ↗ jump to hunk
For reference, putting the version check in setup.py looks like this:

-- >8 --
diff --git a/git_remote_helpers/setup.py b/git_remote_helpers/setup.py
index 6de41de..2c21eb5 100644
--- a/git_remote_helpers/setup.py
+++ b/git_remote_helpers/setup.py
@@ -3,6 +3,7 @@
 """Distutils build/install script for the git_remote_helpers package."""
 
 from distutils.core import setup
+import sys
 
 # If building under Python3 we need to run 2to3 on the code, do this by
 # trying to import distutils' 2to3 builder, which is only available in
@@ -13,6 +14,24 @@ except ImportError:
     # 2.x
     from distutils.command.build_py import build_py
 
+
+current_version = '%d.%d' % sys.version_info[:2]
+try:
+    f = open('GIT-PYTHON_VERSION', 'r')
+    latest_version = f.read().strip()
+    f.close()
+
+    if latest_version != current_version:
+        if not '--force' in sys.argv:
+            sys.argv.insert(0, '--force')
+except IOError:
+    pass
+
+f = open('GIT-PYTHON_VERSION', 'w')
+f.write(current_version)
+f.close()
+
+
 setup(
     name = 'git_remote_helpers',
     version = '0.1.0',
That's about the same overhead as doing it in the Makefile,
and a bit more obscure.  I don't mind your initial version
so much anymore.  Thanks for thinking about it.

		-- Pete
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help