diff --git a/bench/commands/setup.py b/bench/commands/setup.py index 96360bea..2e516496 100755 --- a/bench/commands/setup.py +++ b/bench/commands/setup.py @@ -14,7 +14,6 @@ import bench.config.production_setup import bench.config.redis import bench.config.site_config import bench.config.supervisor - import bench.utils from bench.utils import exec_cmd, run_playbook diff --git a/bench/config/__init__.py b/bench/config/__init__.py index 5b6b5bcb..7dd76eb3 100644 --- a/bench/config/__init__.py +++ b/bench/config/__init__.py @@ -1,2 +1,4 @@ +# imports - third party imports from jinja2 import Environment, PackageLoader + env = Environment(loader=PackageLoader('bench.config')) diff --git a/bench/config/lets_encrypt.py b/bench/config/lets_encrypt.py index 17f35dd0..280554ab 100755 --- a/bench/config/lets_encrypt.py +++ b/bench/config/lets_encrypt.py @@ -1,15 +1,20 @@ -import bench, os, click, errno -from bench.utils import exec_cmd, CommandFailedError, update_common_site_config -from bench.config.site_config import update_site_config, remove_domain, get_domains +# imports - standard imports +import errno +import os + +# imports - third party imports +import click +from crontab import CronTab +from six.moves.urllib.request import urlretrieve + +# imports - module imports +import bench +from bench.config.common_site_config import get_config from bench.config.nginx import make_nginx_conf from bench.config.production_setup import service -from bench.config.common_site_config import get_config -from crontab import CronTab +from bench.config.site_config import get_domains, remove_domain, update_site_config +from bench.utils import CommandFailedError, exec_cmd, update_common_site_config -try: - from urllib.request import urlretrieve -except ImportError: - from urllib import urlretrieve def setup_letsencrypt(site, custom_domain, bench_path, interactive): @@ -171,4 +176,3 @@ def setup_wildcard_ssl(domain, email, bench_path, exclude_base_domain): make_nginx_conf(bench_path) print("Restrting Nginx service") service('nginx', 'restart') - diff --git a/bench/config/procfile.py b/bench/config/procfile.py index cf3899b6..1b3f20ed 100755 --- a/bench/config/procfile.py +++ b/bench/config/procfile.py @@ -1,7 +1,15 @@ -import bench, os, click -from bench.utils import find_executable +# imports - standard imports +import os + +# imports - third party imports +import click + +# imports - module imports +import bench from bench.app import use_rq from bench.config.common_site_config import get_config +from bench.utils import find_executable + def setup_procfile(bench_path, yes=False, skip_redis=False): config = get_config(bench_path=bench_path) diff --git a/bench/config/production_setup.py b/bench/config/production_setup.py index dff6a402..4b5fc774 100755 --- a/bench/config/production_setup.py +++ b/bench/config/production_setup.py @@ -1,14 +1,13 @@ # imports - standard imports import os import sys -from distutils.spawn import find_executable # imports - module imports from bench.config.common_site_config import get_config from bench.config.nginx import make_nginx_conf from bench.config.supervisor import generate_supervisor_config from bench.config.systemd import generate_systemd_config -from bench.utils import CommandFailedError, exec_cmd, fix_prod_setup_perms, get_bench_name, get_cmd_output +from bench.utils import CommandFailedError, exec_cmd, find_executable, fix_prod_setup_perms, get_bench_name, get_cmd_output def setup_production_prerequisites(): diff --git a/bench/config/site_config.py b/bench/config/site_config.py index 6db83ea3..696185c8 100644 --- a/bench/config/site_config.py +++ b/bench/config/site_config.py @@ -1,8 +1,13 @@ -import os, json -from bench.utils import get_sites -from bench.config.nginx import make_nginx_conf +# imports - standard imports +import json +import os from collections import defaultdict +# imports - module imports +from bench.config.nginx import make_nginx_conf +from bench.utils import get_sites + + def get_site_config(site, bench_path='.'): config_path = os.path.join(bench_path, 'sites', site, 'site_config.json') if not os.path.exists(config_path): diff --git a/bench/config/systemd.py b/bench/config/systemd.py index dbf28c06..4a414825 100644 --- a/bench/config/systemd.py +++ b/bench/config/systemd.py @@ -1,9 +1,16 @@ -import os, getpass, click +# imports - standard imports +import getpass +import os + +# imports - third partyimports +import click + +# imports - module imports import bench -from bench.utils import exec_cmd from bench.app import get_current_frappe_version, use_rq -from bench.utils import get_bench_name, find_executable -from bench.config.common_site_config import get_config, update_config, get_gunicorn_workers +from bench.config.common_site_config import get_config, get_gunicorn_workers, update_config +from bench.utils import exec_cmd, find_executable, get_bench_name + def generate_systemd_config(bench_path, user=None, yes=False, stop=False, create_symlinks=False,