Mercurial > pymonkey
changeset 107:e6c6bf209444
Added clean target.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Sun, 16 Aug 2009 13:21:39 -0700 |
parents | 1e6523de9df1 |
children | 7f3a91323a88 |
files | .hgignore setup.py |
diffstat | 2 files changed, 17 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Sun Aug 16 12:53:46 2009 -0700 +++ b/.hgignore Sun Aug 16 13:21:39 2009 -0700 @@ -1,5 +1,4 @@ syntax: glob -*.so *.pyc docs/rendered/.buildinfo docs/rendered/.doctrees
--- a/setup.py Sun Aug 16 12:53:46 2009 -0700 +++ b/setup.py Sun Aug 16 13:21:39 2009 -0700 @@ -174,6 +174,23 @@ if retval: sys.exit(retval) +def maybe_clean(dirname, only_if_empty = False): + if os.path.exists(dirname): + if not (only_if_empty and os.listdir(dirname)): + distutils.dir_util.remove_tree(dirname) + +@task +@needs('setuptools.command.clean') +def clean(options): + """Clean up intermediate files, and optionally other files too.""" + + maybe_clean(DOCTEST_OUTPUT_DIR) + + if options.clean.get("all"): + maybe_clean(SPIDERMONKEY_OBJDIR) + + maybe_clean(BUILD_DIR, only_if_empty = True) + def get_lib_dir(): # This is really weird and hacky; it ought to be much easier # to figure out the default directory that distutils builds