Use shutil.rmtree instead of manual version

git-svn-id: http://svn.pyinstaller.org/trunk@8 8dd32b29-ccff-0310-8a9a-9233e24343b1
This commit is contained in:
giovannibajo
2005-09-03 18:04:36 +00:00
parent fd22a67867
commit bb22ca379f
+5 -20
View File
@@ -1,4 +1,5 @@
import os, sys, glob, string
import shutil
try:
here=os.path.dirname(__file__)
except NameError:
@@ -6,36 +7,19 @@ except NameError:
PYTHON = sys.executable
if sys.platform[:3] == 'win':
if string.find(PYTHON, ' ') > -1:
PYTHON="%s" % PYTHON
PYTHON='"%s"' % PYTHON
def empty(dir):
for fnm in os.listdir(dir):
path = os.path.join(dir, fnm)
if os.path.isdir(path):
empty(path)
try:
os.rmdir(path)
except:
pass
else:
try:
os.remove(path)
except:
pass
def clean():
distdirs = glob.glob(os.path.join(here, 'disttest*'))
for dir in distdirs:
try:
empty(dir)
os.rmdir(dir)
shutil.rmtree(dir)
except OSError, e:
print e
builddirs = glob.glob(os.path.join(here, 'buildtest*'))
for dir in builddirs:
try:
empty(dir)
os.rmdir(dir)
shutil.rmtree(dir)
except OSError, e:
print e
wfiles = glob.glob(os.path.join(here, 'warn*.txt'))
@@ -44,6 +28,7 @@ def clean():
os.remove(file)
except OSError, e:
print e
def runtests():
specs = glob.glob(os.path.join(here, 'test*.spec'))
for spec in specs: