paul@3 | 1 | Introduction
|
paul@3 | 2 | ------------
|
paul@3 | 3 |
|
paul@3 | 4 | The astgrep program permits the searching of Python source files for textual
|
paul@3 | 5 | information of a specific type. Instead of matching a search term or
|
paul@3 | 6 | expression to all text in a program, as grep would do, astgrep matches only
|
paul@3 | 7 | tokens in the program having a particular type, such as names or constants.
|
paul@3 | 8 |
|
paul@3 | 9 | Quick Start
|
paul@3 | 10 | -----------
|
paul@3 | 11 |
|
paul@3 | 12 | Try the following examples, replacing astgrep with astgrep.py if the software
|
paul@3 | 13 | has not been installed from a package:
|
paul@3 | 14 |
|
paul@3 | 15 | Search for classes whose name contains Node in a particular file:
|
paul@3 | 16 |
|
paul@3 | 17 | astgrep -t Class -e Node libxml2dom/__init__.py
|
paul@3 | 18 |
|
paul@3 | 19 | Search for functions or methods whose name starts with visit in a particular
|
paul@3 | 20 | directory hierarchy, micropython, showing the name of the matching functions
|
paul@3 | 21 | in the output:
|
paul@3 | 22 |
|
paul@3 | 23 | astgrep -p -t Function -e '^visit' -r micropython
|
paul@3 | 24 |
|
paul@3 | 25 | Search for accesses of attributes having the exact name _node in a particular
|
paul@3 | 26 | directory hierarchy, libxml2dom, showing the line number of each match in the
|
paul@3 | 27 | output:
|
paul@3 | 28 |
|
paul@3 | 29 | astgrep -n -t Getattr -e '^_node$' -r libxml2dom
|
paul@3 | 30 |
|
paul@3 | 31 | Dependencies
|
paul@3 | 32 | ------------
|
paul@3 | 33 |
|
paul@3 | 34 | The astgrep program has the following basic dependencies:
|
paul@3 | 35 |
|
paul@3 | 36 | Package Release Information
|
paul@3 | 37 | ------- -------------------
|
paul@3 | 38 |
|
paul@3 | 39 | Python 2.5.1
|
paul@3 | 40 | cmdsyntax Tested with 0.91
|
paul@3 | 41 |
|
paul@3 | 42 | URLs
|
paul@3 | 43 | ----
|
paul@3 | 44 |
|
paul@3 | 45 | Python http://www.python.org/
|
paul@3 | 46 | CMDsyntax http://www.boddie.org.uk/david/Projects/Python/CMDSyntax/index.html
|
paul@3 | 47 |
|
paul@3 | 48 | Contact, Copyright and Licence Information
|
paul@3 | 49 | ------------------------------------------
|
paul@3 | 50 |
|
paul@3 | 51 | The current Web page for astgrep at the time of release is:
|
paul@3 | 52 |
|
paul@3 | 53 | http://www.boddie.org.uk/python/astgrep.html
|
paul@3 | 54 |
|
paul@3 | 55 | Copyright and licence information can be found in the docs directory - see
|
paul@3 | 56 | docs/COPYING.txt and docs/gpl-3.0.txt for more information.
|
paul@3 | 57 |
|
paul@17 | 58 | New in astgrep 0.1.1 (Changes since astgrep 0.1)
|
paul@17 | 59 | ------------------------------------------------
|
paul@17 | 60 |
|
paul@17 | 61 | * Supported searching of mixtures of files and directories.
|
paul@17 | 62 | * Prevented searching of docstrings, since the information about them is
|
paul@17 | 63 | deficient in the abstract syntax trees.
|
paul@17 | 64 | * Removed the term type requirement, permitting searching in all types.
|
paul@17 | 65 | * Removed the pattern requirement, permitting searching for all tokens of a
|
paul@17 | 66 | particular type (or, indeed, all tokens).
|
paul@17 | 67 |
|
paul@3 | 68 | Release Procedures
|
paul@3 | 69 | ------------------
|
paul@3 | 70 |
|
paul@3 | 71 | Update the astgrep.py __version__ attributes.
|
paul@3 | 72 | Change the version number and package filename/directory in the documentation.
|
paul@3 | 73 | Update the release notes (see above).
|
paul@11 | 74 | Check the setup.py file.
|
paul@3 | 75 | Check the release information in the PKG-INFO file and in the package
|
paul@3 | 76 | changelog (and other files).
|
paul@3 | 77 | Tag, export.
|
paul@3 | 78 | Remove generated .pyc files: rm `find . -name "*.pyc"`
|
paul@3 | 79 | Archive, upload.
|
paul@3 | 80 |
|
paul@3 | 81 | Making Packages
|
paul@3 | 82 | ---------------
|
paul@3 | 83 |
|
paul@3 | 84 | To make Debian-based packages:
|
paul@3 | 85 |
|
paul@3 | 86 | 1. Create new package directories under packages if necessary.
|
paul@3 | 87 | 2. Make a symbolic link in the distribution's root directory to keep the
|
paul@3 | 88 | Debian tools happy. Try one of the following:
|
paul@3 | 89 |
|
paul@11 | 90 | ln -s packages/ubuntu-gutsy/python-astgrep/debian/
|
paul@3 | 91 |
|
paul@3 | 92 | 3. Run the package builder:
|
paul@3 | 93 |
|
paul@3 | 94 | dpkg-buildpackage -rfakeroot
|
paul@3 | 95 |
|
paul@3 | 96 | 4. Locate and tidy up the packages in the parent directory of the
|
paul@3 | 97 | distribution's root directory.
|