mergin/client_pull.py
def apply(self, directory, mp):
        """ assemble downloaded chunks into a single file """

        if self.destination_file is None:
            basename = os.path.basename(self.file_path)
            file_dir = os.path.dirname(os.path.normpath(os.path.join(directory, self.file_path)))
            dest_file_path = os.path.join(file_dir, basename)
        else:
            file_dir = os.path.dirname(os.path.normpath(self.destination_file))
            dest_file_path = self.destination_file
        os.makedirs(file_dir, exist_ok=True)

        # ignore check if we download not-latest version of gpkg file (possibly reconstructed on server on demand)
        check_size = self.latest_version or not mp.is_versioned_file(self.file_path)
        # merge chunks together (and delete them afterwards)
        file_to_merge = FileToMerge(dest_file_path, self.download_queue_items, check_size)
        file_to_merge.merge()

        # Make a copy of the file to meta dir only if there is no user-specified path for the file.
        # destination_file is None for full project download and takes a meaningful value for a single file download.
        if mp.is_versioned_file(self.file_path) and self.destination_file is None:
            mp.geodiff.make_copy_sqlite(mp.fpath(self.file_path), mp.fpath_meta(self.file_path))
 assemble downloaded chunks into a single file 
assemble downloaded chunks into a single file
assemble downloaded chunks into a single file
def apply(self, directory, mp):
        if self.destination_file is None:
            basename = os.path.basename(self.file_path)
            file_dir = os.path.dirname(os.path.normpath(os.path.join(directory, self.file_path)))
            dest_file_path = os.path.join(file_dir, basename)
        else:
            file_dir = os.path.dirname(os.path.normpath(self.destination_file))
            dest_file_path = self.destination_file
        os.makedirs(file_dir, exist_ok=True)
        check_size = self.latest_version or not mp.is_versioned_file(self.file_path)
        file_to_merge = FileToMerge(dest_file_path, self.download_queue_items, check_size)
        file_to_merge.merge()
        if mp.is_versioned_file(self.file_path) and self.destination_file is None:
            mp.geodiff.make_copy_sqlite(mp.fpath(self.file_path), mp.fpath_meta(self.file_path))
def apply ( self , directory , mp ) : if self . destination_file is None : basename = os . path . basename ( self . file_path ) file_dir = os . path . dirname ( os . path . normpath ( os . path . join ( directory , self . file_path ) ) ) dest_file_path = os . path . join ( file_dir , basename ) else : file_dir = os . path . dirname ( os . path . normpath ( self . destination_file ) ) dest_file_path = self . destination_file os . makedirs ( file_dir , exist_ok = True ) check_size = self . latest_version or not mp . is_versioned_file ( self . file_path ) file_to_merge = FileToMerge ( dest_file_path , self . download_queue_items , check_size ) file_to_merge . merge ( ) if mp . is_versioned_file ( self . file_path ) and self . destination_file is None : mp . geodiff . make_copy_sqlite ( mp . fpath ( self . file_path ) , mp . fpath_meta ( self . file_path ) )
assemble downloaded chunks into a single file
assemble downloaded chunks into a single file
""" assemble downloaded chunks into a single file """ # ignore check if we download not-latest version of gpkg file (possibly reconstructed on server on demand) # merge chunks together (and delete them afterwards) # Make a copy of the file to meta dir only if there is no user-specified path for the file. # destination_file is None for full project download and takes a meaningful value for a single file download.
self
directory
mp