From: Zac Medico Date: Thu, 31 Jan 2013 19:56:13 +0000 (-0800) Subject: runTests: handle samefile OSError, bug #454880 X-Git-Tag: v2.2.0_alpha162~24 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=88e8f1fcc212c93b5dc35dd441f1431986de07b7;p=portage.git runTests: handle samefile OSError, bug #454880 --- diff --git a/pym/portage/tests/runTests b/pym/portage/tests/runTests index 53e1b5cc4..b0069698b 100755 --- a/pym/portage/tests/runTests +++ b/pym/portage/tests/runTests @@ -1,6 +1,6 @@ #!/usr/bin/python -Wd # runTests.py -- Portage Unit Test Functionality -# Copyright 2006-2012 Gentoo Foundation +# Copyright 2006-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import os, sys @@ -45,11 +45,17 @@ import portage.tests as tests from portage.const import PORTAGE_BIN_PATH path = os.environ.get("PATH", "").split(":") path = [x for x in path if x] -if not path or not os.path.samefile(path[0], PORTAGE_BIN_PATH): + +insert_bin_path = True +try: + insert_bin_path = not path or \ + not os.path.samefile(path[0], PORTAGE_BIN_PATH) +except OSError: + pass + +if insert_bin_path: path.insert(0, PORTAGE_BIN_PATH) os.environ["PATH"] = ":".join(path) -del path - if __name__ == "__main__": sys.exit(tests.main())