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
experimental/szager/collated-output
maruel@chromium.org 15 years ago
parent df3302b382
commit 45d8db04f9

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

@ -1,5 +1,5 @@
#!/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()

@ -1,4 +1,3 @@
#!/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))

@ -1,4 +1,4 @@
#!/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

@ -1,5 +1,5 @@
#!/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.

@ -1,5 +1,5 @@
#!/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.

@ -1,5 +1,5 @@
#!/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.

@ -1,5 +1,5 @@
#!/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.

@ -1,12 +1,16 @@
#!/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

@ -1,4 +1,4 @@
#!/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.

@ -1,11 +1,15 @@
#!/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:

@ -1,5 +1,4 @@
#!/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.

@ -1,5 +1,5 @@
#!/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.

@ -1,5 +1,5 @@
#!/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.

@ -1,5 +1,5 @@
#!/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.

Loading…
Cancel
Save