pycscope
pycscope copied to clipboard
Cscope database generator for Python source code
PyCscope
- Copyright: Copyright 2019 Peter Portante. See LICENSE for details.
- Author: Peter Portante
- Release: 1.2.2
- Date: 2019/10/17
Purpose
A python script to generate a cscope index from a Python source tree.
pycscope
uses Python's own parser and (C)oncrete (S)yntax (T)ree to generate
the index, so it is a bit more accurate than plain cscope.
Usage
pycscope.py [-D] [-R] [-S] [-V] [-f reffile] [-e path1[,path2,...]] [-i srclistfile] [files ...]
-D Dump the (C)oncrete (S)yntax (T)ree generated by the parser for each file
-R Recurse directories for files
-S Interpret simple strings as symbols
-V Print version and exit
-f reffile Use 'reffile' as cross-ref file name instead of 'cscope.out'
-i srclistfile Use the contents of 'srclistfile' as the list of source files to scan
-e path1,path2.. Exclude the list of paths from being parse
Example
Rough example using vim
as your cscope client:
pycscope -R .
# now you have a cscope.out. use it like you would cscope
vim hello.py
:cscope add cscope.out
:cscope find s sys
Install
PyCscope uses Python's distutils package for installation. Use the following command to install this package:
% python setup.py install
Features
PyCscope has the following features:
- Supports both Python 2.7 and Python 3
- Command line interface
- Output can be used by the
CscopeFinder
plugin for jEdit - Marks for all files ending in
.py
- Marks for all
class
definitions - Marks for all defined functions
- Marks for function calls (algorithm is not perfect)
- Marks for end-of-function (no search uses this mark yet)
- Marks for imported modules (use the search for #include)
- Marks for symbol assignment
A mark is an indicator to the cscope utility that something of interest follows.
History
- pycscope 0.3a and later are written and copyright Peter Portante.
- pycscope 0.1 - 0.3 were originally written and copyright Dean Hall.
Status
It works well enough to generate an index file that can be used by the
CscopeFinder
plugin for jEdit, emacs cscope support, or vim's cscope
handling. Other editors are not tested.