Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
2 | <html> | |
3 | <head> | |
4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> | |
5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> | |
6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> | |
7 | <link rel="first" href="lib.html" title='Python Library Reference' /> | |
8 | <link rel='contents' href='contents.html' title="Contents" /> | |
9 | <link rel='index' href='genindex.html' title='Index' /> | |
10 | <link rel='last' href='about.html' title='About this document...' /> | |
11 | <link rel='help' href='about.html' title='About this document...' /> | |
12 | <link rel="prev" href="module-filecmp.html" /> | |
13 | <link rel="parent" href="module-filecmp.html" /> | |
14 | <link rel="next" href="module-subprocess.html" /> | |
15 | <meta name='aesop' content='information' /> | |
16 | <title>6.7.1 The dircmp class </title> | |
17 | </head> | |
18 | <body> | |
19 | <DIV CLASS="navigation"> | |
20 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> | |
21 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
22 | <tr> | |
23 | <td class='online-navigation'><a rel="prev" title="6.7 filecmp " | |
24 | href="module-filecmp.html"><img src='../icons/previous.png' | |
25 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
26 | <td class='online-navigation'><a rel="parent" title="6.7 filecmp " | |
27 | href="module-filecmp.html"><img src='../icons/up.png' | |
28 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
29 | <td class='online-navigation'><a rel="next" title="6.8 subprocess " | |
30 | href="module-subprocess.html"><img src='../icons/next.png' | |
31 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
32 | <td align="center" width="100%">Python Library Reference</td> | |
33 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
34 | href="contents.html"><img src='../icons/contents.png' | |
35 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
36 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
37 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
38 | <td class='online-navigation'><a rel="index" title="Index" | |
39 | href="genindex.html"><img src='../icons/index.png' | |
40 | border='0' height='32' alt='Index' width='32' /></A></td> | |
41 | </tr></table> | |
42 | <div class='online-navigation'> | |
43 | <b class="navlabel">Previous:</b> | |
44 | <a class="sectref" rel="prev" href="module-filecmp.html">6.7 filecmp </A> | |
45 | <b class="navlabel">Up:</b> | |
46 | <a class="sectref" rel="parent" href="module-filecmp.html">6.7 filecmp </A> | |
47 | <b class="navlabel">Next:</b> | |
48 | <a class="sectref" rel="next" href="module-subprocess.html">6.8 subprocess </A> | |
49 | </div> | |
50 | <hr /></div> | |
51 | </DIV> | |
52 | <!--End of Navigation Panel--> | |
53 | ||
54 | <H2><A NAME="SECTION008710000000000000000"></A><A NAME="dircmp-objects"></A> | |
55 | <BR> | |
56 | 6.7.1 The <tt class="class">dircmp</tt> class | |
57 | </H2> | |
58 | ||
59 | <P> | |
60 | <tt class="class">dircmp</tt> instances are built using this constructor: | |
61 | ||
62 | <P> | |
63 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
64 | <td><nobr><b><span class="typelabel">class</span> <tt id='l2h-1816' xml:id='l2h-1816' class="class">dircmp</tt></b>(</nobr></td> | |
65 | <td><var>a, b</var><big>[</big><var>, ignore</var><big>[</big><var>, hide</var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt> | |
66 | <dd> | |
67 | Construct a new directory comparison object, to compare the | |
68 | directories <var>a</var> and <var>b</var>. <var>ignore</var> is a list of names to | |
69 | ignore, and defaults to <code>['RCS', 'CVS', 'tags']</code>. <var>hide</var> is a | |
70 | list of names to hide, and defaults to <code>[os.curdir, os.pardir]</code>. | |
71 | </dl> | |
72 | ||
73 | <P> | |
74 | The <tt class="class">dircmp</tt> class provides the following methods: | |
75 | ||
76 | <P> | |
77 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
78 | <td><nobr><b><tt id='l2h-1817' xml:id='l2h-1817' class="method">report</tt></b>(</nobr></td> | |
79 | <td><var></var>)</td></tr></table></dt> | |
80 | <dd> | |
81 | Print (to <code>sys.stdout</code>) a comparison between <var>a</var> and <var>b</var>. | |
82 | </dl> | |
83 | ||
84 | <P> | |
85 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
86 | <td><nobr><b><tt id='l2h-1818' xml:id='l2h-1818' class="method">report_partial_closure</tt></b>(</nobr></td> | |
87 | <td><var></var>)</td></tr></table></dt> | |
88 | <dd> | |
89 | Print a comparison between <var>a</var> and <var>b</var> and common immediate | |
90 | subdirectories. | |
91 | </dl> | |
92 | ||
93 | <P> | |
94 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
95 | <td><nobr><b><tt id='l2h-1819' xml:id='l2h-1819' class="method">report_full_closure</tt></b>(</nobr></td> | |
96 | <td><var></var>)</td></tr></table></dt> | |
97 | <dd> | |
98 | Print a comparison between <var>a</var> and <var>b</var> and common | |
99 | subdirectories (recursively). | |
100 | </dl> | |
101 | ||
102 | <P> | |
103 | The <tt class="class">dircmp</tt> offers a number of interesting attributes that may | |
104 | be used to get various bits of information about the directory trees | |
105 | being compared. | |
106 | ||
107 | <P> | |
108 | Note that via <tt class="method">__getattr__()</tt> hooks, all attributes are | |
109 | computed lazily, so there is no speed penalty if only those | |
110 | attributes which are lightweight to compute are used. | |
111 | ||
112 | <P> | |
113 | <dl><dt><b><tt id='l2h-1820' xml:id='l2h-1820' class="member">left_list</tt></b></dt> | |
114 | <dd> | |
115 | Files and subdirectories in <var>a</var>, filtered by <var>hide</var> and | |
116 | <var>ignore</var>. | |
117 | </dl> | |
118 | ||
119 | <P> | |
120 | <dl><dt><b><tt id='l2h-1821' xml:id='l2h-1821' class="member">right_list</tt></b></dt> | |
121 | <dd> | |
122 | Files and subdirectories in <var>b</var>, filtered by <var>hide</var> and | |
123 | <var>ignore</var>. | |
124 | </dl> | |
125 | ||
126 | <P> | |
127 | <dl><dt><b><tt id='l2h-1822' xml:id='l2h-1822' class="member">common</tt></b></dt> | |
128 | <dd> | |
129 | Files and subdirectories in both <var>a</var> and <var>b</var>. | |
130 | </dl> | |
131 | ||
132 | <P> | |
133 | <dl><dt><b><tt id='l2h-1823' xml:id='l2h-1823' class="member">left_only</tt></b></dt> | |
134 | <dd> | |
135 | Files and subdirectories only in <var>a</var>. | |
136 | </dl> | |
137 | ||
138 | <P> | |
139 | <dl><dt><b><tt id='l2h-1824' xml:id='l2h-1824' class="member">right_only</tt></b></dt> | |
140 | <dd> | |
141 | Files and subdirectories only in <var>b</var>. | |
142 | </dl> | |
143 | ||
144 | <P> | |
145 | <dl><dt><b><tt id='l2h-1825' xml:id='l2h-1825' class="member">common_dirs</tt></b></dt> | |
146 | <dd> | |
147 | Subdirectories in both <var>a</var> and <var>b</var>. | |
148 | </dl> | |
149 | ||
150 | <P> | |
151 | <dl><dt><b><tt id='l2h-1826' xml:id='l2h-1826' class="member">common_files</tt></b></dt> | |
152 | <dd> | |
153 | Files in both <var>a</var> and <var>b</var> | |
154 | </dl> | |
155 | ||
156 | <P> | |
157 | <dl><dt><b><tt id='l2h-1827' xml:id='l2h-1827' class="member">common_funny</tt></b></dt> | |
158 | <dd> | |
159 | Names in both <var>a</var> and <var>b</var>, such that the type differs between | |
160 | the directories, or names for which <tt class="function">os.stat()</tt> reports an | |
161 | error. | |
162 | </dl> | |
163 | ||
164 | <P> | |
165 | <dl><dt><b><tt id='l2h-1828' xml:id='l2h-1828' class="member">same_files</tt></b></dt> | |
166 | <dd> | |
167 | Files which are identical in both <var>a</var> and <var>b</var>. | |
168 | </dl> | |
169 | ||
170 | <P> | |
171 | <dl><dt><b><tt id='l2h-1829' xml:id='l2h-1829' class="member">diff_files</tt></b></dt> | |
172 | <dd> | |
173 | Files which are in both <var>a</var> and <var>b</var>, whose contents differ. | |
174 | </dl> | |
175 | ||
176 | <P> | |
177 | <dl><dt><b><tt id='l2h-1830' xml:id='l2h-1830' class="member">funny_files</tt></b></dt> | |
178 | <dd> | |
179 | Files which are in both <var>a</var> and <var>b</var>, but could not be | |
180 | compared. | |
181 | </dl> | |
182 | ||
183 | <P> | |
184 | <dl><dt><b><tt id='l2h-1831' xml:id='l2h-1831' class="member">subdirs</tt></b></dt> | |
185 | <dd> | |
186 | A dictionary mapping names in <tt class="member">common_dirs</tt> to | |
187 | <tt class="class">dircmp</tt> objects. | |
188 | </dl> | |
189 | ||
190 | <DIV CLASS="navigation"> | |
191 | <div class='online-navigation'> | |
192 | <p></p><hr /> | |
193 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
194 | <tr> | |
195 | <td class='online-navigation'><a rel="prev" title="6.7 filecmp " | |
196 | href="module-filecmp.html"><img src='../icons/previous.png' | |
197 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
198 | <td class='online-navigation'><a rel="parent" title="6.7 filecmp " | |
199 | href="module-filecmp.html"><img src='../icons/up.png' | |
200 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
201 | <td class='online-navigation'><a rel="next" title="6.8 subprocess " | |
202 | href="module-subprocess.html"><img src='../icons/next.png' | |
203 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
204 | <td align="center" width="100%">Python Library Reference</td> | |
205 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
206 | href="contents.html"><img src='../icons/contents.png' | |
207 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
208 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
209 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
210 | <td class='online-navigation'><a rel="index" title="Index" | |
211 | href="genindex.html"><img src='../icons/index.png' | |
212 | border='0' height='32' alt='Index' width='32' /></A></td> | |
213 | </tr></table> | |
214 | <div class='online-navigation'> | |
215 | <b class="navlabel">Previous:</b> | |
216 | <a class="sectref" rel="prev" href="module-filecmp.html">6.7 filecmp </A> | |
217 | <b class="navlabel">Up:</b> | |
218 | <a class="sectref" rel="parent" href="module-filecmp.html">6.7 filecmp </A> | |
219 | <b class="navlabel">Next:</b> | |
220 | <a class="sectref" rel="next" href="module-subprocess.html">6.8 subprocess </A> | |
221 | </div> | |
222 | </div> | |
223 | <hr /> | |
224 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
225 | </DIV> | |
226 | <!--End of Navigation Panel--> | |
227 | <ADDRESS> | |
228 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
229 | </ADDRESS> | |
230 | </BODY> | |
231 | </HTML> |