diff options
author | Lars Wirzenius <liw@liw.fi> | 2010-01-01 03:16:41 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2010-01-01 03:16:41 +0200 |
commit | eb85c7df4fcbeff0c28aeaa9329731dda9aace12 (patch) | |
tree | 57e3f17305803ae22cb54c29025d860ae1a812fb /summainlib.py | |
parent | 2220cc038941de88a26b981e797c091f7869e8d5 (diff) | |
download | summain-eb85c7df4fcbeff0c28aeaa9329731dda9aace12.tar.gz |
Fix SHA-1 computation so it is only done for regular
files.
Diffstat (limited to 'summainlib.py')
-rw-r--r-- | summainlib.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/summainlib.py b/summainlib.py index 509bc50..ad6fee0 100644 --- a/summainlib.py +++ b/summainlib.py @@ -18,6 +18,7 @@ import grp import hashlib import os import pwd +import stat import time import urllib @@ -50,7 +51,8 @@ class FilesystemObject(object): self['Username'] = self.lookup_username(stat_result.st_uid) self['Gid'] = '%d' % stat_result.st_gid self['Group'] = self.lookup_group(stat_result.st_gid) - self['Sha-1'] = self.compute_sha1(filename, sha1) + if stat.S_ISREG(stat_result.st_mode): + self['Sha-1'] = self.compute_sha1(filename, sha1) def format_time(self, timestamp): return time.strftime('%Y-%m-%d %H:%M:%S +0000', |