← Back to team overview

instant team mailing list archive

Re: [HG instant] added Anders clean script

 

On Wed, Jan 02, 2008 at 10:41:06AM +0100, Instant wrote:
> One or more new changesets pushed to the primary instant repository.
> A short summary of the last three changesets is included below.
> 
> changeset:   119:91952ffe3088a8167a1f892ed39e5265e33fdfdb
> tag:         tip
> user:        kent-and@localhost
> date:        Wed Jan 02 11:43:06 2008 +0100
> files:       instant-cache-clean.sh
> description:
> added Anders clean script

Here's a better one (just added to FFC). Should work for Instant also
with some minor modifications:

import os, sys, shutil

cache_dir = os.path.join((os.environ['HOME']), ".ffc", "cache")

# Check if directory exists
if not os.path.isdir(cache_dir):
    print "FFC form cache does not exist"
    sys.exit(0)

# Get list of cached forms
forms = os.listdir(cache_dir)
if len(forms) == 0:
    print "FFC form cache is empty"
    sys.exit(0)

# Remove cached forms
print "Removing %d forms from FFC form cache..." % len(forms)
for form in forms:
    directory = os.path.join(cache_dir, form)
    shutil.rmtree(directory)

-- 
Anders


References