mailr17647 - in /trunk: compat.py relax.py


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

Header


Content

Posted by edward on October 02, 2012 - 10:35:
Author: bugman
Date: Tue Oct  2 10:35:22 2012
New Revision: 17647

URL: http://svn.gna.org/viewcvs/relax?rev=17647&view=rev
Log:
Created a new module for simultaneous Python 2 and 3 support in relax called 
'compat'.


Added:
    trunk/compat.py
Modified:
    trunk/relax.py

Added: trunk/compat.py
URL: http://svn.gna.org/viewcvs/relax/trunk/compat.py?rev=17647&view=auto
==============================================================================
--- trunk/compat.py (added)
+++ trunk/compat.py Tue Oct  2 10:35:22 2012
@@ -1,0 +1,34 @@
+###############################################################################
+#                                                                            
 #
+# Copyright (C) 2012 Edward d'Auvergne                                       
 #
+#                                                                            
 #
+# This file is part of the program relax (http://www.nmr-relax.com).         
 #
+#                                                                            
 #
+# This program is free software: you can redistribute it and/or modify       
 #
+# it under the terms of the GNU General Public License as published by       
 #
+# the Free Software Foundation, either version 3 of the License, or          
 #
+# (at your option) any later version.                                        
 #
+#                                                                            
 #
+# This program is distributed in the hope that it will be useful,            
 #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of             
 #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              
 #
+# GNU General Public License for more details.                               
 #
+#                                                                            
 #
+# You should have received a copy of the GNU General Public License          
 #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.      
 #
+#                                                                            
 #
+###############################################################################
+
+# Module docstring.
+"""Temporary module for allowing relax to support both Python 2 and 3."""
+
+# Python module imports.
+import sys
+
+# Python 3 work-arounds.
+if sys.version_info[0] == 3:
+    # Python 3 only imports.
+    import builtins
+
+    # The unicode conversion function - essential for the GUI in Python 2.
+    builtins.unicode = builtins.str

Modified: trunk/relax.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/relax.py?rev=17647&r1=17646&r2=17647&view=diff
==============================================================================
--- trunk/relax.py (original)
+++ trunk/relax.py Tue Oct  2 10:35:22 2012
@@ -55,6 +55,9 @@
 
 # Modify the environmental variables.
 putenv('PDBVIEWER', 'vmd')
+
+# Python 2 and 3 work-arounds.
+import compat
 
 
 def start(mode=None, profile_flag=False):




Related Messages


Powered by MHonArc, Updated Tue Oct 02 11:00:01 2012