[pypy-svn] r7362 - in pypy/trunk/src/pypy: annotation/test appspace appspace/test interpreter interpreter/test module/test objspace/flow/test objspace/std objspace/std/test objspace/test tool tool/test translator translator/test translator/tool translator/tool/pygame

mwh at codespeak.net mwh at codespeak.net
Thu Nov 18 11:51:21 CET 2004


Author: mwh
Date: Thu Nov 18 11:51:20 2004
New Revision: 7362

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/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/translator/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:
There's indeed not much point in having autopath if it doesn't do what it's
supposed to do!  Remove directories up path from the pypy dir from sys.path
(again).


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	Thu Nov 18 11:51:20 2004
@@ -35,13 +35,14 @@
 
     while head:
         partdir = head
+        try:
+            sys.path.remove(head)
+        except ValueError:
+            pass
         head, tail = os.path.split(head)
         if tail == part:
-            try:
-                sys.path.remove(head)
-            except ValueError:
-                pass
-            sys.path.insert(0, head)
+            if head not in sys.path:
+                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	Thu Nov 18 11:51:20 2004
@@ -35,13 +35,14 @@
 
     while head:
         partdir = head
+        try:
+            sys.path.remove(head)
+        except ValueError:
+            pass
         head, tail = os.path.split(head)
         if tail == part:
-            try:
-                sys.path.remove(head)
-            except ValueError:
-                pass
-            sys.path.insert(0, head)
+            if head not in sys.path:
+                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	Thu Nov 18 11:51:20 2004
@@ -35,13 +35,14 @@
 
     while head:
         partdir = head
+        try:
+            sys.path.remove(head)
+        except ValueError:
+            pass
         head, tail = os.path.split(head)
         if tail == part:
-            try:
-                sys.path.remove(head)
-            except ValueError:
-                pass
-            sys.path.insert(0, head)
+            if head not in sys.path:
+                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	Thu Nov 18 11:51:20 2004
@@ -35,13 +35,14 @@
 
     while head:
         partdir = head
+        try:
+            sys.path.remove(head)
+        except ValueError:
+            pass
         head, tail = os.path.split(head)
         if tail == part:
-            try:
-                sys.path.remove(head)
-            except ValueError:
-                pass
-            sys.path.insert(0, head)
+            if head not in sys.path:
+                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	Thu Nov 18 11:51:20 2004
@@ -35,13 +35,14 @@
 
     while head:
         partdir = head
+        try:
+            sys.path.remove(head)
+        except ValueError:
+            pass
         head, tail = os.path.split(head)
         if tail == part:
-            try:
-                sys.path.remove(head)
-            except ValueError:
-                pass
-            sys.path.insert(0, head)
+            if head not in sys.path:
+                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	Thu Nov 18 11:51:20 2004
@@ -35,13 +35,14 @@
 
     while head:
         partdir = head
+        try:
+            sys.path.remove(head)
+        except ValueError:
+            pass
         head, tail = os.path.split(head)
         if tail == part:
-            try:
-                sys.path.remove(head)
-            except ValueError:
-                pass
-            sys.path.insert(0, head)
+            if head not in sys.path:
+                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	Thu Nov 18 11:51:20 2004
@@ -35,13 +35,14 @@
 
     while head:
         partdir = head
+        try:
+            sys.path.remove(head)
+        except ValueError:
+            pass
         head, tail = os.path.split(head)
         if tail == part:
-            try:
-                sys.path.remove(head)
-            except ValueError:
-                pass
-            sys.path.insert(0, head)
+            if head not in sys.path:
+                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/autopath.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/autopath.py	(original)
+++ pypy/trunk/src/pypy/objspace/std/autopath.py	Thu Nov 18 11:51:20 2004
@@ -35,13 +35,14 @@
 
     while head:
         partdir = head
+        try:
+            sys.path.remove(head)
+        except ValueError:
+            pass
         head, tail = os.path.split(head)
         if tail == part:
-            try:
-                sys.path.remove(head)
-            except ValueError:
-                pass
-            sys.path.insert(0, head)
+            if head not in sys.path:
+                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	Thu Nov 18 11:51:20 2004
@@ -35,13 +35,14 @@
 
     while head:
         partdir = head
+        try:
+            sys.path.remove(head)
+        except ValueError:
+            pass
         head, tail = os.path.split(head)
         if tail == part:
-            try:
-                sys.path.remove(head)
-            except ValueError:
-                pass
-            sys.path.insert(0, head)
+            if head not in sys.path:
+                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	Thu Nov 18 11:51:20 2004
@@ -35,13 +35,14 @@
 
     while head:
         partdir = head
+        try:
+            sys.path.remove(head)
+        except ValueError:
+            pass
         head, tail = os.path.split(head)
         if tail == part:
-            try:
-                sys.path.remove(head)
-            except ValueError:
-                pass
-            sys.path.insert(0, head)
+            if head not in sys.path:
+                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	Thu Nov 18 11:51:20 2004
@@ -35,13 +35,14 @@
 
     while head:
         partdir = head
+        try:
+            sys.path.remove(head)
+        except ValueError:
+            pass
         head, tail = os.path.split(head)
         if tail == part:
-            try:
-                sys.path.remove(head)
-            except ValueError:
-                pass
-            sys.path.insert(0, head)
+            if head not in sys.path:
+                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	Thu Nov 18 11:51:20 2004
@@ -35,13 +35,14 @@
 
     while head:
         partdir = head
+        try:
+            sys.path.remove(head)
+        except ValueError:
+            pass
         head, tail = os.path.split(head)
         if tail == part:
-            try:
-                sys.path.remove(head)
-            except ValueError:
-                pass
-            sys.path.insert(0, head)
+            if head not in sys.path:
+                sys.path.insert(0, head)
             return partdir, this_dir
         
     raise EnvironmentError, "'%s' missing in '%r'" % (pathpart,this_path)

Modified: pypy/trunk/src/pypy/translator/autopath.py
==============================================================================
--- pypy/trunk/src/pypy/translator/autopath.py	(original)
+++ pypy/trunk/src/pypy/translator/autopath.py	Thu Nov 18 11:51:20 2004
@@ -35,13 +35,14 @@
 
     while head:
         partdir = head
+        try:
+            sys.path.remove(head)
+        except ValueError:
+            pass
         head, tail = os.path.split(head)
         if tail == part:
-            try:
-                sys.path.remove(head)
-            except ValueError:
-                pass
-            sys.path.insert(0, head)
+            if head not in sys.path:
+                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	Thu Nov 18 11:51:20 2004
@@ -35,13 +35,14 @@
 
     while head:
         partdir = head
+        try:
+            sys.path.remove(head)
+        except ValueError:
+            pass
         head, tail = os.path.split(head)
         if tail == part:
-            try:
-                sys.path.remove(head)
-            except ValueError:
-                pass
-            sys.path.insert(0, head)
+            if head not in sys.path:
+                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	Thu Nov 18 11:51:20 2004
@@ -35,13 +35,14 @@
 
     while head:
         partdir = head
+        try:
+            sys.path.remove(head)
+        except ValueError:
+            pass
         head, tail = os.path.split(head)
         if tail == part:
-            try:
-                sys.path.remove(head)
-            except ValueError:
-                pass
-            sys.path.insert(0, head)
+            if head not in sys.path:
+                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	Thu Nov 18 11:51:20 2004
@@ -35,13 +35,14 @@
 
     while head:
         partdir = head
+        try:
+            sys.path.remove(head)
+        except ValueError:
+            pass
         head, tail = os.path.split(head)
         if tail == part:
-            try:
-                sys.path.remove(head)
-            except ValueError:
-                pass
-            sys.path.insert(0, head)
+            if head not in sys.path:
+                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