Debian packaging for 0.99.3 on Fremantle
[panucci.git] / bin / panucci
blob8b29073e4555b2abb0e4a381ad08702502de06de
1 #!/usr/bin/env python
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
22 import os.path
23 import sys
24 from optparse import OptionParser
26 # Set up gettext support
27 import locale
28 import gettext
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 ):
35 break
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 parser.add_option("--qml", action="store_true")
50 opts, args = parser.parse_args()
52 if len(args) > 1 or ( opts.queue_filename and len(args) ):
53 parser.print_help()
54 sys.exit(1)
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)
59 if os.path.isdir('/opt/panucci/lib/'):
60 sys.path.append('/opt/panucci/lib/')
61 else:
62 sys.path.append('/usr/share/panucci/lib/')
64 from panucci import main
65 main.run(opts, args)