Trees | Indices | Help |
|
---|
|
1 #!/usr/bin/env python 2 #-*- coding:utf-8 -* 3 4 5 """ 6 Allow to get the execution path 7 8 G{importgraph} 9 """ 10 11 12 # Pyxmaker 13 # Copyright (C) 2013 GALODE A. 14 # 15 # This file is part of Expymaker. 16 # 17 # Pyxmaker is free software: you can redistribute it and/or modify 18 # it under the terms of the GNU General Public License as published by 19 # the Free Software Foundation, either version 3 of the License, or 20 # (at your option) any later version. 21 # 22 # Pyxmaker is distributed in the hope that it will be useful, 23 # but WITHOUT ANY WARRANTY; without even the implied warranty of 24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 # GNU General Public License for more details. 26 # 27 # You should have received a copy of the GNU General Public License 28 # along with Pyxmaker. If not, see <http://www.gnu.org/licenses/> 29 30 31 import os 32 import sys 33 34 35 36 37 #===================================================# 38 # Obtention du bon chemin d'execution # 39 #===================================================#41 """ 42 Allow to know the good path under Linux, MAC, and Windows. 43 Under Windows, adapt the path betwwen direct execution or 44 trough cx_freeze or PYXMAKER 45 46 PARAMETERS 47 ========== 48 None 49 50 RETURNS 51 ======= 52 The execution path, adapted to the situation 53 """ 54 #OS = Linux 55 if sys.platform == 'linux2': 56 path = os.path.dirname(os.path.abspath(__file__)) 57 58 #OS = Windows 59 elif sys.platform in ("win32", "cygwin"): 60 if getattr(sys, 'frozen', False): 61 path = os.path.dirname(sys.executable) 62 else: 63 path = os.path.dirname(os.path.abspath(__file__)) 64 65 #OS = MAC 66 else: 67 path = os.path.dirname(os.path.abspath(__file__)) 68 69 return path70 71 72 73 74 #=======================================================================# 75 # Main # 76 #=======================================================================# 77 if __name__ == "__main__": 78 print "PATH:", cxf_get_path() 79
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Thu Sep 19 14:46:00 2013 | http://epydoc.sourceforge.net |