mailr15786 - in /1.3: relax.py status.py


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

Header


Content

Posted by edward on April 20, 2012 - 00:31:
Author: bugman
Date: Fri Apr 20 00:31:03 2012
New Revision: 15786

URL: http://svn.gna.org/viewcvs/relax?rev=15786&view=rev
Log:
Big bug fix for the installation path for the relax Mac OS X application.

The path to the application Resources folder, where all the relax data files 
are located, is now set
to the install path.  The relax.py module was also overwriting the value set 
in the status singleton
and now this no longer occurs.


Modified:
    1.3/relax.py
    1.3/status.py

Modified: 1.3/relax.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/relax.py?rev=15786&r1=15785&r2=15786&view=diff
==============================================================================
--- 1.3/relax.py (original)
+++ 1.3/relax.py Fri Apr 20 00:31:03 2012
@@ -30,11 +30,6 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
 #
 #                                                                            
 #
 
###############################################################################
-
-# First of all, store the relax installation path before the site-packages 
mangle sys.path.
-from status import Status; status = Status()
-import sys
-status.install_path = sys.path[0]
 
 # Dependency checks.
 import dep_check
@@ -57,6 +52,7 @@
 import relax_errors
 from relax_io import io_streams_log, io_streams_tee
 import relax_warnings
+from status import Status; status = Status()
 from version import version
 
 # Modify the environmental variables.

Modified: 1.3/status.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/status.py?rev=15786&r1=15785&r2=15786&view=diff
==============================================================================
--- 1.3/status.py (original)
+++ 1.3/status.py Fri Apr 20 00:31:03 2012
@@ -29,6 +29,7 @@
 import platform
 from Queue import Queue
 from re import search
+from string import split
 import sys
 from threading import Lock, RLock
 
@@ -66,7 +67,7 @@
 
     def _det_install_path(self):
         """Determine, with a bit of magic, the relax installation path.
-        
+
         @return:    The relax installation path.  With a Mac OS X app, this 
will be the path to the 'Resources'.
         @rtype:     str
         """
@@ -80,8 +81,19 @@
             if access(path + sep + file_to_find, F_OK):
                 return path
 
-        # Return the install path.
-        return install_path
+        # Mac OS X application support.
+        for path in sys.path:
+            # Find the Resources folder, where the relax data files are 
located.
+            if search('Resources', path):
+                # Nasty hack for creating the Resources path.
+                bits = split(path, 'Resources')
+                mac_path = bits[0] + 'Resources'
+
+                # Return the Mac Resources folder path.
+                return mac_path
+
+        # Return the first entry of sys.path as a fallback.
+        return sys.path[0]
 
 
     def _setup(self):




Related Messages


Powered by MHonArc, Updated Fri Apr 20 23:00:02 2012