DRIVER=processor
MODALIAS=cpu:type:x86,ven0002fam0017mod0031:feature:,0000,0001,0002,0003,0004,0005,0006,0007,0008,0009,000B,000C,000D,000E,000F,0010,0011,0013,0017,0018,0019,001A,0020,0021,0022,0023,0024,0025,0026,0027,0028,0029,002B,002C,002D,002E,002F,0030,0031,0034,0036,0037,0038,0039,003A,003B,003D,0064,006E,0070,0072,0074,0075,0079,007A,007F,0080,0081,0089,008C,008D,0093,0094,0095,0096,0097,0098,0099,009A,009B,009C,009D,009E,009F,00C0,00C1,00C4,00C5,00C6,00C7,00C8,00C9,00D7,00EA,00ED,00F0,00F1,00F3,00F5,00F9,00FA,00FB,00FC,010F,0114,0115,0120,0121,0123,0125,0127,0128,0132,0133,0134,0137,0138,013D,0140,0141,0142,0165,016C,016E,016F,0170,017C,01A0,01A2,01A9,01AC,01AE,01AF,01B8,01C2,0202,0216,0220,0221,025A,025B,025D,025F,0282,0286,029C,029D

  A   ˆl–Ðz¾”d
eJeAà�q�)‹Fÿ�þe+k7+/Q4FexÏ¿ƒh?Ä_ŠI|¥�+Wé3ž¯ÃÂ å    #!/usr/bin/env python3
###############################################################################
# $Id$
#
#  Project:  GDAL samples
#  Purpose:  Create a zip file
#  Author:   Even Rouault <even dot rouault at spatialys dot com>
#
###############################################################################
#  Copyright (c) 2018, Even Rouault <even dot rouault at spatialys dot com>
#
#  Permission is hereby granted, free of charge, to any person obtaining a
#  copy of this software and associated documentation files (the "Software"),
#  to deal in the Software without restriction, including without limitation
#  the rights to use, copy, modify, merge, publish, distribute, sublicense,
#  and/or sell copies of the Software, and to permit persons to whom the
#  Software is furnished to do so, subject to the following conditions:
#
#  The above copyright notice and this permission notice shall be included
#  in all copies or substantial portions of the Software.
#
#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
#  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
#  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
#  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
#  DEALINGS IN THE SOFTWARE.
###############################################################################

import sys

from osgeo import gdal


def Usage():
    print("Usage: gdal_zip [-r] zip_filename source_file*")
    return 2


def copy_file(srcfile, targetfile, recurse):

    if recurse:
        subfiles = gdal.ReadDir(srcfile)
        if subfiles:
            for subfile in subfiles:
                if (
                    subfile != "."
                    and subfile != ".."
                    and not copy_file(srcfile + "/" + subfile, targetfile, True)
                ):
                    return False
            return True

    fin = gdal.VSIFOpenL(srcfile, "rb")
    if not fin:
        print("Cannot open " + srcfile)
        return False

    fout = gdal.VSIFOpenL(targetfile + "/" + srcfile, "wb")
    if not fout:
        print("Cannot create " + targetfile + "/" + srcfile)
        gdal.VSIFCloseL(fin)
        return False

    buf_max_size = 4096
    ret = True
    copied = 0
    while True:
        buf = gdal.VSIFReadL(1, buf_max_size, fin)
        if buf is None:
            if copied == 0:
                print("Cannot read from%s" % srcfile)
                ret = False
            break
        buf_size = len(buf)
        if gdal.VSIFWriteL(buf, 1, buf_size, fout) != buf_size:
            print("Error writing %d bytes" % buf_size)
            ret = False
            break
        copied += buf_size
        if buf_size != buf_max_size:
            break

    gdal.VSIFCloseL(fin)
    gdal.VSIFCloseL(fout)
    return ret


def gdal_zip(argv, progress=None):
    srcfiles = []
    targetfile = None
    recurse = False

    argv = gdal.GeneralCmdLineProcessor(argv)
    if argv is None:
        return -1

    if gdal.GetConfigOption("GDAL_NUM_THREADS") is None:
        gdal