commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r7790 - trunk/gnue-common/src/utils


From: reinhard
Subject: [gnue] r7790 - trunk/gnue-common/src/utils
Date: Fri, 5 Aug 2005 15:04:35 -0500 (CDT)

Author: reinhard
Date: 2005-08-05 15:04:34 -0500 (Fri, 05 Aug 2005)
New Revision: 7790

Modified:
   trunk/gnue-common/src/utils/uuid.py
Log:
Use MAC address introspection code only on Linux, not on other Posix systems.


Modified: trunk/gnue-common/src/utils/uuid.py
===================================================================
--- trunk/gnue-common/src/utils/uuid.py 2005-08-05 19:40:56 UTC (rev 7789)
+++ trunk/gnue-common/src/utils/uuid.py 2005-08-05 20:04:34 UTC (rev 7790)
@@ -36,7 +36,7 @@
 
 from gnue.common.apps import errors
 
-if os.name == 'nt':
+if sys.platform == 'nt':
   try:
     from win32com.client import GetObject
     _HAS_GETOBJECT = True
@@ -76,7 +76,7 @@
 lock       = threading.Lock ()
 manualLock = sys.version_info [:2] < (2, 3)
 
-if os.name == 'posix':
+if sys.platform == 'linux2':
   try:
     dev_random = os.open ('/dev/urandom', os.O_RDONLY)
 
@@ -177,7 +177,7 @@
 
     result = None
 
-    if os.name == 'posix':
+    if sys.platform == 'linux2':
       sfhd  = socket.socket (socket.AF_INET, socket.SOCK_DGRAM)
       ifreq = (interface + '\0' * 32) [:32]
 
@@ -188,7 +188,7 @@
       finally:
         sfhd.close ()
 
-    elif os.name == 'nt':
+    elif sys.platform == 'win32':
       parts  = interface.MACAddress.split (':')
       args   = [16] * len (parts)
       result = map (int, parts, args)
@@ -227,7 +227,7 @@
 
     result = []
 
-    if os.name == 'posix':
+    if sys.platform == 'linux2':
       sfhd   = socket.socket (socket.AF_INET, socket.SOCK_DGRAM)
 
       try:
@@ -245,7 +245,7 @@
       finally:
         sfhd.close ()
 
-    elif os.name == 'nt' and _HAS_GETOBJECT:
+    elif sys.platform == 'win32' and _HAS_GETOBJECT:
       result = [i for i in GetObject ('winmgmts:').ExecQuery ("SELECT * FROM "
                      "Win32_NetworkAdapterConfiguration WHERE IPEnabled=True")]
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]