Пример #1
0
	def addFile(self, ftype, fname, hashdict=None, ignoreMissing=False):
		""" Add entry to Manifest optionally using hashdict to avoid recalculation of hashes """
		if ftype == "AUX" and not fname.startswith("files/"):
			fname = os.path.join("files", fname)
		if not os.path.exists(self.pkgdir+fname) and not ignoreMissing:
			raise FileNotFound(fname)
		if not ftype in MANIFEST2_IDENTIFIERS:
			raise InvalidDataType(ftype)
		if ftype == "AUX" and fname.startswith("files"):
			fname = fname[6:]
		self.fhashdict[ftype][fname] = {}
		if hashdict != None:
			self.fhashdict[ftype][fname].update(hashdict)
		if not MANIFEST2_REQUIRED_HASH in self.fhashdict[ftype][fname]:
			self.updateFileHashes(ftype, fname, checkExisting=False, ignoreMissing=ignoreMissing)
Пример #2
0
 def addFile(self, ftype, fname, hashdict=None, ignoreMissing=False):
     """Add entry to Manifest optionally using hashdict to avoid recalculation of hashes"""
     if ftype == "AUX":
         if not fname.startswith("files/"):
             fname = os.path.join("files", fname)
         if fname.startswith("files"):
             fname = fname[6:]
     if not os.path.exists(f"{self.pkgdir}{fname}") and not ignoreMissing:
         raise FileNotFound(fname)
     if ftype not in MANIFEST2_IDENTIFIERS:
         raise InvalidDataType(ftype)
     self.fhashdict[ftype][fname] = {}
     if hashdict is not None:
         self.fhashdict[ftype][fname].update(hashdict)
     if self.required_hashes.difference(set(self.fhashdict[ftype][fname])):
         self.updateFileHashes(
             ftype, fname, checkExisting=False, ignoreMissing=ignoreMissing
         )