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.
65 Check the release information in the PKG-INFO file and in the package
66 changelog (and other files).
67 Tag, export.
68 Remove generated .pyc files: rm `find . -name "*.pyc"`
69 Archive, upload.
70
71 Making Packages
72 ---------------
73
74 To make Debian-based packages:
75
76 1. Create new package directories under packages if necessary.
77 2. Make a symbolic link in the distribution's root directory to keep the
78 Debian tools happy. Try one of the following:
79
80 ln -s packages/ubuntu-gutsy/python-astgrep/debian/
81
82 3. Run the package builder:
83
84 dpkg-buildpackage -rfakeroot
85
86 4. Locate and tidy up the packages in the parent directory of the
87 distribution's root directory.