Skip to content

Commit

Permalink
Stop using xxhash on windows #916
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo Peng committed Mar 7, 2018
1 parent 7994803 commit e3b3030
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@
'fasteners',
'pyyaml',
'pygments',
# faster hashlib
'xxhash',
# for DAG, some version requires pydot, some requires pydotplus
'networkx',
'pydot',
Expand Down Expand Up @@ -200,6 +198,8 @@
#vim-syntax.func = sos.install:install_vim_syntax
extras_require = {
':sys_platform=="win32"': ['colorama'],
# faster hashlib
':sys_platform!="win32"': ['xxhash'],
'dot': ['graphviz'],
}
)
9 changes: 6 additions & 3 deletions src/sos/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#
import os
import sys
import xxhash
import shlex
import shutil
import fasteners
Expand All @@ -30,6 +29,10 @@
from shlex import quote
import subprocess
from pathlib import Path, WindowsPath, PosixPath
try:
from xxhash import xxh64 as hash_md5
except ImportError:
from hashlib import md5 as hash_md5

from collections.abc import Sequence, Iterable

Expand Down Expand Up @@ -65,7 +68,7 @@ def __init__(self, signature):
#
def textMD5(text):
'''Get md5 of a piece of text'''
m = xxhash.xxh64()
m = hash_md5()
if isinstance(text, str):
m.update(text.encode())
else:
Expand All @@ -79,7 +82,7 @@ def fileMD5(filename, partial=True):
when dealing with large bioinformat ics datasets. '''
filesize = os.path.getsize(filename)
# calculate md5 for specified file
md5 = xxhash.xxh64()
md5 = hash_md5()
block_size = 2**20 # buffer of 1M
try:
# 2**24 = 16M
Expand Down

0 comments on commit e3b3030

Please sign in to comment.