Permalink
Browse files

Back port to Python 2.4.

  • Loading branch information...
1 parent b921988 commit 57191633b61fe92bc799a7e18ef1fa5feb1d2186 Chad Metcalf committed Dec 2, 2009
Showing with 22 additions and 21 deletions.
  1. +1 −1 bootstrap.py
  2. +5 −4 crepo.py
  3. +3 −3 git_command.py
  4. +1 −1 git_repo.py
  5. +10 −10 manifest.py
  6. +1 −1 setup.py
  7. +1 −1 test.py
View
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.5
+#!/usr/bin/env python
##############################################################################
#
# Copyright (c) 2006 Zope Corporation and Contributors.
View
@@ -1,7 +1,5 @@
#!/usr/bin/env python
# (c) Copyright 2009 Cloudera, Inc.
-from __future__ import with_statement
-from contextlib import closing
import os
import sys
import optparse
@@ -378,8 +376,11 @@ def update_indirect(args):
if res != 'y' and res != '':
continue
- with closing(file(tracker.indirection_file, "w")) as f:
- print >>f, cur_revision
+ f = file(tracker.indirection_file, "w")
+ try:
+ print >>f, cur_revision
+ finally:
+ f.close()
print "Updated"
if not saw_indirects:
View
@@ -47,10 +47,10 @@ def __init__(self,
command = [GIT]
command.extend(cmdv)
- stdout = subprocess.PIPE if capture_stdout else None
+ stdout = capture_stdout and subprocess.PIPE or None
if ignore_stdout:
- stdout=file("/dev/null", "w")
- stderr = subprocess.PIPE if capture_stderr else None
+ stdout=file("/dev/null", "w")
+ stderr = capture_stderr and subprocess.PIPE or None
if IsTrace():
global LAST_CWD
View
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.5
+#!/usr/bin/env python
# (c) Copyright 2009 Cloudera, Inc.
from git_command import GitCommand
View
@@ -1,8 +1,5 @@
-#!/usr/bin/env python2.5
+#!/usr/bin/env python
# (c) Copyright 2009 Cloudera, Inc.
-from __future__ import with_statement
-
-from contextlib import closing
import logging
import os
import re
@@ -71,9 +68,12 @@ def __init__(self, path):
self.data[key] = val
def dump_to(self, path):
- with closing(file(path, "w")) as f:
- for key, val in sorted(self.data.iteritems()):
- print >>f, "%s=%s\n" % (key, val)
+ f = file(path, "w")
+ try:
+ for key, val in sorted(self.data.iteritems()):
+ print >>f, "%s=%s\n" % (key, val)
+ finally:
+ f.close()
def get_indirection(self, key):
return self.data.get(key)
@@ -194,11 +194,11 @@ def __init__(self,
):
self.name = name
self.manifest = manifest
- self.remotes = remotes if remotes else []
- self._dir = dir if dir else name
+ self.remotes = remotes or []
+ self._dir = dir or name
self.tracker = tracker
self.from_remote = from_remote
- self.remote_project_name = remote_project_name if remote_project_name else name
+ self.remote_project_name = remote_project_name or name
@staticmethod
def from_dict(manifest, name, data):
View
@@ -4,7 +4,7 @@
setup(
name="crepo",
- version='0.1.2',
+ version='0.1.4',
url="http://github.com/cloudera/crepo/tree/master",
maintainer="Chad Metcalf",
maintainer_email="chad@cloudera.com",
View
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.5
+#!/usr/bin/env python
# (c) Copyright 2009 Cloudera, Inc.
import unittest

0 comments on commit 5719163

Please sign in to comment.