mirror of https://github.com/CIRCL/PyCIRCLean
Change is_recursive to is_archive
* is_archive is clearer and more descriptive than is_recursivepull/16/head
parent
74a7244fbd
commit
e27d397496
|
@ -122,7 +122,7 @@ class File(FileBase):
|
||||||
|
|
||||||
def __init__(self, src_path, dst_path, logger):
|
def __init__(self, src_path, dst_path, logger):
|
||||||
super(File, self).__init__(src_path, dst_path)
|
super(File, self).__init__(src_path, dst_path)
|
||||||
self.is_recursive = False
|
self.is_archive = False
|
||||||
self.logger = logger
|
self.logger = logger
|
||||||
self.tempdir_path = self.dst_path + '_temp'
|
self.tempdir_path = self.dst_path + '_temp'
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ class File(FileBase):
|
||||||
|
|
||||||
def write_log(self):
|
def write_log(self):
|
||||||
props = self.get_all_props()
|
props = self.get_all_props()
|
||||||
if not self.is_recursive:
|
if not self.is_archive:
|
||||||
if os.path.exists(self.tempdir_path):
|
if os.path.exists(self.tempdir_path):
|
||||||
# Hack to make images appear at the correct tree depth in log
|
# Hack to make images appear at the correct tree depth in log
|
||||||
self.logger.add_file(self.src_path, props, in_tempdir=True)
|
self.logger.add_file(self.src_path, props, in_tempdir=True)
|
||||||
|
@ -423,7 +423,7 @@ class File(FileBase):
|
||||||
# TODO: change this to something archive type specific instead of generic 'Archive'
|
# TODO: change this to something archive type specific instead of generic 'Archive'
|
||||||
self.add_description('Archive')
|
self.add_description('Archive')
|
||||||
self.should_copy = False
|
self.should_copy = False
|
||||||
self.is_recursive = True
|
self.is_archive = True
|
||||||
|
|
||||||
def _unknown_app(self):
|
def _unknown_app(self):
|
||||||
"""Process an unknown file."""
|
"""Process an unknown file."""
|
||||||
|
@ -654,8 +654,8 @@ class KittenGroomerFileCheck(KittenGroomerBase):
|
||||||
if file.should_copy:
|
if file.should_copy:
|
||||||
file.safe_copy()
|
file.safe_copy()
|
||||||
file.set_property('copied', True)
|
file.set_property('copied', True)
|
||||||
file.write_log()
|
file.write_log()
|
||||||
if file.is_recursive:
|
if file.is_archive:
|
||||||
self.process_archive(file)
|
self.process_archive(file)
|
||||||
# TODO: Can probably handle cleaning up the tempdir better
|
# TODO: Can probably handle cleaning up the tempdir better
|
||||||
if hasattr(file, 'tempdir_path'):
|
if hasattr(file, 'tempdir_path'):
|
||||||
|
@ -700,7 +700,7 @@ class KittenGroomerFileCheck(KittenGroomerBase):
|
||||||
full_path = os.path.join(root_dir_path, path)
|
full_path = os.path.join(root_dir_path, path)
|
||||||
if os.path.isdir(full_path):
|
if os.path.isdir(full_path):
|
||||||
queue.append(full_path)
|
queue.append(full_path)
|
||||||
queue += self.list_files_dirs(full_path) # if path is a dir, recurse through its contents
|
queue += self.list_files_dirs(full_path)
|
||||||
elif os.path.isfile(full_path):
|
elif os.path.isfile(full_path):
|
||||||
queue.append(full_path)
|
queue.append(full_path)
|
||||||
return queue
|
return queue
|
||||||
|
|
Loading…
Reference in New Issue