2 # -*- coding: utf-8 -*-
4 # This file is part of Panucci.
5 # Copyright (c) 2008-2011 The Panucci Project
7 # Panucci is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # Panucci is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Panucci. If not, see <http://www.gnu.org/licenses/>.
20 from __future__
import absolute_import
24 from optparse
import OptionParser
26 # Set up gettext support
30 prefix
= os
.path
.join( os
.path
.dirname(sys
.argv
[0]), '..' )
32 for basedir
in 'share', 'data':
33 locale_dir
= os
.path
.abspath(os
.path
.join( prefix
, basedir
, 'locale' ))
34 if os
.path
.exists( locale_dir
):
37 locale_dir
= os
.environ
.get('LOCALE_DIR', locale_dir
)
38 gettext
.install( 'panucci', locale_dir
)
40 # Set up the command line option parser
41 usage
= 'usage: %prog [options] FILE'
42 parser
= OptionParser(usage
=usage
)
43 parser
.add_option('-q', '--queue', action
='store', type='string',
44 dest
='queue_filename', help='Add FILE to the queue', metavar
='FILE')
45 parser
.add_option('-d', '--debug', action
='store_true', default
=False,
46 dest
='debug', help='Enable verbose logging')
47 parser
.add_option("--gtk", action
="store_true")
48 parser
.add_option("--qt", action
="store_true")
49 opts
, args
= parser
.parse_args()
51 if len(args
) > 1 or ( opts
.queue_filename
and len(args
) ):
55 # add src/ to the PYTHONPATH
56 local_module_dir
= os
.path
.join(os
.path
.dirname(sys
.argv
[0]), '..', 'src')
57 if os
.path
.isdir(local_module_dir
):
58 sys
.path
.insert(0, local_module_dir
)
60 optified_install_path
= '/opt/panucci/lib/'
61 if os
.path
.isdir(optified_install_path
):
62 sys
.path
.append(optified_install_path
)
64 from panucci
import main