[pypy-svn] r5051 - in pypy/trunk/src/pypy: annotation/test appspace appspace/test interpreter interpreter/test module/test objspace/flow/test objspace/std/test objspace/test tool tool/test tool/testdata translator/test translator/tool translator/tool/pygame
arigo at codespeak.net
arigo at codespeak.net
Fri Jun 11 14:26:54 CEST 2004
Author: arigo
Date: Fri Jun 11 14:26:53 2004
New Revision: 5051
Modified:
pypy/trunk/src/pypy/annotation/test/autopath.py
pypy/trunk/src/pypy/appspace/autopath.py
pypy/trunk/src/pypy/appspace/test/autopath.py
pypy/trunk/src/pypy/interpreter/autopath.py
pypy/trunk/src/pypy/interpreter/test/autopath.py
pypy/trunk/src/pypy/module/test/autopath.py
pypy/trunk/src/pypy/objspace/flow/test/autopath.py
pypy/trunk/src/pypy/objspace/std/test/autopath.py
pypy/trunk/src/pypy/objspace/test/autopath.py
pypy/trunk/src/pypy/tool/autopath.py
pypy/trunk/src/pypy/tool/test/autopath.py
pypy/trunk/src/pypy/tool/testdata/autopath.py
pypy/trunk/src/pypy/translator/test/autopath.py
pypy/trunk/src/pypy/translator/tool/autopath.py
pypy/trunk/src/pypy/translator/tool/pygame/autopath.py
Log:
autopath used to remove too much from sys.path.
Modified: pypy/trunk/src/pypy/annotation/test/autopath.py
==============================================================================
--- pypy/trunk/src/pypy/annotation/test/autopath.py (original)
+++ pypy/trunk/src/pypy/annotation/test/autopath.py Fri Jun 11 14:26:53 2004
@@ -37,9 +37,11 @@
partdir = head
head, tail = os.path.split(head)
if tail == part:
- sys.path = [p for p in sys.path if not p.startswith(head)]
- if head not in sys.path:
- sys.path.insert(0, head)
+ try:
+ sys.path.remove(head)
+ except ValueError:
+ pass
+ sys.path.insert(0, head)
return partdir, this_dir
raise EnvironmentError, "'%s' missing in '%r'" % (pathpart,this_path)
Modified: pypy/trunk/src/pypy/appspace/autopath.py
==============================================================================
--- pypy/trunk/src/pypy/appspace/autopath.py (original)
+++ pypy/trunk/src/pypy/appspace/autopath.py Fri Jun 11 14:26:53 2004
@@ -37,9 +37,11 @@
partdir = head
head, tail = os.path.split(head)
if tail == part:
- sys.path = [p for p in sys.path if not p.startswith(head)]
- if head not in sys.path:
- sys.path.insert(0, head)
+ try:
+ sys.path.remove(head)
+ except ValueError:
+ pass
+ sys.path.insert(0, head)
return partdir, this_dir
raise EnvironmentError, "'%s' missing in '%r'" % (pathpart,this_path)
Modified: pypy/trunk/src/pypy/appspace/test/autopath.py
==============================================================================
--- pypy/trunk/src/pypy/appspace/test/autopath.py (original)
+++ pypy/trunk/src/pypy/appspace/test/autopath.py Fri Jun 11 14:26:53 2004
@@ -37,9 +37,11 @@
partdir = head
head, tail = os.path.split(head)
if tail == part:
- sys.path = [p for p in sys.path if not p.startswith(head)]
- if head not in sys.path:
- sys.path.insert(0, head)
+ try:
+ sys.path.remove(head)
+ except ValueError:
+ pass
+ sys.path.insert(0, head)
return partdir, this_dir
raise EnvironmentError, "'%s' missing in '%r'" % (pathpart,this_path)
Modified: pypy/trunk/src/pypy/interpreter/autopath.py
==============================================================================
--- pypy/trunk/src/pypy/interpreter/autopath.py (original)
+++ pypy/trunk/src/pypy/interpreter/autopath.py Fri Jun 11 14:26:53 2004
@@ -37,9 +37,11 @@
partdir = head
head, tail = os.path.split(head)
if tail == part:
- sys.path = [p for p in sys.path if not p.startswith(head)]
- if head not in sys.path:
- sys.path.insert(0, head)
+ try:
+ sys.path.remove(head)
+ except ValueError:
+ pass
+ sys.path.insert(0, head)
return partdir, this_dir
raise EnvironmentError, "'%s' missing in '%r'" % (pathpart,this_path)
Modified: pypy/trunk/src/pypy/interpreter/test/autopath.py
==============================================================================
--- pypy/trunk/src/pypy/interpreter/test/autopath.py (original)
+++ pypy/trunk/src/pypy/interpreter/test/autopath.py Fri Jun 11 14:26:53 2004
@@ -37,9 +37,11 @@
partdir = head
head, tail = os.path.split(head)
if tail == part:
- sys.path = [p for p in sys.path if not p.startswith(head)]
- if head not in sys.path:
- sys.path.insert(0, head)
+ try:
+ sys.path.remove(head)
+ except ValueError:
+ pass
+ sys.path.insert(0, head)
return partdir, this_dir
raise EnvironmentError, "'%s' missing in '%r'" % (pathpart,this_path)
Modified: pypy/trunk/src/pypy/module/test/autopath.py
==============================================================================
--- pypy/trunk/src/pypy/module/test/autopath.py (original)
+++ pypy/trunk/src/pypy/module/test/autopath.py Fri Jun 11 14:26:53 2004
@@ -37,9 +37,11 @@
partdir = head
head, tail = os.path.split(head)
if tail == part:
- sys.path = [p for p in sys.path if not p.startswith(head)]
- if head not in sys.path:
- sys.path.insert(0, head)
+ try:
+ sys.path.remove(head)
+ except ValueError:
+ pass
+ sys.path.insert(0, head)
return partdir, this_dir
raise EnvironmentError, "'%s' missing in '%r'" % (pathpart,this_path)
Modified: pypy/trunk/src/pypy/objspace/flow/test/autopath.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/flow/test/autopath.py (original)
+++ pypy/trunk/src/pypy/objspace/flow/test/autopath.py Fri Jun 11 14:26:53 2004
@@ -37,9 +37,11 @@
partdir = head
head, tail = os.path.split(head)
if tail == part:
- sys.path = [p for p in sys.path if not p.startswith(head)]
- if head not in sys.path:
- sys.path.insert(0, head)
+ try:
+ sys.path.remove(head)
+ except ValueError:
+ pass
+ sys.path.insert(0, head)
return partdir, this_dir
raise EnvironmentError, "'%s' missing in '%r'" % (pathpart,this_path)
Modified: pypy/trunk/src/pypy/objspace/std/test/autopath.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/test/autopath.py (original)
+++ pypy/trunk/src/pypy/objspace/std/test/autopath.py Fri Jun 11 14:26:53 2004
@@ -37,9 +37,11 @@
partdir = head
head, tail = os.path.split(head)
if tail == part:
- sys.path = [p for p in sys.path if not p.startswith(head)]
- if head not in sys.path:
- sys.path.insert(0, head)
+ try:
+ sys.path.remove(head)
+ except ValueError:
+ pass
+ sys.path.insert(0, head)
return partdir, this_dir
raise EnvironmentError, "'%s' missing in '%r'" % (pathpart,this_path)
Modified: pypy/trunk/src/pypy/objspace/test/autopath.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/test/autopath.py (original)
+++ pypy/trunk/src/pypy/objspace/test/autopath.py Fri Jun 11 14:26:53 2004
@@ -37,9 +37,11 @@
partdir = head
head, tail = os.path.split(head)
if tail == part:
- sys.path = [p for p in sys.path if not p.startswith(head)]
- if head not in sys.path:
- sys.path.insert(0, head)
+ try:
+ sys.path.remove(head)
+ except ValueError:
+ pass
+ sys.path.insert(0, head)
return partdir, this_dir
raise EnvironmentError, "'%s' missing in '%r'" % (pathpart,this_path)
Modified: pypy/trunk/src/pypy/tool/autopath.py
==============================================================================
--- pypy/trunk/src/pypy/tool/autopath.py (original)
+++ pypy/trunk/src/pypy/tool/autopath.py Fri Jun 11 14:26:53 2004
@@ -37,9 +37,11 @@
partdir = head
head, tail = os.path.split(head)
if tail == part:
- sys.path = [p for p in sys.path if not p.startswith(head)]
- if head not in sys.path:
- sys.path.insert(0, head)
+ try:
+ sys.path.remove(head)
+ except ValueError:
+ pass
+ sys.path.insert(0, head)
return partdir, this_dir
raise EnvironmentError, "'%s' missing in '%r'" % (pathpart,this_path)
Modified: pypy/trunk/src/pypy/tool/test/autopath.py
==============================================================================
--- pypy/trunk/src/pypy/tool/test/autopath.py (original)
+++ pypy/trunk/src/pypy/tool/test/autopath.py Fri Jun 11 14:26:53 2004
@@ -37,9 +37,11 @@
partdir = head
head, tail = os.path.split(head)
if tail == part:
- sys.path = [p for p in sys.path if not p.startswith(head)]
- if head not in sys.path:
- sys.path.insert(0, head)
+ try:
+ sys.path.remove(head)
+ except ValueError:
+ pass
+ sys.path.insert(0, head)
return partdir, this_dir
raise EnvironmentError, "'%s' missing in '%r'" % (pathpart,this_path)
Modified: pypy/trunk/src/pypy/tool/testdata/autopath.py
==============================================================================
--- pypy/trunk/src/pypy/tool/testdata/autopath.py (original)
+++ pypy/trunk/src/pypy/tool/testdata/autopath.py Fri Jun 11 14:26:53 2004
@@ -37,9 +37,11 @@
partdir = head
head, tail = os.path.split(head)
if tail == part:
- sys.path = [p for p in sys.path if not p.startswith(head)]
- if head not in sys.path:
- sys.path.insert(0, head)
+ try:
+ sys.path.remove(head)
+ except ValueError:
+ pass
+ sys.path.insert(0, head)
return partdir, this_dir
raise EnvironmentError, "'%s' missing in '%r'" % (pathpart,this_path)
Modified: pypy/trunk/src/pypy/translator/test/autopath.py
==============================================================================
--- pypy/trunk/src/pypy/translator/test/autopath.py (original)
+++ pypy/trunk/src/pypy/translator/test/autopath.py Fri Jun 11 14:26:53 2004
@@ -37,9 +37,11 @@
partdir = head
head, tail = os.path.split(head)
if tail == part:
- sys.path = [p for p in sys.path if not p.startswith(head)]
- if head not in sys.path:
- sys.path.insert(0, head)
+ try:
+ sys.path.remove(head)
+ except ValueError:
+ pass
+ sys.path.insert(0, head)
return partdir, this_dir
raise EnvironmentError, "'%s' missing in '%r'" % (pathpart,this_path)
Modified: pypy/trunk/src/pypy/translator/tool/autopath.py
==============================================================================
--- pypy/trunk/src/pypy/translator/tool/autopath.py (original)
+++ pypy/trunk/src/pypy/translator/tool/autopath.py Fri Jun 11 14:26:53 2004
@@ -37,9 +37,11 @@
partdir = head
head, tail = os.path.split(head)
if tail == part:
- sys.path = [p for p in sys.path if not p.startswith(head)]
- if head not in sys.path:
- sys.path.insert(0, head)
+ try:
+ sys.path.remove(head)
+ except ValueError:
+ pass
+ sys.path.insert(0, head)
return partdir, this_dir
raise EnvironmentError, "'%s' missing in '%r'" % (pathpart,this_path)
Modified: pypy/trunk/src/pypy/translator/tool/pygame/autopath.py
==============================================================================
--- pypy/trunk/src/pypy/translator/tool/pygame/autopath.py (original)
+++ pypy/trunk/src/pypy/translator/tool/pygame/autopath.py Fri Jun 11 14:26:53 2004
@@ -37,9 +37,11 @@
partdir = head
head, tail = os.path.split(head)
if tail == part:
- sys.path = [p for p in sys.path if not p.startswith(head)]
- if head not in sys.path:
- sys.path.insert(0, head)
+ try:
+ sys.path.remove(head)
+ except ValueError:
+ pass
+ sys.path.insert(0, head)
return partdir, this_dir
raise EnvironmentError, "'%s' missing in '%r'" % (pathpart,this_path)
More information about the Pypy-commit
mailing list