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