Skip to content

Commit

Permalink
add cleanup of temporary directory
Browse files Browse the repository at this point in the history
  • Loading branch information
ilanschnell committed Jul 9, 2013
1 parent fce7484 commit 56f383a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions conda/cli/main_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def configure_parser(sub_parsers):

def execute(args, parser):
import sys
import shutil
import tarfile
import tempfile
from os.path import abspath, isdir, isfile
Expand All @@ -46,8 +47,11 @@ def execute(args, parser):
t = tarfile.open(arg, 'r:*')
t.extractall(path=recipe_dir)
t.close()
need_cleanup = True
else:
recipe_dir = abspath(arg)
need_cleanup = False

if not isdir(recipe_dir):
sys.exit("Error: no such directory: %s" % recipe_dir)

Expand All @@ -60,6 +64,9 @@ def execute(args, parser):
else:
build.build(m)

if need_cleanup:
shutil.rmtree(recipe_dir)

print """\
# If you want to upload this package to binstar.org, type:
#
Expand Down

0 comments on commit 56f383a

Please sign in to comment.