# HG changeset patch
# User Yi Qiang <yqiang@gmail.com>
# Date 1178898590 25200
# Node ID bc4ebc0b4f549ba87a09429b1bb5c7c3c5c22f91
# Parent  299c29b6162519c437be048276ca24f7c3e07e4f
hostinfo.py fix for detecting cpu model.

diff -r 299c29b61625 -r bc4ebc0b4f54 sage/dsage/misc/hostinfo.py
--- a/sage/dsage/misc/hostinfo.py	Fri May 11 00:48:12 2007 -0700
+++ b/sage/dsage/misc/hostinfo.py	Fri May 11 08:49:50 2007 -0700
@@ -23,7 +23,11 @@ from twisted.python import log
 from twisted.python import log
 
 class HostInfo(pb.Copyable, pb.RemoteCopy):
-    """Class to gather computer specifications on the running host."""
+    """
+    Class to gather computer specifications on the running host.
+    
+    """
+    
     def __str__(self):
         return str(self.host_info)
 
@@ -200,16 +204,16 @@ class ClassicHostInfo(object):
                 # kernel version
                 kernel_version = os.popen('uname -r').readline().strip()
                 host_info['kernel_version'] = kernel_version
-
-            except IOError:
-                raise
-
-            host_info['os'] = platform
-            
-            return self.canonical_info(host_info)
+                
+                # if the model name was not in /proc/cpuinfo
+                if not host_info.has_key('model name'):
+                    model = os.popen('uname -p').readline().strip()
+                    host_info['model name'] = model
+            except IOError, msg:
+                raise            
         if platform == 'darwin':
-            try:
-                # os
+            host_info['os'] = platform
+            try:
                 for line in os.popen('sysctl -a hw machdep').readlines():
                     l = line.strip()
                     if '=' in l:
@@ -245,9 +249,7 @@ class ClassicHostInfo(object):
                 log.msg(msg)
                 raise
 
-            host_info['os'] = platform
-
-            return self.canonical_info(host_info)
+        return self.canonical_info(host_info)
 
     def canonical_info(self, platform_host_info):
         """
diff -r 299c29b61625 -r bc4ebc0b4f54 sage/dsage/twisted/tests/test_pubkeyauth.py
--- a/sage/dsage/twisted/tests/test_pubkeyauth.py	Fri May 11 00:48:12 2007 -0700
+++ b/sage/dsage/twisted/tests/test_pubkeyauth.py	Fri May 11 08:49:50 2007 -0700
@@ -84,8 +84,8 @@ class PublicKeyCredentialsCheckerTest(un
         self.realm = Realm(self.dsage_server)
         self.p = _SSHKeyPortalRoot(portal.Portal(Realm(self.dsage_server)))
         self.clientdb = ClientDatabase(test=True)
-        self.p.portal.registerChecker(
-        PublicKeyCredentialsCheckerDB(self.clientdb))
+        self.p.portal.registerChecker(PublicKeyCredentialsCheckerDB(
+                                      self.clientdb))
         self.client_factory = pb.PBServerFactory(self.p)
         self.hostname = 'localhost'
         self.r = reactor.listenTCP(0, self.client_factory)
diff -r 299c29b61625 -r bc4ebc0b4f54 sage/dsage/twisted/tests/test_remote.py
--- a/sage/dsage/twisted/tests/test_remote.py	Fri May 11 00:48:12 2007 -0700
+++ b/sage/dsage/twisted/tests/test_remote.py	Fri May 11 08:49:50 2007 -0700
@@ -254,7 +254,8 @@ class MonitorRemoteCallsTest(unittest.Te
     
     def testremote_job_done(self):
         factory = PBClientFactory()
-        self.connection = reactor.connectTCP(self.hostname, self.port, factory)                                       
+        self.connection = reactor.connectTCP(self.hostname, self.port,
+                                             factory)                                       
         d = factory.login(self.creds, (pb.Referenceable(), hf))
         job = Job()
         job.code = "2+2"
