Package PyFoam :: Package ThirdParty :: Module winhacks
[hide private]
[frames] | no frames]

Source Code for Module PyFoam.ThirdParty.winhacks

 1  ''' 
 2  ------------------------------------------------------------------------------ 
 3   License 
 4      This file is part of blueCAPE's modifications to PyFoam for working on 
 5      Windows. For more information on these modifications, visit: 
 6          http://www.bluecape.com.pt/blueCFD 
 7   
 8      PyFoam is free software; you can redistribute it and/or modify it 
 9      under the terms of the GNU General Public License as published by the 
10      Free Software Foundation; either version 2 of the License, or (at your 
11      option) any later version.  See the file COPYING in this directory, 
12      for a description of the GNU General Public License terms under which  
13      you can copy the files. 
14   
15   Script 
16       winhacks.py 
17   
18   Description 
19       This script file acts mostly as a dummy stub for several POSIX functions 
20       that are not available on Windows and on Python for Windows. 
21       Source code available on this file is a compilation of public domain 
22       solutions. 
23   
24  ------------------------------------------------------------------------------ 
25  ''' 
26   
27  import os 
28   
29  __CSL = None 
45   
46 -def getlogin():
47 '''getlogin() 48 Get login username from environment.''' 49 return os.getenv('USERNAME')
50
51 -def getloadavg():
52 '''Dummy result, 1 to avoid division by zero''' 53 return 1
54 55 '''hack the three functions above into the os module''' 56 os.symlink = symlink 57 os.getlogin = getlogin 58 os.getloadavg = getloadavg 59 60 """These 3 can be improved if we use http://code.google.com/p/psutil/""" 61 """All return 1 to avoid divisions by zero"""
62 -def getrusage(who):
63 return 1
64
65 -def getpagesize():
66 return 1
67 68 RUSAGE_CHILDREN = 1 69