mailr12106 - in /1.3: relax status.py


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

Header


Content

Posted by edward on January 04, 2011 - 09:15:
Author: bugman
Date: Tue Jan  4 09:15:20 2011
New Revision: 12106

URL: http://svn.gna.org/viewcvs/relax?rev=12106&view=rev
Log:
Changed how the status singleton object is setup - it does it itself!

The status object now sets up itself so that a call to setup() is no longer 
necessary.  setup()
is now private, and relax just overrides the default variables to set the 
debugging flag or 
installation path.


Modified:
    1.3/relax
    1.3/status.py

Modified: 1.3/relax
URL: 
http://svn.gna.org/viewcvs/relax/1.3/relax?rev=12106&r1=12105&r2=12106&view=diff
==============================================================================
--- 1.3/relax (original)
+++ 1.3/relax Tue Jan  4 09:15:20 2011
@@ -34,8 +34,9 @@
 
###############################################################################
 
 # First of all, store the relax installation path before the site-packages 
mangle sys.path.
+from status import Status; status = Status()
 import sys
-install_path = sys.path[0]
+status.install_path = sys.path[0]
 
 # Dependency checks.
 import dep_check
@@ -58,7 +59,6 @@
 import relax_errors
 from relax_io import io_streams_log, io_streams_tee
 import relax_warnings
-from status import Status
 from test_suite.test_suite_runner import Test_suite_runner
 from version import version
 
@@ -79,10 +79,6 @@
 
         # Get and store the PID of this process.
         self.pid = getpid()
-
-        # Initialise the status singleton.
-        status = Status()
-        status.setup(install_path)
 
         # Setup the object containing the generic functions.
         self.generic = generic_fns
@@ -177,7 +173,7 @@
 
         # Debugging flag.
         if options.debug:
-            Status().debug = True
+            status.debug = True
 
         # Pedantic flag.
         self.pedantic = False

Modified: 1.3/status.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/status.py?rev=12106&r1=12105&r2=12106&view=diff
==============================================================================
--- 1.3/status.py (original)
+++ 1.3/status.py Tue Jan  4 09:15:20 2011
@@ -43,20 +43,19 @@
             # Instantiate.
             self._instance = object.__new__(self, *args, **kargs)
 
+            # Initialise some variables.
+            self._instance.debug = False
+            self._instance.install_path = sys.path[0]
+
+            # Set up the singleton.
+            self._instance._setup()
+
         # Already instantiated, so return the instance.
         return self._instance
 
 
-    def setup(self, install_path=None, debug=False):
+    def _setup(self):
         """Initialise all the status data structures."""
-
-        # Store the args.
-        self.install_path = install_path
-        self.debug = debug
-
-        # The install path, if not given (this assumes package loading has 
not mangled the path).
-        if not self.install_path:
-            self.install_paths = sys.path[0]
 
         # Execution lock object.
         self.exec_lock = Exec_lock()




Related Messages


Powered by MHonArc, Updated Tue Jan 04 09:20:02 2011