merge from carl
This commit is contained in:
parent
ff2cca361c
commit
1bd8419510
|
@ -1,47 +1,47 @@
|
||||||
|
|
||||||
# create .bat scripts in windows to try out different gtk dirs
|
# create .bat scripts in windows to try out different gtk dirs
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
|
|
||||||
if os.name != 'nt':
|
if os.name != 'nt':
|
||||||
print "\nThis script is only for windows\n"
|
print "\nThis script is only for windows\n"
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
dirs = re.split(os.pathsep, os.environ['PATH'])
|
dirs = re.split(os.pathsep, os.environ['PATH'])
|
||||||
# remove any trailing / or \ chars from dirs:
|
# remove any trailing / or \ chars from dirs:
|
||||||
dirs = [re.sub('[\\/]$','',p) for p in dirs]
|
dirs = [re.sub('[\\/]$','',p) for p in dirs]
|
||||||
# remove any dirs containing 'python' apart from those ending in 'python25', 'python26' or 'python':
|
# remove any dirs containing 'python' apart from those ending in 'python25', 'python26' or 'python':
|
||||||
dirs = [p for p in dirs if not re.search('python', p, re.I) or re.search('python25$', p, re.I) or re.search('python26$', p, re.I)]
|
dirs = [p for p in dirs if not re.search('python', p, re.I) or re.search('python25$', p, re.I) or re.search('python26$', p, re.I)]
|
||||||
# find gtk dirs:
|
# find gtk dirs:
|
||||||
gtkdirs = [p for p in dirs if re.search('gtk', p, re.I)]
|
gtkdirs = [p for p in dirs if re.search('gtk', p, re.I)]
|
||||||
|
|
||||||
lines = [ '@echo off\n\n'
|
lines = [ '@echo off\n\n'
|
||||||
, '<path goes here>'
|
, '<path goes here>'
|
||||||
, 'python fpdb.py\n\n'
|
, 'python fpdb.py\n\n'
|
||||||
, 'pause\n\n'
|
, 'pause\n\n'
|
||||||
]
|
]
|
||||||
if gtkdirs:
|
if gtkdirs:
|
||||||
i = 1
|
i = 1
|
||||||
for gpath in gtkdirs: # enumerate converts the \\ into \
|
for gpath in gtkdirs: # enumerate converts the \\ into \
|
||||||
tmpdirs = [p for p in dirs if not re.search('gtk', p, re.I) or p == gpath]
|
tmpdirs = [p for p in dirs if not re.search('gtk', p, re.I) or p == gpath]
|
||||||
tmppath = ";".join(tmpdirs)
|
tmppath = ";".join(tmpdirs)
|
||||||
lines[1] = 'PATH=' + tmppath + '\n\n'
|
lines[1] = 'PATH=' + tmppath + '\n\n'
|
||||||
bat = open('run_fpdb'+str(i)+'.bat', 'w')
|
bat = open('run_fpdb'+str(i)+'.bat', 'w')
|
||||||
bat.writelines(lines)
|
bat.writelines(lines)
|
||||||
bat.close()
|
bat.close()
|
||||||
i = i + 1
|
i = i + 1
|
||||||
else:
|
else:
|
||||||
print "\nno gtk directories found in your path - install gtk or edit the path manually\n"
|
print "\nno gtk directories found in your path - install gtk or edit the path manually\n"
|
||||||
|
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
except:
|
except:
|
||||||
print "Error:", str(sys.exc_info())
|
print "Error:", str(sys.exc_info())
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# sys.stdin.readline()
|
# sys.stdin.readline()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user