2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-10 09:02:10 +00:00

perf: Remove shutil from the import tree

This commit is contained in:
Aditya Hase 2021-02-21 11:12:00 +05:30
parent 6706b230da
commit 07ecaa1f77
No known key found for this signature in database
GPG Key ID: 0A55F0FCA0234972
2 changed files with 7 additions and 2 deletions

View File

@ -6,7 +6,6 @@ import json
import logging import logging
import os import os
import re import re
import shutil
import subprocess import subprocess
import sys import sys
@ -89,6 +88,7 @@ def remove_from_excluded_apps_txt(app, bench_path='.'):
def get_app(git_url, branch=None, bench_path='.', skip_assets=False, verbose=False, restart_bench=True, overwrite=False): def get_app(git_url, branch=None, bench_path='.', skip_assets=False, verbose=False, restart_bench=True, overwrite=False):
import requests import requests
import shutil
if not os.path.exists(git_url): if not os.path.exists(git_url):
if not is_git_url(git_url): if not is_git_url(git_url):
@ -195,6 +195,7 @@ def install_app(app, bench_path=".", verbose=False, no_cache=False, restart_benc
def remove_app(app, bench_path='.'): def remove_app(app, bench_path='.'):
import shutil
from bench.config.common_site_config import get_config from bench.config.common_site_config import get_config
if app not in get_apps(bench_path): if app not in get_apps(bench_path):

View File

@ -13,7 +13,6 @@ import os
import pwd import pwd
import re import re
import select import select
import shutil
import site import site
import subprocess import subprocess
import sys import sys
@ -261,6 +260,8 @@ def update(pull=False, apps=None, patch=False, build=False, requirements=False,
def copy_patches_txt(bench_path): def copy_patches_txt(bench_path):
import shutil
shutil.copy(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'patches', 'patches.txt'), shutil.copy(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'patches', 'patches.txt'),
os.path.join(bench_path, 'patches.txt')) os.path.join(bench_path, 'patches.txt'))
@ -900,6 +901,8 @@ def get_bench_name(bench_path):
def setup_fonts(): def setup_fonts():
import shutil
fonts_path = os.path.join('/tmp', 'fonts') fonts_path = os.path.join('/tmp', 'fonts')
if os.path.exists('/etc/fonts_backup'): if os.path.exists('/etc/fonts_backup'):
@ -972,6 +975,7 @@ def find_benches(directory=None):
def migrate_env(python, backup=False): def migrate_env(python, backup=False):
import shutil
from six.moves.urllib.parse import urlparse from six.moves.urllib.parse import urlparse
from bench.config.common_site_config import get_config from bench.config.common_site_config import get_config
from bench.app import get_apps from bench.app import get_apps