Commit 45d8db04 authored by maruel@chromium.org's avatar maruel@chromium.org

Add more python 2.5 compatibility.

Makes all the tests runnable on python 2.5.

R=dpranke@chromium.org
BUG=
TEST=

Review URL: http://codereview.chromium.org/6690034

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@80068 0039d316-1c4b-4281-b951-d872f2087c98
parent df3302b3
......@@ -7,6 +7,7 @@
In theory you shouldn't need anything else in subprocess, or this module failed.
"""
from __future__ import with_statement
import logging
import os
import subprocess
......
#!/usr/bin/python
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
#!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......@@ -187,7 +187,7 @@ def wait_for_port_to_bind(host, port, process):
sock.connect((host, port))
logging.debug('%d is now bound' % port)
return
except EnvironmentError:
except (socket.error, EnvironmentError):
pass
logging.debug('%d is still not bound' % port)
finally:
......@@ -206,7 +206,7 @@ def wait_for_port_to_free(host, port):
sock = socket.socket()
sock.connect((host, port))
logging.debug('%d was bound, waiting to free' % port)
except EnvironmentError:
except (socket.error, EnvironmentError):
logging.debug('%d now free' % port)
return
finally:
......@@ -364,7 +364,8 @@ class FakeReposBase(object):
return True
try:
check_call(['svnadmin', 'create', self.svn_repo])
except OSError:
except OSError, e:
logging.debug('Failed with : %s' % e)
return False
write(join(self.svn_repo, 'conf', 'svnserve.conf'),
'[general]\n'
......@@ -383,6 +384,7 @@ class FakeReposBase(object):
# Start the daemon.
self.svn_port = find_free_port(self.host, 10000)
logging.debug('Using port %d' % self.svn_port)
cmd = ['svnserve', '-d', '--foreground', '-r', self.root_dir,
'--listen-port=%d' % self.svn_port]
if self.host == '127.0.0.1':
......@@ -452,7 +454,7 @@ class FakeReposBase(object):
sock.connect((self.host, port))
# It worked, throw.
assert False, '%d shouldn\'t be bound' % port
except EnvironmentError:
except (socket.error, EnvironmentError):
pass
finally:
sock.close()
......
#!/usr/bin/python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......@@ -8,6 +7,7 @@ import os
import re
import StringIO
def _RaiseNotFound(path):
raise IOError(errno.ENOENT, path, os.strerror(errno.ENOENT))
......
#!/usr/bin/python
#!/usr/bin/env python
# coding=utf8
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
......
#!/usr/bin/python
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
#!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......
#!/usr/bin/python
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
#!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......
#!/usr/bin/python
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
#!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......
#!/usr/bin/python
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
#!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......
#!/usr/bin/python
#!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unit tests for owners.py."""
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
import owners
from tests import filesystem_mock
......
#!/usr/bin/env python2.5
#!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......
#!/usr/bin/python
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
#!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unit tests for scm.py."""
# pylint: disable=E1101,W0403
from __future__ import with_statement
import logging
import sys
import unittest
# Fixes include path.
from super_mox import SuperMoxTestBase
......@@ -325,7 +329,8 @@ class RealSvnTest(fake_repos.FakeReposTestBase):
if __name__ == '__main__':
import unittest
if '-v' in sys.argv:
logging.basicConfig(level=logging.DEBUG)
unittest.main()
# vim: ts=2:sw=2:tw=80:et:
#!/usr/bin/python
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......
#!/usr/bin/python
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
#!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......
#!/usr/bin/python
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
#!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......
#!/usr/bin/python
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
#!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment