Browse Source

fix: 💚 fix CI about CRLF

tags/0.1.0
shangfengh 2 years ago
parent
commit
6a49f60145
1 changed files with 5 additions and 7 deletions
  1. +5
    -7
      dependency/py/HashFiles.py

+ 5
- 7
dependency/py/HashFiles.py View File

@@ -14,14 +14,12 @@ def generateHashFile():
for root, dirs, files in os.walk(file): for root, dirs, files in os.walk(file):
for file in files: for file in files:
path = os.path.join(root, file) path = os.path.join(root, file)
if mimetypes.guess_type(file)[0] == 'text/plain':
with open(path, 'rU') as f:
with open(path, 'rb') as f:
data = f.read() data = f.read()
hashlist[path.replace('\\','/')]=hashlib.md5(data).hexdigest()
else:
with open(path, 'rb') as f:
data = f.read()
hashlist[path.replace('\\','/')]=hashlib.md5(data).hexdigest()
if data.find('\r\n')!=-1 :
hashlist[path.replace('\\','/')]=hashlib.md5(data.replace('\n','\r\n')).hexdigest()
else :
hashlist[path.replace('\\','/')]=hashlib.md5(data).hexdigest()
targetFile=os.path.join(targetfolder,'hash.json') targetFile=os.path.join(targetfolder,'hash.json')
with open(targetFile, 'w') as fp: with open(targetFile, 'w') as fp:
json.dump(hashlist,fp) json.dump(hashlist,fp)


Loading…
Cancel
Save