Subject: [Instant-dev] [HG instant] added Anders clean script

From: [email-masked] (Instant)
Date: Wed, 2 Jan 2008 10:41:06 +0100 (CET)

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

changeset:   118:2b326e85b7d554f9445dd651e77594043617c4dc
user:        kent-and@localhost
date:        Mon Dec 17 15:57:25 2007 +0100
files:       src/instant.py
description:
bug fix from Marie Rognes

changeset:   117:e687ac7876967f532b76628dd301cffb3e8341b1
user:        kent-and@localhost
date:        Sun Dec 16 23:42:24 2007 +0100
files:       src/instant.py tests/test1.py
description:
bug fix

----------------------------------------------------------------------
For more details, visit http://www.fenics.org/hg/instant

---

From: Anders Logg <[email-masked]>
Date: Wed, 2 Jan 2008 15:15:12 +0100

> 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