|
|
@ -17,7 +17,7 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >.
|
|
|
|
|
|
|
|
|
|
|
|
from hashlib import sha256
|
|
|
|
from hashlib import sha256
|
|
|
|
from importlib import import_module
|
|
|
|
from importlib import import_module
|
|
|
|
from os import listdir, makedirs, remove
|
|
|
|
from os import listdir, makedirs, remove, stat, utime
|
|
|
|
from os.path import abspath, basename, dirname, exists, join
|
|
|
|
from os.path import abspath, basename, dirname, exists, join
|
|
|
|
from shutil import copyfile
|
|
|
|
from shutil import copyfile
|
|
|
|
from sys import version_info
|
|
|
|
from sys import version_info
|
|
|
@ -113,6 +113,10 @@ def sync_resource(base_path, resource_path, name, target_dir, plugin_dir):
|
|
|
|
if not exists(resource_path) or sha_sum(dep_path) != sha_sum(resource_path):
|
|
|
|
if not exists(resource_path) or sha_sum(dep_path) != sha_sum(resource_path):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
copyfile(dep_path, resource_path)
|
|
|
|
copyfile(dep_path, resource_path)
|
|
|
|
|
|
|
|
# copy atime_ns and mtime_ns, so the weak ETags (generated by
|
|
|
|
|
|
|
|
# the HTTP server) do not change
|
|
|
|
|
|
|
|
dep_stat = stat(dep_path)
|
|
|
|
|
|
|
|
utime(resource_path, ns=(dep_stat.st_atime_ns, dep_stat.st_mtime_ns))
|
|
|
|
except:
|
|
|
|
except:
|
|
|
|
logger.critical('failed to copy plugin resource {0} for plugin {1}'.format(file_name, name))
|
|
|
|
logger.critical('failed to copy plugin resource {0} for plugin {1}'.format(file_name, name))
|
|
|
|
exit(3)
|
|
|
|
exit(3)
|
|
|
|