mirror of
https://github.com/frappe/bench.git
synced 2024-11-11 15:51:03 +00:00
[fix] try installing pillow before update
This commit is contained in:
parent
d918173783
commit
77373d955b
@ -14,7 +14,7 @@ from .utils import (build_assets, patch_sites, exec_cmd, update_bench, get_env_c
|
||||
get_config, update_config, restart_supervisor_processes, put_config, default_config, update_requirements,
|
||||
backup_all_sites, backup_site, get_sites, prime_wheel_cache, is_root, set_mariadb_host, drop_privileges,
|
||||
fix_file_perms, fix_prod_setup_perms, set_ssl_certificate, set_ssl_certificate_key, get_cmd_output, post_upgrade,
|
||||
pre_upgrade, validate_upgrade, PatchError, download_translations_p, setup_socketio)
|
||||
pre_upgrade, validate_upgrade, PatchError, download_translations_p, setup_socketio, before_update)
|
||||
from .app import get_app as _get_app
|
||||
from .app import new_app as _new_app
|
||||
from .app import pull_all_apps, get_apps, get_current_frappe_version, is_version_upgrade, switch_to_v4, switch_to_v5, switch_to_master, switch_to_develop
|
||||
@ -253,6 +253,8 @@ def update(pull=False, patch=False, build=False, bench=False, auto=False, restar
|
||||
if upgrade and (version_upgrade[0] or (not version_upgrade[0] and force)):
|
||||
validate_upgrade(version_upgrade[1], version_upgrade[2], bench=bench_path)
|
||||
|
||||
before_update(bench=bench_path, requirements=requirements)
|
||||
|
||||
if pull:
|
||||
pull_all_apps(bench=bench_path)
|
||||
|
||||
|
@ -13,7 +13,6 @@ import multiprocessing
|
||||
from distutils.spawn import find_executable
|
||||
import pwd, grp
|
||||
|
||||
|
||||
class PatchError(Exception):
|
||||
pass
|
||||
|
||||
@ -351,13 +350,7 @@ def update_requirements(bench='.'):
|
||||
for app in os.listdir(apps_dir):
|
||||
req_file = os.path.join(apps_dir, app, 'requirements.txt')
|
||||
if os.path.exists(req_file):
|
||||
try:
|
||||
exec_cmd("{pip} install -q -r {req_file}".format(pip=pip, req_file=req_file))
|
||||
except CommandFailedError, e:
|
||||
if "Pillow" in e:
|
||||
print_pillow_dependencies()
|
||||
|
||||
raise
|
||||
exec_cmd("{pip} install -q -r {req_file}".format(pip=pip, req_file=req_file))
|
||||
|
||||
def backup_site(site, bench='.'):
|
||||
if FRAPPE_VERSION == 4:
|
||||
@ -620,22 +613,6 @@ def log_line(data, stream):
|
||||
return sys.stderr.write(data)
|
||||
return sys.stdout.write(data)
|
||||
|
||||
def print_pillow_dependencies():
|
||||
distro = platform.linux_distribution()
|
||||
distro_name = distro[0].lower()
|
||||
if "centos" in distro_name or "fedora" in distro_name:
|
||||
print "Please install these dependencies using the command:"
|
||||
print "sudo yum install libtiff-devel libjpeg-devel libzip-devel freetype-devel lcms2-devel libwebp-devel tcl-devel tk-devel"
|
||||
|
||||
elif "ubuntu" in distro_name or "elementary os" in distro_name or "debian" in distro_name:
|
||||
print "Please install these dependencies using the command:"
|
||||
|
||||
if "ubuntu" in distro_name and distro[1]=="12.04":
|
||||
print "sudo apt-get install -y libtiff4-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev python-tk"
|
||||
else:
|
||||
print "sudo apt-get install -y libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk"
|
||||
|
||||
|
||||
def get_output(*cmd):
|
||||
s = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
out = s.stdout.read()
|
||||
@ -643,3 +620,33 @@ def get_output(*cmd):
|
||||
return out
|
||||
|
||||
FRAPPE_VERSION = get_current_frappe_version()
|
||||
|
||||
def before_update(bench, requirements):
|
||||
validate_pillow_dependencies(bench, requirements)
|
||||
|
||||
def validate_pillow_dependencies(bench, requirements):
|
||||
if not requirements:
|
||||
return
|
||||
|
||||
try:
|
||||
pip = os.path.join(bench, 'env', 'bin', 'pip')
|
||||
exec_cmd("{pip} install Pillow".format(pip=pip))
|
||||
|
||||
except CommandFailedError:
|
||||
distro = platform.linux_distribution()
|
||||
distro_name = distro[0].lower()
|
||||
if "centos" in distro_name or "fedora" in distro_name:
|
||||
print "Please install these dependencies using the command:"
|
||||
print "sudo yum install libtiff-devel libjpeg-devel libzip-devel freetype-devel lcms2-devel libwebp-devel tcl-devel tk-devel"
|
||||
|
||||
raise
|
||||
|
||||
elif "ubuntu" in distro_name or "elementary os" in distro_name or "debian" in distro_name:
|
||||
print "Please install these dependencies using the command:"
|
||||
|
||||
if "ubuntu" in distro_name and distro[1]=="12.04":
|
||||
print "sudo apt-get install -y libtiff4-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev python-tk"
|
||||
else:
|
||||
print "sudo apt-get install -y libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk"
|
||||
|
||||
raise
|
||||
|
Loading…
Reference in New Issue
Block a user