'import resource' only where its used, Windows does not have it

This commit is contained in:
Hans-Christoph Steiner 2021-06-18 10:24:44 +02:00
parent 36849b2fba
commit 1300771bad
No known key found for this signature in database
GPG key ID: 3E177817BA1B9BFA

View file

@ -23,7 +23,6 @@ import glob
import subprocess
import posixpath
import re
import resource
import sys
import tarfile
import threading
@ -1026,6 +1025,9 @@ def main():
raise FDroidException("No apps to process.")
# make sure enough open files are allowed to process everything
try:
import resource # not available on Windows
soft, hard = resource.getrlimit(resource.RLIMIT_NOFILE)
if len(apps) > soft:
try:
@ -1037,6 +1039,8 @@ def main():
.format(integer=soft))
except (OSError, ValueError) as e:
logging.warning(_('Setting open file limit failed: ') + str(e))
except ImportError:
pass
if options.latest:
for app in apps.values():