~ubuntu-branches/debian/experimental/spyder/experimental

« back to all changes in this revision

Viewing changes to scripts/spyder

  • Committer: Package Import Robot
  • Author(s): Picca Frédéric-Emmanuel
  • Date: 2013-01-20 12:19:54 UTC
  • mfrom: (1.1.16)
  • Revision ID: package-import@ubuntu.com-20130120121954-1jt1xa924bshhvh0
Tags: 2.2.0~beta1+dfsg-2
fix typo ipython-qtconsol -> ipython-qtconsole

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/env python
2
 
from spyderlib import spyder
3
 
spyder.main()
 
2
import atexit
 
3
import random
 
4
import time
 
5
 
 
6
from spyderlib.baseconfig import get_conf_path
 
7
from spyderlib.config import CONF
 
8
from spyderlib.utils.external import lockfile
 
9
 
 
10
if CONF.get('main', 'single_instance'):
 
11
    # Minimal delay (0.1-0.2 secs) to avoid that several
 
12
    # instances started at the same time step in their
 
13
    # own foots while trying to create the lock file
 
14
    time.sleep(random.randrange(1000, 2000, 90)/10000.)
 
15
    
 
16
    # Lock file creation
 
17
    lockf = get_conf_path('spyder.lock')
 
18
    lock = lockfile.FilesystemLock(lockf)
 
19
    
 
20
    # lock.lock() tries to lock spyder.lock. If it fails,
 
21
    # it returns False and so we try to start the client
 
22
    if not lock.lock():
 
23
        from spyderlib import client
 
24
        client.main()
 
25
    else:
 
26
        atexit.register(lock.unlock)
 
27
        from spyderlib import spyder
 
28
        spyder.main()
 
29
else:
 
30
    from spyderlib import spyder
 
31
    spyder.main()