diff options
Diffstat (limited to 'git_command.py')
| -rw-r--r-- | git_command.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/git_command.py b/git_command.py index a40e6c05..d347dd61 100644 --- a/git_command.py +++ b/git_command.py | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | # See the License for the specific language governing permissions and | 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. | 14 | # limitations under the License. |
| 15 | 15 | ||
| 16 | from __future__ import print_function | ||
| 16 | import os | 17 | import os |
| 17 | import sys | 18 | import sys |
| 18 | import subprocess | 19 | import subprocess |
| @@ -88,11 +89,11 @@ class _GitCall(object): | |||
| 88 | ver_str = git.version() | 89 | ver_str = git.version() |
| 89 | if ver_str.startswith('git version '): | 90 | if ver_str.startswith('git version '): |
| 90 | _git_version = tuple( | 91 | _git_version = tuple( |
| 91 | map(lambda x: int(x), | 92 | map(int, |
| 92 | ver_str[len('git version '):].strip().split('-')[0].split('.')[0:3] | 93 | ver_str[len('git version '):].strip().split('-')[0].split('.')[0:3] |
| 93 | )) | 94 | )) |
| 94 | else: | 95 | else: |
| 95 | print >>sys.stderr, 'fatal: "%s" unsupported' % ver_str | 96 | print('fatal: "%s" unsupported' % ver_str, file=sys.stderr) |
| 96 | sys.exit(1) | 97 | sys.exit(1) |
| 97 | return _git_version | 98 | return _git_version |
| 98 | 99 | ||
| @@ -110,8 +111,8 @@ def git_require(min_version, fail=False): | |||
| 110 | if min_version <= git_version: | 111 | if min_version <= git_version: |
| 111 | return True | 112 | return True |
| 112 | if fail: | 113 | if fail: |
| 113 | need = '.'.join(map(lambda x: str(x), min_version)) | 114 | need = '.'.join(map(str, min_version)) |
| 114 | print >>sys.stderr, 'fatal: git %s or later required' % need | 115 | print('fatal: git %s or later required' % need, file=sys.stderr) |
| 115 | sys.exit(1) | 116 | sys.exit(1) |
| 116 | return False | 117 | return False |
| 117 | 118 | ||
| @@ -132,15 +133,15 @@ class GitCommand(object): | |||
| 132 | gitdir = None): | 133 | gitdir = None): |
| 133 | env = os.environ.copy() | 134 | env = os.environ.copy() |
| 134 | 135 | ||
| 135 | for e in [REPO_TRACE, | 136 | for key in [REPO_TRACE, |
| 136 | GIT_DIR, | 137 | GIT_DIR, |
| 137 | 'GIT_ALTERNATE_OBJECT_DIRECTORIES', | 138 | 'GIT_ALTERNATE_OBJECT_DIRECTORIES', |
| 138 | 'GIT_OBJECT_DIRECTORY', | 139 | 'GIT_OBJECT_DIRECTORY', |
| 139 | 'GIT_WORK_TREE', | 140 | 'GIT_WORK_TREE', |
| 140 | 'GIT_GRAFT_FILE', | 141 | 'GIT_GRAFT_FILE', |
| 141 | 'GIT_INDEX_FILE']: | 142 | 'GIT_INDEX_FILE']: |
| 142 | if e in env: | 143 | if key in env: |
| 143 | del env[e] | 144 | del env[key] |
| 144 | 145 | ||
| 145 | if disable_editor: | 146 | if disable_editor: |
| 146 | _setenv(env, 'GIT_EDITOR', ':') | 147 | _setenv(env, 'GIT_EDITOR', ':') |
