Author: bugman
Date: Tue Nov 11 15:58:45 2014
New Revision: 26525

URL: http://svn.gna.org/viewcvs/relax?rev=26525&view=rev
Log:
Better Python 3 compatibility in some test suite shared data profiling scripts.

These changes invert the logic, importing the Python 3 builtins module and 
aliasing xrange() to
range(), and passing if an ImporError occurs.  The code will now no longer be 
modified by the 2to3
program.


Modified:
    trunk/test_suite/shared_data/curve_fitting/profiling/profiling_relax_fit.py
    trunk/test_suite/shared_data/dispersion/profiling/base.py

Modified: 
trunk/test_suite/shared_data/curve_fitting/profiling/profiling_relax_fit.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/shared_data/curve_fitting/profiling/profiling_relax_fit.py?rev=26525&r1=26524&r2=26525&view=diff
==============================================================================
--- trunk/test_suite/shared_data/curve_fitting/profiling/profiling_relax_fit.py 
(original)
+++ trunk/test_suite/shared_data/curve_fitting/profiling/profiling_relax_fit.py 
Tue Nov 11 15:58:45 2014
@@ -3,6 +3,7 @@
 ###############################################################################
 #                                                                             #
 # Copyright (C) 2014 Troels E. Linnet                                         #
+# Copyright (C) 2014 Edward d'Auvergne                                        #
 #                                                                             #
 # This file is part of the program relax (http://www.nmr-relax.com).          #
 #                                                                             #
@@ -35,11 +36,10 @@
 
 # Python 3 support.
 try:
-    import __builtin__
-    del __builtin__
-except ImportError:
     import builtins
     builtins.xrange = builtins.range
+except ImportError:
+    pass
 
 # Add to system path, according to 
 if len(sys.argv) == 1:

Modified: trunk/test_suite/shared_data/dispersion/profiling/base.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/shared_data/dispersion/profiling/base.py?rev=26525&r1=26524&r2=26525&view=diff
==============================================================================
--- trunk/test_suite/shared_data/dispersion/profiling/base.py   (original)
+++ trunk/test_suite/shared_data/dispersion/profiling/base.py   Tue Nov 11 
15:58:45 2014
@@ -34,11 +34,10 @@
 
 # Python 3 support.
 try:
-    import __builtin__
-    del __builtin__
-except ImportError:
     import builtins
     builtins.xrange = builtins.range
+except ImportError:
+    pass
 
 # Add to system path, according to 
 if len(sys.argv) == 1:


_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-commits mailing list
[email protected]

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits

Reply via email to