mirror of
https://github.com/frappe/bench.git
synced 2025-01-09 08:30:39 +00:00
Merge branch 'develop' of github.com:Aradhya-Tripathi/bench into dependency-resolution
This commit is contained in:
commit
6d05fe2f53
12
bench/app.py
12
bench/app.py
@ -10,6 +10,7 @@ import sys
|
||||
import typing
|
||||
from collections import OrderedDict
|
||||
from datetime import date
|
||||
from urllib.parse import urlparse
|
||||
|
||||
# imports - third party imports
|
||||
import click
|
||||
@ -65,6 +66,9 @@ class AppMeta:
|
||||
self.from_apps = False
|
||||
self.is_url = False
|
||||
self.branch = branch
|
||||
self.mount_path = os.path.abspath(
|
||||
os.path.join(urlparse(self.name).netloc, urlparse(self.name).path)
|
||||
)
|
||||
self.setup_details()
|
||||
|
||||
def setup_details(self):
|
||||
@ -78,7 +82,7 @@ class AppMeta:
|
||||
self._setup_details_from_installed_apps()
|
||||
|
||||
# fetch meta for repo on mounted disk
|
||||
elif os.path.exists(self.name):
|
||||
elif os.path.exists(self.mount_path):
|
||||
self.on_disk = True
|
||||
self._setup_details_from_mounted_disk()
|
||||
|
||||
@ -94,7 +98,9 @@ class AppMeta:
|
||||
self._setup_details_from_name_tag()
|
||||
|
||||
def _setup_details_from_mounted_disk(self):
|
||||
self.org, self.repo, self.tag = os.path.split(self.name)[-2:] + (self.branch,)
|
||||
self.org, self.repo, self.tag = os.path.split(self.mount_path)[-2:] + (
|
||||
self.branch,
|
||||
)
|
||||
|
||||
def _setup_details_from_name_tag(self):
|
||||
self.org, self.repo, self.tag = fetch_details_from_tag(self.name)
|
||||
@ -125,7 +131,7 @@ class AppMeta:
|
||||
return os.path.abspath(os.path.join("apps", self.name))
|
||||
|
||||
if self.on_disk:
|
||||
return os.path.abspath(self.name)
|
||||
return self.mount_path
|
||||
|
||||
if self.is_url:
|
||||
return self.name
|
||||
|
@ -360,7 +360,7 @@ class BenchSetup(Base):
|
||||
|
||||
@job(title="Setting Up Bench Dependencies", success="Bench Dependencies Set Up")
|
||||
def requirements(self, apps=None):
|
||||
"""Install and upgrade all installed apps on given Bench if apps not specified
|
||||
"""Install and upgrade specified / all installed apps on given Bench
|
||||
"""
|
||||
from bench.app import App
|
||||
|
||||
@ -375,7 +375,7 @@ class BenchSetup(Base):
|
||||
App(app, bench=self.bench, to_clone=False).install( skip_assets=True, restart_bench=False)
|
||||
|
||||
def python(self, apps=None):
|
||||
"""Install and upgrade Python dependencies for installed apps on given Bench if app not specified
|
||||
"""Install and upgrade Python dependencies for specified / all installed apps on given Bench
|
||||
"""
|
||||
import bench.cli
|
||||
|
||||
@ -392,7 +392,7 @@ class BenchSetup(Base):
|
||||
self.run(f"{self.bench.python} -m pip install {quiet_flag} --upgrade -e {app_path}")
|
||||
|
||||
def node(self, apps=None):
|
||||
"""Install and upgrade Node dependencies for all apps on given Bench if app not specified
|
||||
"""Install and upgrade Node dependencies for specified / all apps on given Bench
|
||||
"""
|
||||
from bench.utils.bench import update_node_packages
|
||||
|
||||
|
@ -140,7 +140,7 @@ def setup_requirements(node=False, python=False, dev=False, apps=None):
|
||||
"""
|
||||
Setup Python and Node dependencies.
|
||||
|
||||
You can optionally specify one or more apps to specify dependencies for.
|
||||
You can optionally specify one or more apps to setup dependencies for.
|
||||
"""
|
||||
from bench.bench import Bench
|
||||
|
||||
|
@ -10,6 +10,7 @@ import git
|
||||
# imports - module imports
|
||||
from bench.utils import exec_cmd
|
||||
from bench.release import get_bumped_version
|
||||
from bench.app import App
|
||||
from bench.tests.test_base import FRAPPE_BRANCH, TestBenchBase
|
||||
|
||||
|
||||
@ -34,9 +35,10 @@ class TestBenchInit(TestBenchBase):
|
||||
def test_utils(self):
|
||||
self.assertEqual(subprocess.call("bench"), 0)
|
||||
|
||||
|
||||
def test_init(self, bench_name="test-bench", **kwargs):
|
||||
self.init_bench(bench_name, **kwargs)
|
||||
app = App("file:///tmp/frappe")
|
||||
self.assertEqual(app.url, "/tmp/frappe")
|
||||
self.assert_folders(bench_name)
|
||||
self.assert_virtual_env(bench_name)
|
||||
self.assert_config(bench_name)
|
||||
|
Loading…
Reference in New Issue
Block a user