From b9385257ccdfc9dddd7a80b7740c94a96d1681b9 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 15 Oct 2015 15:17:15 +0530 Subject: [PATCH] Added libjpeg in install and validate_os_requirements --- bench/cli.py | 6 +++++- bench/utils.py | 27 +++++++++++++++++++++++++++ install_scripts/setup_frappe.sh | 6 +++--- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/bench/cli.py b/bench/cli.py index 3dfda75c..73bc3e45 100644 --- a/bench/cli.py +++ b/bench/cli.py @@ -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, validate_os_requirements) 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 @@ -245,7 +245,11 @@ def _update(pull=False, patch=False, build=False, bench=False, auto=False, resta def update(pull=False, patch=False, build=False, bench=False, auto=False, restart_supervisor=False, requirements=False, no_backup=False, upgrade=False, bench_path='.', force=False): conf = get_config(bench=bench_path) + if not validate_os_requirements(): + return + version_upgrade = is_version_upgrade(bench=bench_path) + if version_upgrade[0] and not upgrade: raise Exception("Major Version Upgrade") diff --git a/bench/utils.py b/bench/utils.py index bbea53c5..631b5740 100644 --- a/bench/utils.py +++ b/bench/utils.py @@ -614,5 +614,32 @@ def log_line(data, stream): return sys.stderr.write(data) return sys.stdout.write(data) +def validate_os_requirements(): + valid = validate_libjpeg() + return valid + +def validate_libjpeg(): + out = get_output("whereis", "libjpeg") + + if not out: + distro = platform.linux_distribution() + distro_name = distro[0].lower() + if "centos" in distro_name: + print "Please install libjpeg using the command:" + print "sudo yum install libjpeg-devel" + return False + + elif "ubuntu" in distro_name or "elementary os" in distro_name or "debian" in distro_name: + print "Please install libjpeg using the command:" + print "sudo apt-get install libjpeg-dev" + return False + + return True + +def get_output(*cmd): + s = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE) + out = s.stdout.read() + s.stdout.close() + return out FRAPPE_VERSION = get_current_frappe_version() diff --git a/install_scripts/setup_frappe.sh b/install_scripts/setup_frappe.sh index 7bb8d88e..9a6c0a39 100755 --- a/install_scripts/setup_frappe.sh +++ b/install_scripts/setup_frappe.sh @@ -179,10 +179,10 @@ install_packages() { run_cmd sudo yum groupinstall -y "Development tools" if [ $OS_VER == "6" ]; then run_cmd add_ius_repo - run_cmd sudo yum install -y git MariaDB-server MariaDB-client MariaDB-compat python-setuptools nginx zlib-devel bzip2-devel openssl-devel postfix python27-devel python27 libxml2 libxml2-devel libxslt libxslt-devel redis MariaDB-devel libXrender libXext python27-setuptools cronie sudo which xorg-x11-fonts-Type1 xorg-x11-fonts-75dpi nodejs npm + run_cmd sudo yum install -y git MariaDB-server MariaDB-client MariaDB-compat python-setuptools nginx zlib-devel bzip2-devel openssl-devel postfix python27-devel python27 libxml2 libxml2-devel libxslt libxslt-devel redis MariaDB-devel libXrender libXext python27-setuptools cronie sudo which xorg-x11-fonts-Type1 xorg-x11-fonts-75dpi nodejs npm libjpeg-devel elif [ $OS_VER == "7" ]; then run_cmd add_epel_centos7 - run_cmd sudo yum install -y git mariadb-server mariadb-devel python-setuptools nginx zlib-devel bzip2-devel openssl-devel postfix python-devel libxml2 libxml2-devel libxslt libxslt-devel redis libXrender libXext supervisor cronie sudo which xorg-x11-fonts-75dpi xorg-x11-fonts-Type1 nodejs npm + run_cmd sudo yum install -y git mariadb-server mariadb-devel python-setuptools nginx zlib-devel bzip2-devel openssl-devel postfix python-devel libxml2 libxml2-devel libxslt libxslt-devel redis libXrender libXext supervisor cronie sudo which xorg-x11-fonts-75dpi xorg-x11-fonts-Type1 nodejs npm libjpeg-devel fi echo "Installing wkhtmltopdf" @@ -197,7 +197,7 @@ install_packages() { run_cmd bash -c "curl -sL https://deb.nodesource.com/setup_0.12 | bash -" fi run_cmd sudo apt-get update - run_cmd sudo apt-get install -y python-dev python-setuptools build-essential python-mysqldb git ntp vim screen htop mariadb-server mariadb-common libmariadbclient-dev libxslt1.1 libxslt1-dev redis-server libssl-dev libcrypto++-dev postfix nginx supervisor python-pip fontconfig libxrender1 libxext6 xfonts-75dpi xfonts-base nodejs npm + run_cmd sudo apt-get install -y python-dev python-setuptools build-essential python-mysqldb git ntp vim screen htop mariadb-server mariadb-common libmariadbclient-dev libxslt1.1 libxslt1-dev redis-server libssl-dev libcrypto++-dev postfix nginx supervisor python-pip fontconfig libxrender1 libxext6 xfonts-75dpi xfonts-base nodejs npm libjpeg-dev echo "Installing wkhtmltopdf" install_wkhtmltopdf_deb