| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
"""Startup script for running CJC directly from the "source" tree.""" |
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 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 |
|
|---|
| 74 |
|
|---|