root/tags/jjigw-0.2/jjigw.py

Revision 92, 1.6 kB (checked in by jajcus, 5 years ago)

- profile option handling fixed again

Line 
1 #!/usr/bin/python -u
2 #
3 #  Jajcus' Jabber to IRC Gateway
4 #  Copyright (C) 2004  Jacek Konieczny <jajcus@bnet.pl>
5 #
6 #  This program is free software; you can redistribute it and/or modify
7 #  it under the terms of the GNU General Public License as published by
8 #  the Free Software Foundation; either version 2 of the License, or
9 #  (at your option) any later version.
10 #
11 #  This program is distributed in the hope that it will be useful,
12 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 #  GNU General Public License for more details.
15 #
16 #  You should have received a copy of the GNU General Public License along
17 #  with this program; if not, write to the Free Software Foundation, Inc.,
18 #  59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19
20
21 from jjigw.common import JJIGWFatalError
22 from jjigw.config import Config
23 from jjigw.component import Component
24 import sys
25 import os.path
26
27 def main(profile=False):
28     config_dir,data_dir=".","."
29
30     try:
31         try:
32             config=Config(config_dir,data_dir)
33         except:
34             print >>sys.stderr,"Couldn't load config file:",str(sys.exc_value)
35             sys.exit(1)
36
37         print "creating component..."
38         c=Component(config,profile=profile)
39
40         print "starting..."
41         c.run(1)
42     except JJIGWFatalError,e:
43         print e
44         print "Aborting."
45         sys.exit(1)
46
47 if '--profile' in sys.argv:
48     import profile
49     sys.argv.remove('--profile')
50     profile.run("main(profile=True)","jjigw.prof")
51 else:
52     main()
53
54 # vi: sts=4 et sw=4
55
Note: See TracBrowser for help on using the browser.