#-*-coding:iso-8859-1-*-
#
-# Copyright (C) 2008-2009 EDF R&D
+# Copyright (C) 2008-2012 EDF R&D
#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+# Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
+
__doc__ = """
Informations sur le code et la plateforme, et mise à jour des chemins
simplement cette classe, sans meme récupérer d'objet :
PathManagement()
"""
-__author__ = "Jean-Philippe ARGAUD - Mars 2008"
+__author__ = "Jean-Philippe ARGAUD"
import os
import version
return "%s %s (%s)"%(version.name,version.version,version.date)
+# ==============================================================================
+def uniq(sequence):
+ """
+ Fonction pour rendre unique chaque élément d'une liste, en préservant l'ordre
+ """
+ __seen = set()
+ return [x for x in sequence if x not in __seen and not __seen.add(x)]
+
# ==============================================================================
class PathManagement:
"""
Mise à jour du path système pour les répertoires d'outils
"""
def __init__(self):
- import os, sys
+ import sys
parent = os.path.abspath(os.path.join(os.path.dirname(__file__),".."))
self.__paths = {}
self.__paths["daExternals"] = os.path.join(parent,"daExternals")
sys.path.insert(0, v )
#
# Conserve en unique exemplaire chaque chemin
- sys.path = list(set(sys.path))
+ sys.path = uniq( sys.path )
del parent
-
+
def getpaths(self):
"""
Renvoie le dictionnaire des chemins ajoutés
_proc_status = '/proc/%d/status' % os.getpid()
_memo_status = '/proc/meminfo'
_scale = {
- 'o': 1.0,
- 'ko': 1024.0, 'mo': 1024.0*1024.0,
- 'Ko': 1024.0, 'Mo': 1024.0*1024.0,
- 'B': 1.0,
- 'kB': 1024.0, 'mB': 1024.0*1024.0,
- 'KB': 1024.0, 'MB': 1024.0*1024.0,
+ 'K' : 1024.0, 'M' : 1024.0*1024.0,
+ 'o': 1.0, 'ko': 1024.0, 'mo': 1024.0*1024.0,
+ 'Ko': 1024.0, 'Mo': 1024.0*1024.0,
+ 'B': 1.0, 'kB': 1024.0, 'mB': 1024.0*1024.0,
+ 'KB': 1024.0, 'MB': 1024.0*1024.0,
}
_max_mem = 0
_max_rss = 0