Salome HOME
This commit was generated by cvs2git to track changes on a CVS vendor
[modules/kernel.git] / src / Utils / Utils_Identity.py
1 #! /usr/bin/env python
2 #
3 #  SALOME Utils : general SALOME's definitions and tools
4 #
5 #  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
6 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
7
8 #  This library is free software; you can redistribute it and/or 
9 #  modify it under the terms of the GNU Lesser General Public 
10 #  License as published by the Free Software Foundation; either 
11 #  version 2.1 of the License. 
12
13 #  This library is distributed in the hope that it will be useful, 
14 #  but WITHOUT ANY WARRANTY; without even the implied warranty of 
15 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
16 #  Lesser General Public License for more details. 
17
18 #  You should have received a copy of the GNU Lesser General Public 
19 #  License along with this library; if not, write to the Free Software 
20 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
21
22 #  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
23 #
24 #
25 #
26 #  File   : Utils_Identity.py
27 #  Author : Estelle Deville, CEA
28 #  Module : SALOME
29 #  $Header$
30
31 import sys
32 import os
33 import socket
34 import pwd
35 import time
36
37 class Identity:
38     def __init__(self,name):
39         self._name = name
40         self._pid =  os.getpid()
41         self._machine = os.getenv( "HOSTNAME" )
42         self._adip      =  socket.gethostbyname(self._machine) # IP adress
43         self._uid       = os.getuid() 
44         list = pwd.getpwuid(self._uid)
45         self._pwname    = list[0] # user name
46         self._tc_start  = time.time()
47         self._cstart    = time.ctime(self._tc_start)
48         self._cdir      = os.getcwd()