bir dizinin içeriğini tümü ile silme işlevini purge_dir() util.py'ye
taşıdım. archive.py dışındaki modüller de kullanabilir. packagedb.py içerisine eksik olan iki import'u ekledim.
This commit is contained in:
+2
-5
@@ -10,6 +10,7 @@ import zipfile
|
|||||||
|
|
||||||
#pisi modules
|
#pisi modules
|
||||||
import config
|
import config
|
||||||
|
import util
|
||||||
|
|
||||||
class ArchiveBase(object):
|
class ArchiveBase(object):
|
||||||
def __init__(self, type, fileName, targetDir):
|
def __init__(self, type, fileName, targetDir):
|
||||||
@@ -20,11 +21,7 @@ class ArchiveBase(object):
|
|||||||
|
|
||||||
# first we check if we need to clean-up our working env.
|
# first we check if we need to clean-up our working env.
|
||||||
if os.path.exists(self.targetDir):
|
if os.path.exists(self.targetDir):
|
||||||
for root, dirs, files in os.walk(self.targetDir, topdown=False):
|
util.purge_dir(self.targetDir)
|
||||||
for name in files:
|
|
||||||
os.remove(os.path.join(root, name))
|
|
||||||
for name in dirs:
|
|
||||||
os.rmdir(os.path.join(root, name))
|
|
||||||
else:
|
else:
|
||||||
os.makedirs(self.targetDir)
|
os.makedirs(self.targetDir)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user