Skip to content

portante/pycscope

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
doc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.

About

Cscope database generator for Python source code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published