]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Add checks to Python scripts for version dependencies.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 28 Dec 2012 16:40:59 +0000 (11:40 -0500)
committerJunio C Hamano <gitster@pobox.com>
Fri, 28 Dec 2012 19:35:04 +0000 (11:35 -0800)
Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/ciabot/ciabot.py
contrib/fast-import/import-zips.py
contrib/hg-to-git/hg-to-git.py
contrib/p4import/git-p4import.py
contrib/svn-fe/svnrdump_sim.py
git-p4.py
git-remote-testgit.py
git_remote_helpers/git/__init__.py

index bd24395d4cf404f886803892d0be98c964a43ce7..36b5665ff81af1d52be5e926b029452d3e838c35 100755 (executable)
 # we default to that.
 #
 
-import os, sys, commands, socket, urllib
+import sys
+if sys.hexversion < 0x02000000:
+        # The limiter is the xml.sax module
+        sys.stderr.write("ciabot.py: requires Python 2.0.0 or later.\n")
+        sys.exit(1)
+
+import os, commands, socket, urllib
 from xml.sax.saxutils import escape
 
 # Changeset URL prefix for your repo: when the commit ID is appended
index 82f5ed3ddc8adb1b9b281c3912f4e67c53ef152f..5cec9b012994de61ba6ed1e4c17992edbfd8a07d 100755 (executable)
@@ -9,10 +9,15 @@
 ##  git log --stat import-zips
 
 from os import popen, path
-from sys import argv, exit
+from sys import argv, exit, hexversion, stderr
 from time import mktime
 from zipfile import ZipFile
 
+if hexversion < 0x01060000:
+        # The limiter is the zipfile module
+        sys.stderr.write("import-zips.py: requires Python 1.6.0 or later.\n")
+        sys.exit(1)
+
 if len(argv) < 2:
        print 'Usage:', argv[0], '<zipfile>...'
        exit(1)
index 046cb2b268a82358630e86bb55cf8b4e58c730fb..232625a7b72aef88ef9cc0285eb7208ce38a2138 100755 (executable)
@@ -23,6 +23,11 @@ import os, os.path, sys
 import tempfile, pickle, getopt
 import re
 
+if sys.hexversion < 0x02030000:
+   # The behavior of the pickle module changed significantly in 2.3
+   sys.stderr.write("hg-to-git.py: requires Python 2.3 or later.\n")
+   sys.exit(1)
+
 # Maps hg version -> git version
 hgvers = {}
 # List of children for each hg revision
index b6e534b65b687d955a878d902b9bb46cfa2e42ce..593d6a0682ba49e31e40e1b4e5c3e0af82fd9cda 100644 (file)
@@ -14,6 +14,11 @@ import sys
 import time
 import getopt
 
+if sys.hexversion < 0x02020000:
+   # The behavior of the marshal module changed significantly in 2.2
+   sys.stderr.write("git-p4import.py: requires Python 2.2 or later.\n")
+   sys.exit(1)
+
 from signal import signal, \
    SIGPIPE, SIGINT, SIG_DFL, \
    default_int_handler
index 1cfac4a6f84051d625ee2e1800ffd074b215eb86..17cf6f961f5fdf1e8f790acf7f498dc863e11e45 100755 (executable)
@@ -7,6 +7,10 @@ to the highest revision that should be available.
 """
 import sys, os
 
+if sys.hexversion < 0x02040000:
+        # The limiter is the ValueError() calls. This may be too conservative
+        sys.stderr.write("svnrdump-sim.py: requires Python 2.4 or later.\n")
+        sys.exit(1)
 
 def getrevlimit():
         var = 'SVNRMAX'
index 551aec9417401dcd7ef526dd6c9b554e5194f861..69f1452cf80066a002fe58bb1eeebda7fe63ba8b 100755 (executable)
--- a/git-p4.py
+++ b/git-p4.py
@@ -8,7 +8,13 @@
 # License: MIT <http://www.opensource.org/licenses/mit-license.php>
 #
 
-import optparse, sys, os, marshal, subprocess, shelve
+import sys
+if sys.hexversion < 0x02040000:
+    # The limiter is the subprocess module
+    sys.stderr.write("git-p4: requires Python 2.4 or later.\n")
+    sys.exit(1)
+
+import optparse, os, marshal, subprocess, shelve
 import tempfile, getopt, os.path, time, platform
 import re, shutil
 
index 5f3ebd244dac3ca28298ece9df914102b8155660..91faabd2ae1e4d26c0aa4d40f9d3272ed5b367b5 100644 (file)
@@ -31,6 +31,11 @@ from git_remote_helpers.git.exporter import GitExporter
 from git_remote_helpers.git.importer import GitImporter
 from git_remote_helpers.git.non_local import NonLocalGit
 
+if sys.hexversion < 0x01050200:
+    # os.makedirs() is the limiter
+    sys.stderr.write("git-remote-testgit: requires Python 1.5.2 or later.\n")
+    sys.exit(1)
+
 def get_repo(alias, url):
     """Returns a git repository object initialized for usage.
     """
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..1dbb1b0148074ac34fb4e4240c06f1042b12c10a 100644 (file)
@@ -0,0 +1,5 @@
+import sys
+if sys.hexversion < 0x02040000:
+    # The limiter is the subprocess module
+    sys.stderr.write("git_remote_helpers: requires Python 2.4 or later.\n")
+    sys.exit(1)