Add checks to Python scripts for version dependencies.

Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Eric S. Raymond 2012-12-28 11:40:59 -05:00 committed by Junio C Hamano
parent 18499ba694
commit a33faf2827
8 changed files with 44 additions and 3 deletions

View File

@ -47,7 +47,13 @@
# 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

View File

@ -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)

View File

@ -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

View 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

View File

@ -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'

View File

@ -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

View 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.
"""

View 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)