1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-26 04:02:11 +01:00

handle mmap failure on filesystems like NTFS, which may not support

memory mapping when mounted under Linux
This commit is contained in:
Dr. Peter Poeml 2008-03-16 19:02:38 +00:00
parent 5d57d7e299
commit 7b91075229

View File

@ -1273,7 +1273,15 @@ def http_request(method, url, data=None, file=None):
else:
import mmap
filefd = open(file, 'r+')
data = mmap.mmap(filefd.fileno(), os.path.getsize(file))
try:
data = mmap.mmap(filefd.fileno(), os.path.getsize(file))
except EnvironmentError, e:
if e.errno == 19:
sys.exit('\n\n%s\nThe file \'%s\' could not be memory mapped. It is ' \
'\non a filesystem which does not support this.' % (e, file))
else:
raise
fd = urllib2.urlopen(req, data=data)