mailr17614 - in /trunk: data/__init__.py generic_fns/pipes.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on September 28, 2012 - 18:57:
Author: bugman
Date: Fri Sep 28 18:57:45 2012
New Revision: 17614

URL: http://svn.gna.org/viewcvs/relax?rev=17614&view=rev
Log:
Python 3 preparations - support for both Python 2 __builtin__ and Python 3 
builtins modules.


Modified:
    trunk/data/__init__.py
    trunk/generic_fns/pipes.py

Modified: trunk/data/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/data/__init__.py?rev=17614&r1=17613&r2=17614&view=diff
==============================================================================
--- trunk/data/__init__.py (original)
+++ trunk/data/__init__.py Fri Sep 28 18:57:45 2012
@@ -24,7 +24,10 @@
 
 
 # Python module imports.
-import __builtin__
+try:
+    import __builtin__ as builtins    # Python 2 import.
+else:
+    import builtins    # Python 3 import.
 from re import search
 from sys import stderr
 from time import asctime
@@ -58,7 +61,7 @@
 
     # The current data pipe.
     current_pipe = None
-    __builtin__.cdp = None
+    builtins.cdp = None
 
     # Class variable for storing the class instance.
     instance = None
@@ -173,7 +176,7 @@
         self.instance.clear()
 
         # Reset the current data pipe.
-        __builtin__.cdp = None
+        builtins.cdp = None
 
         # Recreate the pipe bundle object.
         self.instance.pipe_bundles = {}
@@ -308,7 +311,7 @@
         if switch:
             # Set the current data pipe.
             self.instance.current_pipe = pipe_name
-            __builtin__.cdp = self[pipe_name]
+            builtins.cdp = self[pipe_name]
 
             # Signal the switch.
             status.observers.pipe_alteration.notify()
@@ -477,7 +480,7 @@
 
             # Set the current pipe.
             if self.current_pipe in self.keys():
-                __builtin__.cdp = self[self.current_pipe]
+                builtins.cdp = self[self.current_pipe]
 
         # Finally update the molecule, residue, and spin metadata.
         generic_fns.mol_res_spin.metadata_update()

Modified: trunk/generic_fns/pipes.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/generic_fns/pipes.py?rev=17614&r1=17613&r2=17614&view=diff
==============================================================================
--- trunk/generic_fns/pipes.py (original)
+++ trunk/generic_fns/pipes.py Fri Sep 28 18:57:45 2012
@@ -24,7 +24,10 @@
 
 
 # Python module imports
-import __builtin__
+try:
+    import __builtin__ as builtins    # Python 2 import.
+else:
+    import builtins    # Python 3 import.
 import sys
 
 # relax module imports.
@@ -237,7 +240,7 @@
             # Set the current data pipe to None if it is the deleted data 
pipe.
             if ds.current_pipe == pipe:
                 ds.current_pipe = None
-                __builtin__.cdp = None
+                builtins.cdp = None
 
     # Release the lock.
     finally:
@@ -428,7 +431,7 @@
 
         # Switch the current data pipe.
         ds.current_pipe = pipe_name
-        __builtin__.cdp = get_pipe()
+        builtins.cdp = get_pipe()
 
     # Release the lock.
     finally:




Related Messages


Powered by MHonArc, Updated Fri Sep 28 19:00:02 2012