From 4fa0c2e578c9e1686e9cb41de52ee026e3d8c093 Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Tue, 11 Dec 2018 20:17:10 +0100 Subject: [PATCH] Increase platform information --- src/daComposant/daCore/ExtendedLogging.py | 6 +++--- src/daComposant/daCore/PlatformInfo.py | 26 +++++++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/daComposant/daCore/ExtendedLogging.py b/src/daComposant/daCore/ExtendedLogging.py index c38b7a0..d82fa1d 100644 --- a/src/daComposant/daCore/ExtendedLogging.py +++ b/src/daComposant/daCore/ExtendedLogging.py @@ -115,9 +115,9 @@ class ExtendedLogging(object): logging.info( "- Sphinx.......: "+str(PlatformInfo.has_sphinx) ) logging.info( "- Nlopt........: "+str(PlatformInfo.has_nlopt) ) logging.info( "Library versions:" ) - logging.info( "- Python.......:"+p.getPythonVersion() ) - logging.info( "- Numpy........:"+p.getNumpyVersion() ) - logging.info( "- Scipy........:"+p.getScipyVersion() ) + logging.info( "- Python.......: "+p.getPythonVersion() ) + logging.info( "- Numpy........: "+p.getNumpyVersion() ) + logging.info( "- Scipy........: "+p.getScipyVersion() ) logging.info( "" ) def setLogfile(self, filename=LOGFILE, filemode="w", level=logging.NOTSET): diff --git a/src/daComposant/daCore/PlatformInfo.py b/src/daComposant/daCore/PlatformInfo.py index 3c6ac27..e0d5087 100644 --- a/src/daComposant/daCore/PlatformInfo.py +++ b/src/daComposant/daCore/PlatformInfo.py @@ -46,6 +46,8 @@ __all__ = [] import os import sys +import platform +import locale # ============================================================================== class PlatformInfo(object): @@ -76,6 +78,30 @@ class PlatformInfo(object): import daCore.version as dav return dav.year + def getSystemInformation(self, __prefix=""): + __msg = "" + __msg += "\n%s%30s : %s" %(__prefix,"platform.system",platform.system()) + __msg += "\n%s%30s : %s" %(__prefix,"sys.platform",sys.platform) + __msg += "\n%s%30s : %s" %(__prefix,"platform.version",platform.version()) + __msg += "\n%s%30s : %s" %(__prefix,"platform.platform",platform.platform()) + __msg += "\n%s%30s : %s" %(__prefix,"platform.machine",platform.machine()) + if sys.platform.startswith('linux'): + if hasattr(platform, 'linux_distribution'): + __msg += "\n%s%30s : %s" %(__prefix, + "platform.linux_distribution",str(platform.linux_distribution())) + else: + __msg += "\n%s%30s : %s" %(__prefix,"platform.dist",str(platform.dist())) + elif os.name == 'nt': + __msg += "\n%s%30s : %s" %(__prefix,"platform.win32_ver",platform.win32_ver()[1]) + # + __msg += "\n" + __msg += "\n%s%30s : %s" %(__prefix,"platform.python_implementation",platform.python_implementation()) + __msg += "\n%s%30s : %s" %(__prefix,"sys.executable",sys.executable) + __msg += "\n%s%30s : %s" %(__prefix,"sys.version",sys.version.replace('\n','')) + __msg += "\n%s%30s : %s" %(__prefix,"sys.getfilesystemencoding",str(sys.getfilesystemencoding())) + __msg += "\n%s%30s : %s" %(__prefix,"locale.getdefaultlocale",str(locale.getdefaultlocale())) + return __msg + def getPythonVersion(self): "Retourne la version de python disponible" return ".".join([str(x) for x in sys.version_info[0:3]]) # map(str,sys.version_info[0:3])) -- 2.39.2