Added sf-scrub-build, for completely freeing up the resources used by a build (ie deleting it from the HD).
Removed import of generated ant script as it had no effect, and was causing strange failures with sf-scrub-build.
<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>fileutils</title>
<link rel="stylesheet" href="epydoc.css" type="text/css" />
<script type="text/javascript" src="epydoc.js"></script>
</head>
<body bgcolor="white" text="black" link="blue" vlink="#204080"
alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Tree link -->
<th> <a
href="module-tree.html">Trees</a> </th>
<!-- Index link -->
<th> <a
href="identifier-index.html">Indices</a> </th>
<!-- Help link -->
<th> <a
href="help.html">Help</a> </th>
<th class="navbar" width="100%"></th>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="100%">
<span class="breadcrumbs">
Module fileutils
</span>
</td>
<td>
<table cellpadding="0" cellspacing="0">
<!-- hide/show private -->
<tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
onclick="toggle_private();">hide private</a>]</span></td></tr>
<tr><td align="right"><span class="options"
>[<a href="frames.html" target="_top">frames</a
>] | <a href="fileutils-module.html"
target="_top">no frames</a>]</span></td></tr>
</table>
</td>
</tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module fileutils</h1><span class="codelink"><a href="fileutils-pysrc.html">source code</a></span><br /><br />
<dl class="rst-docutils">
<dt>File manipulation related functionalities:</dt>
<dd><ul class="rst-first rst-last rst-simple">
<li>Filescanner</li>
<li>rmtree (fixed version)</li>
<li>move (fixed version)</li>
</ul>
</dd>
</dl><br /><br />
<!-- ==================== CLASSES ==================== -->
<a name="section-Classes"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Classes</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-Classes"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="fileutils.AbstractScanner-class.html" class="summary-name">AbstractScanner</a><br />
This class implements all the required infrastructure for filescanning.
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="fileutils.FileScanner-class.html" class="summary-name">FileScanner</a><br />
Scans the filesystem for files that match the selection paths.
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="fileutils.LockFailedException-class.html" class="summary-name">LockFailedException</a>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="fileutils.Lock-class.html" class="summary-name">Lock</a>
</td>
</tr>
</table>
<!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Functions</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-Functions"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="fileutils-module.html#move" class="summary-sig-name">move</a>(<span class="summary-sig-arg">src</span>,
<span class="summary-sig-arg">dst</span>)</span><br />
Recursively move a file or directory to another location.</td>
<td align="right" valign="top">
<span class="codelink"><a href="fileutils-pysrc.html#move">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="fileutils-module.html#rmtree" class="summary-sig-name">rmtree</a>(<span class="summary-sig-arg">rootdir</span>)</span><br />
Catch shutil.rmtree failures on Windows when files are read-only.</td>
<td align="right" valign="top">
<span class="codelink"><a href="fileutils-pysrc.html#rmtree">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="destinsrc"></a><span class="summary-sig-name">destinsrc</span>(<span class="summary-sig-arg">src</span>,
<span class="summary-sig-arg">dst</span>)</span><br />
Fixed version of destinscr, that doesn't match dst with same root name.</td>
<td align="right" valign="top">
<span class="codelink"><a href="fileutils-pysrc.html#destinsrc">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="which"></a><span class="summary-sig-name">which</span>(<span class="summary-sig-arg">executable</span>)</span><br />
Search for executable in the PATH.</td>
<td align="right" valign="top">
<span class="codelink"><a href="fileutils-pysrc.html#which">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="fileutils-module.html#read_policy_content" class="summary-sig-name">read_policy_content</a>(<span class="summary-sig-arg">filename</span>)</span><br />
Read the policy number from the policy file.</td>
<td align="right" valign="top">
<span class="codelink"><a href="fileutils-pysrc.html#read_policy_content">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="load_policy_content"></a><span class="summary-sig-name">load_policy_content</span>(<span class="summary-sig-arg">filename</span>)</span><br />
Testing policy content loading.</td>
<td align="right" valign="top">
<span class="codelink"><a href="fileutils-pysrc.html#load_policy_content">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="fileutils-module.html#guess_encoding" class="summary-sig-name">guess_encoding</a>(<span class="summary-sig-arg">data</span>)</span><br />
Given a byte string, guess the encoding.</td>
<td align="right" valign="top">
<span class="codelink"><a href="fileutils-pysrc.html#guess_encoding">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="getmd5"></a><span class="summary-sig-name">getmd5</span>(<span class="summary-sig-arg">fullpath</span>,
<span class="summary-sig-arg">chunk_size</span>=<span class="summary-sig-default">2**16</span>)</span><br />
returns the md5 value</td>
<td align="right" valign="top">
<span class="codelink"><a href="fileutils-pysrc.html#getmd5">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="read_symbian_policy_content"></a><span class="summary-sig-name">read_symbian_policy_content</span>(<span class="summary-sig-arg">filename</span>)</span><br />
Read the policy category from the policy file.</td>
<td align="right" valign="top">
<span class="codelink"><a href="fileutils-pysrc.html#read_symbian_policy_content">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="get_next_free_drive"></a><span class="summary-sig-name">get_next_free_drive</span>()</span><br />
Return the first free drive found else it raise an exception.</td>
<td align="right" valign="top">
<span class="codelink"><a href="fileutils-pysrc.html#get_next_free_drive">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="subst"></a><span class="summary-sig-name">subst</span>(<span class="summary-sig-arg">drive</span>,
<span class="summary-sig-arg">path</span>)</span><br />
Substing path as a drive.</td>
<td align="right" valign="top">
<span class="codelink"><a href="fileutils-pysrc.html#subst">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="unsubst"></a><span class="summary-sig-name">unsubst</span>(<span class="summary-sig-arg">drive</span>)</span><br />
Unsubsting the drive.</td>
<td align="right" valign="top">
<span class="codelink"><a href="fileutils-pysrc.html#unsubst">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="mount"></a><span class="summary-sig-name">mount</span>(<span class="summary-sig-arg">drive</span>,
<span class="summary-sig-arg">unc</span>,
<span class="summary-sig-arg">username</span>=<span class="summary-sig-default">None</span>,
<span class="summary-sig-arg">password</span>=<span class="summary-sig-default">None</span>,
<span class="summary-sig-arg">persistent</span>=<span class="summary-sig-default">False</span>)</span><br />
Windows helper function to map a network drive.</td>
<td align="right" valign="top">
<span class="codelink"><a href="fileutils-pysrc.html#mount">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="umount"></a><span class="summary-sig-name">umount</span>(<span class="summary-sig-arg">drive</span>)</span><br />
Windows helper function to map a network drive.</td>
<td align="right" valign="top">
<span class="codelink"><a href="fileutils-pysrc.html#umount">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="rmdir"></a><span class="summary-sig-name">rmdir</span>(<span class="summary-sig-arg">path</span>)</span></td>
<td align="right" valign="top">
<span class="codelink"><a href="fileutils-pysrc.html#rmdir">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="remove"></a><span class="summary-sig-name">remove</span>(<span class="summary-sig-arg">path</span>)</span></td>
<td align="right" valign="top">
<span class="codelink"><a href="fileutils-pysrc.html#remove">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="fileutils-module.html#touch" class="summary-sig-name">touch</a>(<span class="summary-sig-arg">srcdir</span>)</span><br />
Recursively touches all the files in the source path mentioned.</td>
<td align="right" valign="top">
<span class="codelink"><a href="fileutils-pysrc.html#touch">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- ==================== VARIABLES ==================== -->
<a name="section-Variables"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Variables</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-Variables"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a name="LOGGER"></a><span class="summary-name">LOGGER</span> = <code title="logging.getLogger('fileutils')">logging.getLogger('fileutils')</code>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a name="LOGGER_LOCK"></a><span class="summary-name">LOGGER_LOCK</span> = <code title="logging.getLogger('fileutils.lock')">logging.getLogger('fileutils.lock')</code>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="fileutils-module.html#ENCODING_MATRIX" class="summary-name">ENCODING_MATRIX</a> = <code title="{codecs.BOM_UTF8: 'utf_8', codecs.BOM_UTF16: 'utf_16', codecs.BOM_UTF1\
6_BE: 'utf_16_be', codecs.BOM_UTF16_LE: 'utf_16_le',}">{codecs.BOM_UTF8: 'utf_8', codecs.BOM_UTF16:<code class="variable-ellipsis">...</code></code>
</td>
</tr>
</table>
<!-- ==================== FUNCTION DETAILS ==================== -->
<a name="section-FunctionDetails"></a>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Function Details</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-FunctionDetails"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
</table>
<a name="move"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">move</span>(<span class="sig-arg">src</span>,
<span class="sig-arg">dst</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="fileutils-pysrc.html#move">source code</a></span>
</td>
</table>
<p>Recursively move a file or directory to another location.</p>
<p>If the destination is on our current filesystem, then simply use
rename. Otherwise, copy src to the dst and then remove src.
A lot more could be done here... A look at a mv.c shows a lot of
the issues this implementation glosses over.</p>
<dl class="fields">
</dl>
</td></tr></table>
</div>
<a name="rmtree"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">rmtree</span>(<span class="sig-arg">rootdir</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="fileutils-pysrc.html#rmtree">source code</a></span>
</td>
</table>
Catch shutil.rmtree failures on Windows when files are read-only. Thanks Google!
<dl class="fields">
</dl>
</td></tr></table>
</div>
<a name="read_policy_content"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">read_policy_content</span>(<span class="sig-arg">filename</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="fileutils-pysrc.html#read_policy_content">source code</a></span>
</td>
</table>
Read the policy number from the policy file.
strict allows to activate the new policy scanning.
<dl class="fields">
</dl>
</td></tr></table>
</div>
<a name="guess_encoding"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">guess_encoding</span>(<span class="sig-arg">data</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="fileutils-pysrc.html#guess_encoding">source code</a></span>
</td>
</table>
<p>Given a byte string, guess the encoding.</p>
<p>First it tries for UTF8/UTF16 BOM.</p>
<p>Next it tries the standard 'UTF8', 'ISO-8859-1', and 'cp1252' encodings,
Plus several gathered from locale information.</p>
<p>The calling program <em>must</em> first call locale.setlocale(locale.LC_ALL, '')</p>
<p>If successful it returns (decoded_unicode, successful_encoding)
If unsuccessful it raises a <tt class="rst-docutils literal"><span class="pre">UnicodeError</span></tt>.</p>
<p>This was taken from <a class="rst-reference external" href="http://www.voidspace.org.uk/python/articles/guessing_encoding.shtml" target="_top">http://www.voidspace.org.uk/python/articles/guessing_encoding.shtml</a></p>
<dl class="fields">
</dl>
</td></tr></table>
</div>
<a name="touch"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">touch</span>(<span class="sig-arg">srcdir</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="fileutils-pysrc.html#touch">source code</a></span>
</td>
</table>
Recursively touches all the files in the source path mentioned.
It does not touch the directories.
<dl class="fields">
</dl>
</td></tr></table>
</div>
<br />
<!-- ==================== VARIABLES DETAILS ==================== -->
<a name="section-VariablesDetails"></a>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Variables Details</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-VariablesDetails"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
</table>
<a name="ENCODING_MATRIX"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<h3 class="epydoc">ENCODING_MATRIX</h3>
<dl class="fields">
</dl>
<dl class="fields">
<dt>Value:</dt>
<dd><table><tr><td><pre class="variable">
{codecs.BOM_UTF8: 'utf_8', codecs.BOM_UTF16: 'utf_16', codecs.BOM_UTF1<span class="variable-linewrap"><img src="crarr.png" alt="\" /></span>
6_BE: 'utf_16_be', codecs.BOM_UTF16_LE: 'utf_16_le',}
</pre></td></tr></table>
</dd>
</dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Tree link -->
<th> <a
href="module-tree.html">Trees</a> </th>
<!-- Index link -->
<th> <a
href="identifier-index.html">Indices</a> </th>
<!-- Help link -->
<th> <a
href="help.html">Help</a> </th>
<th class="navbar" width="100%"></th>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0beta1 on Wed Sep 09 13:44:16 2009
</td>
<td align="right" class="footer">
<a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
</td>
</tr>
</table>
<script type="text/javascript">
<!--
// Private objects are initially displayed (because if
// javascript is turned off then we want them to be
// visible); but by default, we want to hide them. So hide
// them unless we have a cookie that says to show them.
checkCookie()
// -->
</script>
</body>
</html>