def CreateDirectory(self, directory):
    # Build list of dirs to build. This will be from bottom up.
    to_create = []
    while directory:
      if directory in self._created_dirs:
        break
      to_create.append(directory)
      self._created_dirs.append(directory)
      directory = os.path.dirname(directory)
    to_create.reverse()  # have to build from top down
    for directory in to_create:
      # Create the directory entry.  File and directory names must be
      # ascii.
      info = zipfile.ZipInfo((directory + '/').encode('ascii'),
                             date_time=self.ZipTimestamp())
      # Notes from the web and zipfile sources:
      # external_attr is 32 in size, with the unix permissions in the
      # high order 16 bit, and the MS-DOS FAT attributes in the lower 16.
      # man 2 stat tells us that 040755 should be a drwxr-xr-x style file,
      # and word of mouth tells me that bit 4 marks directories in FAT.
      info.external_attr = (040755 << 16) | 0x10
      self._zip.writestr(info, '')
Create one or more directory entries, esssentially mkdir -p.
dataset/ETHPy150Open google/apis-client-generator/src/googleapis/codegen/filesys/zip_library_package.py/ZipLibraryPackage.CreateDirectory