Exemplo n.º 1
0
 def _command_splitter(self, string):
     """
     Split a command string into list using shlex.
     """
     x_str = string
     if not is_python3():
         x_str = convert_to_rawstring(x_str)
     return [convert_to_unicode(y) for y in shlex.split(x_str)]
Exemplo n.º 2
0
 def _command_splitter(self, string):
     """
     Split a command string into list using shlex.
     """
     x_str = string
     if not is_python3():
         x_str = convert_to_rawstring(x_str)
     return [convert_to_unicode(y) for y in shlex.split(x_str)]
Exemplo n.º 3
0
def md5sum(filepath):
    """
    Calcuate md5 hash of given file path.
    """
    import hashlib
    m = hashlib.md5()
    readfile = open(filepath, "rb")
    block = readfile.read(1024)
    while block:
        m.update(convert_to_rawstring(block))
        block = readfile.read(1024)
    readfile.close()
    return m.hexdigest()
Exemplo n.º 4
0
def md5sum(filepath):
    """
    Calcuate md5 hash of given file path.
    """
    import hashlib
    m = hashlib.md5()
    readfile = open(filepath, "rb")
    block = readfile.read(1024)
    while block:
        m.update(convert_to_rawstring(block))
        block = readfile.read(1024)
    readfile.close()
    return m.hexdigest()