mailr10825 - in /1.3: info.py relax


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

Header


Content

Posted by edward on February 22, 2010 - 18:04:
Author: bugman
Date: Mon Feb 22 18:04:14 2010
New Revision: 10825

URL: http://svn.gna.org/viewcvs/relax?rev=10825&view=rev
Log:
Added the -i or --info option to relax.

This causes all of the information about relax and Python to be printed by 
calling
Info_box.print_sys_info().  This option will be useful for determining issues 
with relax installs!


Modified:
    1.3/info.py
    1.3/relax

Modified: 1.3/info.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/info.py?rev=10825&r1=10824&r2=10825&view=diff
==============================================================================
--- 1.3/info.py (original)
+++ 1.3/info.py Mon Feb 22 18:04:14 2010
@@ -25,6 +25,8 @@
 
 # relax module imports.
 import dep_check
+import numpy
+import platform
 from version import version
 
 
@@ -111,6 +113,52 @@
 
         # Return the new string.
         return string
+
+
+    def print_sys_info(self):
+        """Print some info about the current relax instance."""
+
+        # Formatting string.
+        format = "    %-25s%s"
+
+        # The relax version.
+        print("\nrelax information:")
+        print(format % ("relax version: ", version))
+
+        # Hardware info.
+        print("\nHardware information:")
+        print(format % ("Machine: ", platform.machine()))
+        print(format % ("Processor: ", platform.processor()))
+
+        # System info.
+        print("\nSystem information:")
+        print(format % ("System: ", platform.system()))
+        print(format % ("Release: ", platform.release()))
+        print(format % ("Version: ", platform.version()))
+        if platform.win32_ver()[0]:
+            print(format % ("Win32 version: ", (platform.win32_ver()[0] + " 
" + platform.win32_ver()[1] + " " + platform.win32_ver()[2] + " " + 
platform.win32_ver()[3])))
+        if platform.linux_distribution()[0]:
+            print(format % ("GNU/Linux version: ", 
(platform.linux_distribution()[0] + " " + platform.linux_distribution()[1] + 
" " + platform.linux_distribution()[2])))
+        if platform.mac_ver()[0]:
+            print(format % ("Mac version: ", (platform.mac_ver()[0] + " (" + 
platform.mac_ver()[1][0] + ", " + platform.mac_ver()[1][1] + ", " + 
platform.mac_ver()[1][2] + ") " + platform.mac_ver()[2])))
+        print(format % ("Distribution: ", (platform.dist()[0] + " " + 
platform.dist()[1] + " " + platform.dist()[2])))
+        print(format % ("Full platform string: ", (platform.platform())))
+
+        # Software info.
+        print("\nSoftware information:")
+        print(format % ("Architecture: ", (platform.architecture()[0] + " " 
+ platform.architecture()[1])))
+        print(format % ("Python version: ", platform.python_version()))
+        print(format % ("Python branch: ", platform.python_branch()))
+        print((format+', %s') % ("Python build: ", 
platform.python_build()[0], platform.python_build()[1]))
+        print(format % ("Python compiler: ", platform.python_compiler()))
+        print(format % ("Python implementation: ", 
platform.python_implementation()))
+        print(format % ("Python revision: ", platform.python_revision()))
+        print(format % ("Numpy version: ", numpy.__version__))
+        print(format % ("Libc version: ", (platform.libc_ver()[0] + " " + 
platform.libc_ver()[1])))
+        print(format % ("Network name: ", platform.node()))
+
+        # End with an empty newline.
+        print("")
 
 
 

Modified: 1.3/relax
URL: 
http://svn.gna.org/viewcvs/relax/1.3/relax?rev=10825&r1=10824&r2=10825&view=diff
==============================================================================
--- 1.3/relax (original)
+++ 1.3/relax Mon Feb 22 18:04:14 2010
@@ -40,7 +40,6 @@
 # Python modules.
 from optparse import Option, OptionParser
 from os import F_OK, access, getpid, putenv
-import platform
 if dep_check.profile_module:
     import profile
 import pstats
@@ -49,6 +48,7 @@
 import sys
 
 # relax modules.
+from info import Info_box
 import generic_fns
 from prompt.gpl import gpl
 from prompt import interpreter
@@ -77,9 +77,6 @@
         # Get and store the PID of this process.
         self.pid = getpid()
 
-        # Store the operating system name.
-        self.platform = platform.uname()[0]
-
         # Debugging flag (default is off).
         self.Debug = 0
 
@@ -103,6 +100,12 @@
         # Show the version number and exit.
         if mode == 'version':
             print(('relax ' + version))
+            sys.exit()
+
+        # Show the relax info and exit.
+        if mode == 'info':
+            info = Info_box()
+            info.print_sys_info()
             sys.exit()
 
         # Logging.
@@ -170,6 +173,7 @@
         parser.add_option('-x', '--test-suite', action='store_true', 
dest='test_suite', default=0, help='execute the relax test suite')
         parser.add_option('-s', '--system-tests', action='store_true', 
dest='system_tests', default=0, help='execute the relax system/functional 
tests (part of the test suite)')
         parser.add_option('-u', '--unit-tests', action='store_true', 
dest='unit_tests', default=0, help='execute the relax unit tests (part of the 
test suite)')
+        parser.add_option('-i', '--info', action='store_true', dest='info', 
default=0, help='display information about this version of relax')
         parser.add_option('-v', '--version', action='store_true', 
dest='version', default=0, help='show the version number and exit')
 
         # Parse the options.
@@ -239,6 +243,10 @@
         # Show the version number.
         if options.version:
             mode = 'version'
+
+        # Show the info about this relax version.
+        elif options.info:
+            mode = 'info'
 
         # Run the relax tests.
         elif options.test_suite or options.system_tests or 
options.unit_tests:




Related Messages


Powered by MHonArc, Updated Mon Feb 22 18:20:02 2010