[docs]classDistlibManifestChecksumFileExistenceDiffer(ChecksumFileExistenceDiffer):""" Read in a MANIFEST.in file and process it. Use the results for comparing what is listed in the checksum file with what is "reality". """always_added_files=set(["MANIFEST.in"])
[docs]defgather_files(self,verifying=False):files_set=set()manifest_path=os.path.join(self.root,"MANIFEST.in")ifnotos.path.exists(manifest_path):# open() would do this, but let us be explicit, the file must exist.raiseFileNotFoundError(manifest_path,os.strerror(errno.ENOENT),manifest_path)withopen(manifest_path,"r")asf:manifest_in=f.read()manifest=Manifest(self.root)lines=manifest_in.splitlines()ifverifying:lines=["global-include *"]+linesforlineinlines:line=line.strip()# distlib.manifest bombs on empty lines.# It also doesn't appear to allow comments, so let's hack those in.ifnotlineorline[0]=="#":continuetry:manifest.process_directive(line)exceptOSErrorase:# Handle symlink loops (errno 40: too many levels of symbolic links)ife.errno==errno.ELOOP:# Skip this directive if it encounters a symlink loopcontinueraiseforpathinmanifest.files:files_set.add(os.path.relpath(path,start=self.root))returnfiles_set