Tests/store_packs.py
def zip_pack(self):
        """Zips pack folder and excludes not wanted directories.

        Returns:
            bool: whether the operation succeeded.
            str: full path to created pack zip.
        """
        zip_pack_path = f"{self._pack_path}.zip"
        task_status = False

        try:
            with ZipFile(zip_pack_path, 'w', ZIP_DEFLATED) as pack_zip:
                for root, dirs, files in os.walk(self._pack_path, topdown=True):
                    dirs[:] = [d for d in dirs if d not in Pack.EXCLUDE_DIRECTORIES]

                    for f in files:
                        # skipping zipping of unwanted files
                        if f.startswith('.') or f in [Pack.AUTHOR_IMAGE_NAME, Pack.USER_METADATA]:
                            print_warning(f"Skipping zipping {f} for {self._pack_name} pack")
                            continue

                        current_directory = root.split(os.path.sep)[-1]

                        if current_directory == 'Misc' and not fnmatch.fnmatch(f, 'reputation-*.json'):
                            # reputation in old format aren't supported in 6.0.0 server version
                            print_warning(f"Skipped zipping {f} for {self._pack_name} pack")
                            continue

                        full_file_path = os.path.join(root, f)
                        relative_file_path = os.path.relpath(full_file_path, self._pack_path)
                        pack_zip.write(filename=full_file_path, arcname=relative_file_path)

            task_status = True
            print_color(f"Finished zipping {self._pack_name} pack.", LOG_COLORS.GREEN)
        except Exception as e:
            print_error(f"Failed in zipping {self._pack_name} folder.\n Additional info: {e}")
        finally:
            return task_status, zip_pack_path
Zips pack folder and excludes not wanted directories.

        Returns:
            bool: whether the operation succeeded.
            str: full path to created pack zip.
        
Zips pack folder and excludes not wanted directories.
Zips pack folder and excludes not wanted directories .
def zip_pack(self):
        zip_pack_path = f"{self._pack_path}.zip"
        task_status = False
        try:
            with ZipFile(zip_pack_path, 'w', ZIP_DEFLATED) as pack_zip:
                for root, dirs, files in os.walk(self._pack_path, topdown=True):
                    dirs[:] = [d for d in dirs if d not in Pack.EXCLUDE_DIRECTORIES]
                    for f in files:
                        if f.startswith('.') or f in [Pack.AUTHOR_IMAGE_NAME, Pack.USER_METADATA]:
                            print_warning(f"Skipping zipping {f} for {self._pack_name} pack")
                            continue
                        current_directory = root.split(os.path.sep)[-1]
                        if current_directory == 'Misc' and not fnmatch.fnmatch(f, 'reputation-*.json'):
                            print_warning(f"Skipped zipping {f} for {self._pack_name} pack")
                            continue
                        full_file_path = os.path.join(root, f)
                        relative_file_path = os.path.relpath(full_file_path, self._pack_path)
                        pack_zip.write(filename=full_file_path, arcname=relative_file_path)
            task_status = True
            print_color(f"Finished zipping {self._pack_name} pack.", LOG_COLORS.GREEN)
        except Exception as e:
            print_error(f"Failed in zipping {self._pack_name} folder.\n Additional info: {e}")
        finally:
            return task_status, zip_pack_path
def zip_pack ( self ) : zip_pack_path = f"{self._pack_path}.zip" task_status = False try : with ZipFile ( zip_pack_path , 'w' , ZIP_DEFLATED ) as pack_zip : for root , dirs , files in os . walk ( self . _pack_path , topdown = True ) : dirs [ : ] = [ d for d in dirs if d not in Pack . EXCLUDE_DIRECTORIES ] for f in files : if f . startswith ( '.' ) or f in [ Pack . AUTHOR_IMAGE_NAME , Pack . USER_METADATA ] : print_warning ( f"Skipping zipping {f} for {self._pack_name} pack" ) continue current_directory = root . split ( os . path . sep ) [ - 1 ] if current_directory == 'Misc' and not fnmatch . fnmatch ( f , 'reputation-*.json' ) : print_warning ( f"Skipped zipping {f} for {self._pack_name} pack" ) continue full_file_path = os . path . join ( root , f ) relative_file_path = os . path . relpath ( full_file_path , self . _pack_path ) pack_zip . write ( filename = full_file_path , arcname = relative_file_path ) task_status = True print_color ( f"Finished zipping {self._pack_name} pack." , LOG_COLORS . GREEN ) except Exception as e : print_error ( f"Failed in zipping {self._pack_name} folder.\n Additional info: {e}" ) finally : return task_status , zip_pack_path
Zips pack folder and excludes not wanted directories.
Zips pack folder and excludes not wanted directories .
"""Zips pack folder and excludes not wanted directories.

        Returns:
            bool: whether the operation succeeded.
            str: full path to created pack zip.
        """ # skipping zipping of unwanted files # reputation in old format aren't supported in 6.0.0 server version
whether the operation succeeded.
str: full path to created pack zip.
whether the operation succeeded . str : full path to created pack zip .
bool
self