root/trunk/cjc.py

Revision 656, 2.1 kB (checked in by jajcus, 2 years ago)

- (c) years updated

  • Property svn:executable set to *
Line 
1 #!/usr/bin/python
2
3 # Console Jabber Client
4 # Copyright (C) 2004-2006  Jacek Konieczny
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 version 2 as published
8 # by the Free Software Foundation
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License along
16 # with this program; if not, write to the Free Software Foundation, Inc.,
17 # 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
19
20 """Startup script for running CJC directly from the "source" tree."""
21
22 #try:
23 #   import psyco
24 #   psyco.profile()
25 #except ImportError:
26 #   pass
27
28 import sys
29 import os
30 import glob
31
32 base_dir=sys.path[0]
33
34 l=glob.glob(os.path.join(base_dir,"../pyxmpp*"))
35 for p in l:
36     if os.path.exists(os.path.join(p,"pyxmpp/__init__.py")):
37         print >>sys.stderr,"PyXMPP sources found in:", p
38         l=glob.glob(os.path.join(p,"build/lib*"))
39         if l:
40             sys.path+=l
41         else:
42             print >>sys.stderr,"Not compiled, skipping",
43
44 if os.path.exists(os.path.join(base_dir,".svn/entries")):
45     print >>sys.stderr,"Running from SVN, updating version"
46     try:
47         cwd=os.getcwd()
48         try:
49             os.chdir(base_dir)
50             if os.system("make version >&2"):
51                 raise OSError,"make failed"
52         finally:
53             os.chdir(cwd)
54     except (OSError,IOError):
55         print >>sys.stderr,"failed"
56         try:
57             p=os.path.join(base_dir,"cjc/version.py")
58             f=file(p,"w")
59             print >>f,"version='unknown SVN'"
60             f.close()
61         except (OSError,IOError):
62             pass
63
64 from cjc import main
65
66 if len(sys.argv)>1 and sys.argv[1]=="--profile":
67     sys.argv[1:]=sys.argv[2:]
68     import profile
69     profile.run("main.main(base_dir,profile=True)","cjc.prof")
70 else:
71     main.main(base_dir)
72
73 # vi: sts=4 et sw=4
74
Note: See TracBrowser for help on using the browser.