mirror of
https://github.com/frappe/bench.git
synced 2024-11-13 16:56:33 +00:00
chore: remove support for older versions of frappe
This commit is contained in:
parent
777b204490
commit
ec2ce0f3b8
@ -152,13 +152,7 @@ def new_app(app, bench_path='.'):
|
||||
app = app.lower().replace(" ", "_").replace("-", "_")
|
||||
logger.log('creating new app {}'.format(app))
|
||||
apps = os.path.abspath(os.path.join(bench_path, 'apps'))
|
||||
bench.set_frappe_version(bench_path=bench_path)
|
||||
|
||||
if bench.FRAPPE_VERSION == 4:
|
||||
exec_cmd("{frappe} --make_app {apps} {app}".format(frappe=get_frappe(bench_path=bench_path),
|
||||
apps=apps, app=app))
|
||||
else:
|
||||
run_frappe_cmd('make-app', apps, app, bench_path=bench_path)
|
||||
run_frappe_cmd('make-app', apps, app, bench_path=bench_path)
|
||||
install_app(app, bench_path=bench_path)
|
||||
|
||||
|
||||
|
@ -5,7 +5,7 @@ import os
|
||||
|
||||
# imports - module imports
|
||||
import bench
|
||||
from bench.app import get_current_frappe_version, use_rq
|
||||
from bench.app import 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
|
||||
|
||||
@ -29,7 +29,6 @@ def generate_supervisor_config(bench_path, user=None, yes=False, skip_redis=Fals
|
||||
"bench_dir": bench_dir,
|
||||
"sites_dir": os.path.join(bench_dir, 'sites'),
|
||||
"user": user,
|
||||
"frappe_version": get_current_frappe_version(bench_path),
|
||||
"use_rq": use_rq(bench_path),
|
||||
"http_timeout": config.get("http_timeout", 120),
|
||||
"redis_server": find_executable('redis-server'),
|
||||
|
@ -7,7 +7,7 @@ import click
|
||||
|
||||
# imports - module imports
|
||||
import bench
|
||||
from bench.app import get_current_frappe_version, use_rq
|
||||
from bench.app import use_rq
|
||||
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
|
||||
|
||||
@ -51,7 +51,6 @@ def generate_systemd_config(bench_path, user=None, yes=False,
|
||||
"bench_dir": bench_dir,
|
||||
"sites_dir": os.path.join(bench_dir, 'sites'),
|
||||
"user": user,
|
||||
"frappe_version": get_current_frappe_version(bench_path),
|
||||
"use_rq": use_rq(bench_path),
|
||||
"http_timeout": config.get("http_timeout", 120),
|
||||
"redis_server": find_executable('redis-server'),
|
||||
|
@ -136,7 +136,6 @@ user={{ user }}
|
||||
directory={{ sites_dir }}
|
||||
{% endif %}
|
||||
|
||||
{% if frappe_version > 5 %}
|
||||
{% if not skip_redis %}
|
||||
[program:{{ bench_name }}-redis-socketio]
|
||||
command={{ redis_server }} {{ redis_socketio_config }}
|
||||
@ -161,8 +160,6 @@ user={{ user }}
|
||||
directory={{ bench_dir }}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
[group:{{ bench_name }}-web]
|
||||
programs={{ bench_name }}-frappe-web {%- if node -%} ,{{ bench_name }}-node-socketio {%- endif%}
|
||||
|
||||
@ -180,5 +177,5 @@ programs={{ bench_name }}-frappe-workerbeat,{{ bench_name }}-frappe-worker,{{ be
|
||||
|
||||
{% if not skip_redis %}
|
||||
[group:{{ bench_name }}-redis]
|
||||
programs={{ bench_name }}-redis-cache,{{ bench_name }}-redis-queue {%- if frappe_version > 5 -%} ,{{ bench_name }}-redis-socketio {%- endif %}
|
||||
programs={{ bench_name }}-redis-cache,{{ bench_name }}-redis-queue,{{ bench_name }}-redis-socketio
|
||||
{% endif %}
|
||||
|
@ -163,11 +163,8 @@ def init(path, apps_path=None, no_procfile=False, no_backups=False,
|
||||
if apps_path:
|
||||
install_apps_from_path(apps_path, bench_path=path)
|
||||
|
||||
|
||||
bench.set_frappe_version(bench_path=path)
|
||||
if bench.FRAPPE_VERSION > 5:
|
||||
if not skip_assets:
|
||||
update_node_packages(bench_path=path)
|
||||
if not skip_assets:
|
||||
update_node_packages(bench_path=path)
|
||||
|
||||
set_all_patches_executed(bench_path=path)
|
||||
if not skip_assets:
|
||||
@ -358,27 +355,17 @@ def setup_socketio(bench_path='.'):
|
||||
|
||||
|
||||
def patch_sites(bench_path='.'):
|
||||
bench.set_frappe_version(bench_path=bench_path)
|
||||
|
||||
try:
|
||||
if bench.FRAPPE_VERSION == 4:
|
||||
exec_cmd("{frappe} --latest all".format(frappe=get_frappe(bench_path=bench_path)), cwd=os.path.join(bench_path, 'sites'))
|
||||
else:
|
||||
run_frappe_cmd('--site', 'all', 'migrate', bench_path=bench_path)
|
||||
run_frappe_cmd('--site', 'all', 'migrate', bench_path=bench_path)
|
||||
except subprocess.CalledProcessError:
|
||||
raise PatchError
|
||||
|
||||
|
||||
def build_assets(bench_path='.', app=None):
|
||||
bench.set_frappe_version(bench_path=bench_path)
|
||||
|
||||
if bench.FRAPPE_VERSION == 4:
|
||||
exec_cmd("{frappe} --build".format(frappe=get_frappe(bench_path=bench_path)), cwd=os.path.join(bench_path, 'sites'))
|
||||
else:
|
||||
command = 'bench build'
|
||||
if app:
|
||||
command += ' --app {}'.format(app)
|
||||
exec_cmd(command, cwd=bench_path)
|
||||
command = 'bench build'
|
||||
if app:
|
||||
command += ' --app {}'.format(app)
|
||||
exec_cmd(command, cwd=bench_path)
|
||||
|
||||
|
||||
def get_sites(bench_path='.'):
|
||||
@ -395,14 +382,8 @@ def setup_backups(bench_path='.'):
|
||||
bench_dir = os.path.abspath(bench_path)
|
||||
user = get_config(bench_path=bench_dir).get('frappe_user')
|
||||
logfile = os.path.join(bench_dir, 'logs', 'backup.log')
|
||||
bench.set_frappe_version(bench_path=bench_path)
|
||||
system_crontab = CronTab(user=user)
|
||||
|
||||
if bench.FRAPPE_VERSION == 4:
|
||||
backup_command = "cd {sites_dir} && {frappe} --backup all".format(frappe=get_frappe(bench_path=bench_path),)
|
||||
else:
|
||||
backup_command = "cd {bench_dir} && {bench} --verbose --site all backup".format(bench_dir=bench_dir, bench=sys.argv[0])
|
||||
|
||||
backup_command = "cd {bench_dir} && {bench} --verbose --site all backup".format(bench_dir=bench_dir, bench=sys.argv[0])
|
||||
job_command = "{backup_command} >> {logfile} 2>&1".format(backup_command=backup_command, logfile=logfile)
|
||||
|
||||
if job_command not in str(system_crontab):
|
||||
@ -662,13 +643,7 @@ def update_npm_packages(bench_path='.'):
|
||||
|
||||
|
||||
def backup_site(site, bench_path='.'):
|
||||
bench.set_frappe_version(bench_path=bench_path)
|
||||
|
||||
if bench.FRAPPE_VERSION == 4:
|
||||
exec_cmd("{frappe} --backup {site}".format(frappe=get_frappe(bench_path=bench_path), site=site),
|
||||
cwd=os.path.join(bench_path, 'sites'))
|
||||
else:
|
||||
run_frappe_cmd('--site', site, 'backup', bench_path=bench_path)
|
||||
run_frappe_cmd('--site', site, 'backup', bench_path=bench_path)
|
||||
|
||||
|
||||
def backup_all_sites(bench_path='.'):
|
||||
@ -754,11 +729,6 @@ def fix_prod_setup_perms(bench_path='.', frappe_user=None):
|
||||
os.chown(path, uid, gid)
|
||||
|
||||
|
||||
def get_current_frappe_version(bench_path='.'):
|
||||
from .app import get_current_frappe_version as fv
|
||||
return fv(bench_path=bench_path)
|
||||
|
||||
|
||||
def run_frappe_cmd(*args, **kwargs):
|
||||
from .cli import from_command_line
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user