tools: Remove hashes from metadata.

- Hashes aren't strictly metadata.
- Which types of hashes are popular?
- Hashes are expensive to calculate.
This commit is contained in:
Andrew Hamilton 2019-06-03 22:11:15 +10:00
parent be489b0628
commit d62010a1e0
2 changed files with 1 additions and 9 deletions

View file

@ -187,7 +187,7 @@ def _pretty_bytes(bytes):
return f"{conversion} {units[unit_index]}"
@deps(deps={"file", "coreutils"}, executables={"file", "sha1sum", "md5sum"})
@deps(deps={"file", "coreutils"}, executables={"file"})
def metadata(path):
def detail(value, unit):
@ -213,10 +213,6 @@ def metadata(path):
stdout, *rest = _do_command(
["file", "--dereference", "--brief", "--uncompress", path])
file_type = stdout
stdout, *rest = _do_command(["md5sum", path])
md5sum = stdout.split()[0]
stdout, *rest = _do_command(["sha1sum", path])
sha1sum = stdout.split()[0]
permissions_value = [permissions,
detail(_permissions_in_octal(permissions), None)]
text = []
@ -226,7 +222,6 @@ def metadata(path):
("access time", access), None,
("owner", owner), ("group", group), None,
("hardlinks", hardlinks), ("symlink", is_symlink), None,
("md5", md5sum), ("sha1", sha1sum), None,
("mime type", mime_type.strip()),
("file type", file_type.strip())]:
if line is None:

View file

@ -11,8 +11,5 @@
(Bhardlinks:(B 2
(Bsymlink:(B no
(Bmd5:(B 28ca2e417cb64ea4e555efe3203642de
(Bsha1:(B 8b8c0214f3f0a0d79032d1b44550064964a33a26
(Bmime type:(B text/x-python; charset=us-ascii
(Bfile type:(B Python script, ASCII text executable (B