Salome HOME
Fixed problem with dump study and small optimization:
[modules/kernel.git] / bin / appliskel / update_catalogs.py
index e55acc1a110e5484510cc8737e8d1b05ff145659..82fce4834b27535c44b801276b905f6a677eead5 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #  -*- coding: utf-8 -*-
-# Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -8,7 +8,7 @@
 # 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.
+# version 2.1 of the License, or (at your option) any later version.
 #
 # This library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,6 +26,7 @@
 """
 import sys,os,shutil,glob,socket
 import optparse
+from salome_utils import getUserName
 
 import getAppliPath
 appli_local=os.path.realpath(os.path.dirname(__file__))
@@ -116,7 +117,7 @@ class Resource:
   def get_user(self):
     userName= self.node.get("userName")
     if not userName:
-      userName=os.getenv('USER')
+      userName=getUserName()
     return userName
 
   def get_host(self):
@@ -143,7 +144,7 @@ class Resource:
 
     resource_dir=os.path.join(cata_dir,self.get_name())
 
-    if hostname == "localhost" or hostname == get_hostname() and userName == os.getenv("USER"):
+    if hostname == "localhost" or hostname == get_hostname() and userName == getUserName():
       #local machine, use cp
       if appliPath[0]!='/':
         #relative path
@@ -187,7 +188,7 @@ class Resource:
     resource_dir=os.path.join(cata_dir,self.get_name())
     catalogs_list=glob.glob(os.path.join(resource_dir,"*Catalog.xml"))
 
-    if hostname == "localhost" or hostname == get_hostname() and userName == os.getenv("USER"):
+    if hostname == "localhost" or hostname == get_hostname() and userName == getUserName():
       #user local resource
       if appliPath[0]!='/':
         appliPath=os.path.join(os.getenv("HOME"),appliPath)