~ubuntu-branches/debian/experimental/ipython/experimental

« back to all changes in this revision

Viewing changes to IPython/quarantine/ipy_gnuglobal.py

  • Committer: Bazaar Package Importer
  • Author(s): Julian Taylor
  • Date: 2011-05-10 16:18:45 UTC
  • mfrom: (1.2.14 upstream)
  • Revision ID: james.westby@ubuntu.com-20110510161845-0nrh795uiyp1a20r
Tags: 0.11~rc1-1
* New upstream release candidate
* change to source format 3.0 (quilt)
* run testsuite during build
* add clean target
* build-depends:
  - matplotlib, pymongo, xauth, xvfb and qt4 for tests
  - graphviz, sphinx for docs
* add dependencies and don't install embedded copy:
  - python-argparse(Closes: #555348)
  - python-configobj (Closes: #555339)
  - python-simplegeneric
  - python-decorator
  - python-pyparsing
  - pexpect
* update patches
  - disabled obsolete patches 03, 04 and 06
  - refresh default background color patch 07
  - add patch to fix testsuite
  - add patch to improve error message on missing ipython-qtconsole
* change to compat 7
* split out -parallel package
* split out -qtconsole package
* split out -doc package
* improve dependencies for each package
* add doc-base control file
* fix the ipythonX.Y startup scripts

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
 
 
4
"""
 
5
Add %global magic for GNU Global usage.
 
6
 
 
7
http://www.gnu.org/software/global/
 
8
 
 
9
"""
 
10
 
 
11
from IPython.core import ipapi
 
12
ip = ipapi.get()
 
13
import os
 
14
 
 
15
# alter to your liking
 
16
global_bin = 'd:/opt/global/bin/global'
 
17
 
 
18
def global_f(self,cmdline):
 
19
    simple = 0
 
20
    if '-' not in cmdline:
 
21
        cmdline  = '-rx ' + cmdline
 
22
        simple = 1
 
23
        
 
24
    lines = [l.rstrip() for l in os.popen( global_bin + ' ' + cmdline ).readlines()]
 
25
    
 
26
    if simple:
 
27
        parts = [l.split(None,3) for l in lines]
 
28
        lines = ['%s [%s]\n%s' % (p[2].rjust(70),p[1],p[3].rstrip()) for p in parts]
 
29
    print "\n".join(lines)
 
30
 
 
31
ip.define_magic('global', global_f)
 
32
 
 
33
def global_completer(self,event):
 
34
    compl = [l.rstrip() for l in os.popen(global_bin + ' -c ' + event.symbol).readlines()]
 
35
    return compl    
 
36
 
 
37
ip.set_hook('complete_command', global_completer, str_key = '%global')
 
38