Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/tests/
Date: Thu, 31 Jan 2013 19:56:33
Message-Id: 1359662173.88e8f1fcc212c93b5dc35dd441f1431986de07b7.zmedico@gentoo
1 commit: 88e8f1fcc212c93b5dc35dd441f1431986de07b7
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jan 31 19:56:13 2013 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Thu Jan 31 19:56:13 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=88e8f1fc
7
8 runTests: handle samefile OSError, bug #454880
9
10 ---
11 pym/portage/tests/runTests | 14 ++++++++++----
12 1 files changed, 10 insertions(+), 4 deletions(-)
13
14 diff --git a/pym/portage/tests/runTests b/pym/portage/tests/runTests
15 index 53e1b5c..b006969 100755
16 --- a/pym/portage/tests/runTests
17 +++ b/pym/portage/tests/runTests
18 @@ -1,6 +1,6 @@
19 #!/usr/bin/python -Wd
20 # runTests.py -- Portage Unit Test Functionality
21 -# Copyright 2006-2012 Gentoo Foundation
22 +# Copyright 2006-2013 Gentoo Foundation
23 # Distributed under the terms of the GNU General Public License v2
24
25 import os, sys
26 @@ -45,11 +45,17 @@ import portage.tests as tests
27 from portage.const import PORTAGE_BIN_PATH
28 path = os.environ.get("PATH", "").split(":")
29 path = [x for x in path if x]
30 -if not path or not os.path.samefile(path[0], PORTAGE_BIN_PATH):
31 +
32 +insert_bin_path = True
33 +try:
34 + insert_bin_path = not path or \
35 + not os.path.samefile(path[0], PORTAGE_BIN_PATH)
36 +except OSError:
37 + pass
38 +
39 +if insert_bin_path:
40 path.insert(0, PORTAGE_BIN_PATH)
41 os.environ["PATH"] = ":".join(path)
42 -del path
43 -
44
45 if __name__ == "__main__":
46 sys.exit(tests.main())