- Timestamp:
- Oct 27, 2005, 12:48:25 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
CMT/HEAD/doc/gendoc.py
r83 r105 1 #!/usr/bin/env python 2 1 3 #----------------------------------------------------------- 2 4 # Copyright Christian Arnault LAL-Orsay CNRS 3 # arnault@lal.in2p3.fr 5 # author: arnault@lal.in2p3.fr 6 # modified by: garonne@lal.in2p3.fr 4 7 # See the complete license in cmt_license.txt "http://www.cecill.info". 5 8 #----------------------------------------------------------- … … 7 10 import sys, os, string, getopt, types 8 11 import xml.parsers.expat 9 from datetime import date 12 import commands, glob 13 from datetime import date 14 15 16 #------------------------------------------------------------ 17 def checkPythonVersion (major=1,minor=5): 18 version = float(str(major) +'.'+ str(minor)) 19 thisversion = float(str(sys.version_info[0]) + '.' + str(sys.version_info[1])) 20 if version > thisversion: 21 # try to find the good python version >= 2.3 22 paths = string.split(os.environ['PATH'],':') 23 print 'hmmm look for the appropriate python version, this one is',\ 24 thisversion,'and the required version is python >=', version 25 pythons = list() 26 for path in paths: 27 pythons = glob.glob1(path, 'python*') 28 for python in pythons: 29 cmd = python +' -c "import sys; print sys.version_info"' 30 status, thisversion = commands.getstatusoutput(cmd) 31 thisversion = eval (thisversion) 32 thisversion = float(str(thisversion[0]) +'.'+ str(thisversion[1])) 33 if (thisversion >= version): 34 print 'found and load', python 35 sys.argv.insert (0, python) 36 os.execvp (python, sys.argv) 37 print 'The appropriate version of python >=' + version + ' is not here, check your PATH variable or install it' 38 sys.exit(-1) 39 10 40 11 41 #------------------------------------------------------------ … … 620 650 #print '__name__ = ' + __name__ 621 651 if __name__ == "__main__": 652 checkPythonVersion (major=2, minor=3) 622 653 main() 623 654 # end def
Note: See TracChangeset
for help on using the changeset viewer.