2 # -*- coding: utf-8 -*-
4 #Copyright 2009-2011 Carl Gherardi
5 #This program is free software: you can redistribute it and/or modify
6 #it under the terms of the GNU Affero General Public License as published by
7 #the Free Software Foundation, version 3 of the License.
9 #This program is distributed in the hope that it will be useful,
10 #but WITHOUT ANY WARRANTY; without even the implied warranty of
11 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 #GNU General Public License for more details.
14 #You should have received a copy of the GNU Affero General Public License
15 #along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #In the "official" distribution you can find the license in agpl-3.0.txt.
18 # create .bat scripts in windows to try out different gtk dirs
21 _
= L10n
.get_translation()
30 print _("This script is only for Windows.")
33 dirs
= re
.split(os
.pathsep
, os
.environ
['PATH'])
34 # remove any trailing / or \ chars from dirs:
35 dirs
= [re
.sub('[\\/]$','',p
) for p
in dirs
]
36 # remove any dirs containing 'python' apart from those ending in 'python25', 'python26' or 'python':
37 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
)]
39 gtkdirs
= [p
for p
in dirs
if re
.search('gtk', p
, re
.I
)]
41 lines
= [ '@echo off\n\n'
43 , 'python fpdb.py\n\n'
48 for gpath
in gtkdirs
: # enumerate converts the \\ into \
49 tmpdirs
= [p
for p
in dirs
if not re
.search('gtk', p
, re
.I
) or p
== gpath
]
50 tmppath
= ";".join(tmpdirs
)
51 lines
[1] = 'PATH=' + tmppath
+ '\n\n'
52 bat
= open('run_fpdb'+str(i
)+'.bat', 'w')
57 print _("No gtk directories found in your path.") + " " + _("Install gtk or edit the path manually.")
63 print "Error:", str(sys
.exc_info())
66 # sys.stdin.readline()