mirror of
https://github.com/frappe/bench.git
synced 2024-11-13 16:56:33 +00:00
Merge pull request #1337 from gavindsouza/ci-fixes-2022-001
build: pyproject.toml > setup.py + requirements.txt
This commit is contained in:
commit
60569ba897
38
.travis.yml
38
.travis.yml
@ -5,11 +5,6 @@ sudo: true
|
||||
git:
|
||||
depth: 1
|
||||
|
||||
cache:
|
||||
- pip
|
||||
- npm
|
||||
- yarn
|
||||
|
||||
addons:
|
||||
mariadb: '10.3'
|
||||
|
||||
@ -30,18 +25,18 @@ matrix:
|
||||
env: TEST=bench
|
||||
script: python bench/tests/test_init.py TestBenchInit.basic
|
||||
|
||||
- name: "Python 3.10 Basic Setup"
|
||||
python: "3.10"
|
||||
env: TEST=bench
|
||||
script: python bench/tests/test_init.py TestBenchInit.basic
|
||||
|
||||
- name: "Python 3.7 Production Setup"
|
||||
python: 3.7
|
||||
env: TEST=bench
|
||||
script: python bench/tests/test_setup_production.py TestSetupProduction.production
|
||||
|
||||
- name: "Python 3.8 Production Setup"
|
||||
python: 3.8
|
||||
env: TEST=bench
|
||||
script: python bench/tests/test_setup_production.py TestSetupProduction.production
|
||||
|
||||
- name: "Python 3.9 Production Setup"
|
||||
python: 3.9
|
||||
- name: "Python 3.10 Production Setup"
|
||||
python: "3.10"
|
||||
env: TEST=bench
|
||||
script: python bench/tests/test_setup_production.py TestSetupProduction.production
|
||||
|
||||
@ -50,31 +45,24 @@ matrix:
|
||||
env: TEST=bench
|
||||
script: python -m unittest -v bench.tests.test_utils && python -m unittest -v bench.tests.test_init
|
||||
|
||||
- name: "Python 3.8 Tests"
|
||||
python: 3.8
|
||||
env: TEST=bench
|
||||
script: python -m unittest -v bench.tests.test_utils && python -m unittest -v bench.tests.test_init
|
||||
|
||||
- name: "Python 3.9 Tests"
|
||||
python: 3.9
|
||||
- name: "Python 3.10 Tests"
|
||||
python: "3.10"
|
||||
env: TEST=bench
|
||||
script: python -m unittest -v bench.tests.test_utils && python -m unittest -v bench.tests.test_init
|
||||
|
||||
install:
|
||||
- pip3 install urllib3 pyOpenSSL ndg-httpsclient pyasn1
|
||||
- python -m pip install -U --no-cache-dir --force-reinstall urllib3 pyOpenSSL ndg-httpsclient pyasn1 wheel setuptools pip
|
||||
|
||||
- if [ $TEST == "bench" ];then
|
||||
wget -q -O /tmp/wkhtmltox.tar.xz https://github.com/frappe/wkhtmltopdf/raw/master/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz;
|
||||
tar -xf /tmp/wkhtmltox.tar.xz -C /tmp;
|
||||
sudo mv /tmp/wkhtmltox/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf;
|
||||
sudo chmod o+x /usr/local/bin/wkhtmltopdf;
|
||||
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb;
|
||||
sudo apt install ./wkhtmltox_0.12.6-1.focal_amd64.deb;
|
||||
|
||||
nvm install 14;
|
||||
nvm use 14;
|
||||
|
||||
mkdir -p ~/.bench;
|
||||
cp -r $TRAVIS_BUILD_DIR/* ~/.bench;
|
||||
pip3 install -q -U -e ~/.bench;
|
||||
python -m pip install -U -e ~/.bench;
|
||||
|
||||
mysql -u root -e "SET GLOBAL character_set_server = 'utf8mb4'";
|
||||
mysql -u root -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'";
|
||||
|
@ -17,10 +17,10 @@ PYTHON_VER = sys.version_info
|
||||
|
||||
FRAPPE_BRANCH = "version-12"
|
||||
if PYTHON_VER.major == 3:
|
||||
if PYTHON_VER.minor in [6, 7]:
|
||||
FRAPPE_BRANCH = "version-13"
|
||||
else:
|
||||
if PYTHON_VER.minor >= 10:
|
||||
FRAPPE_BRANCH = "develop"
|
||||
if 7 >= PYTHON_VER.minor >= 9:
|
||||
FRAPPE_BRANCH = "version-13"
|
||||
|
||||
|
||||
class TestBenchBase(unittest.TestCase):
|
||||
@ -134,5 +134,4 @@ class TestBenchBase(unittest.TestCase):
|
||||
def get_traceback(self):
|
||||
exc_type, exc_value, exc_tb = sys.exc_info()
|
||||
trace_list = traceback.format_exception(exc_type, exc_value, exc_tb)
|
||||
body = "".join(str(t) for t in trace_list)
|
||||
return body
|
||||
return "".join(str(t) for t in trace_list)
|
||||
|
@ -106,6 +106,7 @@ class TestBenchInit(TestBenchBase):
|
||||
).decode("utf8")
|
||||
self.assertTrue(app_installed_in_env)
|
||||
|
||||
@unittest.skipIf(FRAPPE_BRANCH != "develop", "only for develop branch")
|
||||
def test_get_app_resolve_deps(self):
|
||||
FRAPPE_APP = "healthcare"
|
||||
self.init_bench("test-bench")
|
||||
@ -184,15 +185,15 @@ class TestBenchInit(TestBenchBase):
|
||||
successful_switch = not exec_cmd(
|
||||
f"bench switch-to-branch {prevoius_branch} frappe --upgrade", cwd=bench_path
|
||||
)
|
||||
app_branch_after_switch = str(git.Repo(path=app_path).active_branch)
|
||||
if successful_switch:
|
||||
app_branch_after_switch = str(git.Repo(path=app_path).active_branch)
|
||||
self.assertEqual(prevoius_branch, app_branch_after_switch)
|
||||
|
||||
successful_switch = not exec_cmd(
|
||||
f"bench switch-to-branch {FRAPPE_BRANCH} frappe --upgrade", cwd=bench_path
|
||||
)
|
||||
app_branch_after_second_switch = str(git.Repo(path=app_path).active_branch)
|
||||
if successful_switch:
|
||||
app_branch_after_second_switch = str(git.Repo(path=app_path).active_branch)
|
||||
self.assertEqual(FRAPPE_BRANCH, app_branch_after_second_switch)
|
||||
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
# imports - standard imports
|
||||
import getpass
|
||||
import os
|
||||
import pathlib
|
||||
import re
|
||||
import subprocess
|
||||
import time
|
||||
@ -76,9 +77,7 @@ class TestSetupProduction(TestBenchBase):
|
||||
if os.environ.get("CI"):
|
||||
sudoers = subprocess.check_output(["sudo", "cat", sudoers_file]).decode("utf-8")
|
||||
else:
|
||||
with open(sudoers_file) as f:
|
||||
sudoers = f.read()
|
||||
|
||||
sudoers = pathlib.Path(sudoers_file).read_text()
|
||||
self.assertTrue(f"{user} ALL = (root) NOPASSWD: {service} nginx *" in sudoers)
|
||||
self.assertTrue(f"{user} ALL = (root) NOPASSWD: {nginx}" in sudoers)
|
||||
|
||||
|
57
pyproject.toml
Normal file
57
pyproject.toml
Normal file
@ -0,0 +1,57 @@
|
||||
[project]
|
||||
name = "frappe-bench"
|
||||
description = "CLI to manage Multi-tenant deployments for Frappe apps"
|
||||
readme = "README.md"
|
||||
license = "GPL-3.0-only"
|
||||
requires-python = ">=3.7"
|
||||
authors = [
|
||||
{ name = "Frappe Technologies Pvt Ltd", email = "developers@frappe.io" },
|
||||
]
|
||||
classifiers = [
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Environment :: Console",
|
||||
"License :: OSI Approved :: GNU Affero General Public License v3",
|
||||
"Natural Language :: English",
|
||||
"Operating System :: MacOS",
|
||||
"Operating System :: OS Independent",
|
||||
"Topic :: Software Development :: Build Tools",
|
||||
"Topic :: Software Development :: User Interfaces",
|
||||
"Topic :: System :: Installation/Setup",
|
||||
]
|
||||
dependencies = [
|
||||
"Click>=7.0",
|
||||
"GitPython~=2.1.15",
|
||||
"honcho",
|
||||
"Jinja2~=3.0.3",
|
||||
"python-crontab~=2.6.0",
|
||||
"requests",
|
||||
"semantic-version~=2.8.2",
|
||||
"setuptools>40.9.0",
|
||||
"tomli;python_version<'3.11'",
|
||||
]
|
||||
dynamic = [
|
||||
"version",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
bench = "bench.cli:cli"
|
||||
|
||||
[project.urls]
|
||||
Changelog = "https://github.com/frappe/bench/releases"
|
||||
Documentation = "https://frappeframework.com/docs/user/en/bench"
|
||||
Homepage = "https://frappe.io/bench"
|
||||
Source = "https://github.com/frappe/bench"
|
||||
|
||||
[build-system]
|
||||
requires = [
|
||||
"hatchling>=1.6.0",
|
||||
]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[tool.hatch.version]
|
||||
path = "bench/__init__.py"
|
||||
|
||||
[tool.hatch.build.targets.sdist]
|
||||
include = [
|
||||
"/bench",
|
||||
]
|
@ -1,9 +0,0 @@
|
||||
Click>=7.0
|
||||
GitPython~=2.1.15
|
||||
honcho
|
||||
Jinja2~=3.0.3
|
||||
python-crontab~=2.4.0
|
||||
requests
|
||||
semantic-version~=2.8.2
|
||||
setuptools
|
||||
tomli;python_version<"3.11"
|
42
setup.py
42
setup.py
@ -1,42 +0,0 @@
|
||||
import pathlib
|
||||
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
from bench import PROJECT_NAME, VERSION
|
||||
|
||||
install_requires = pathlib.Path("requirements.txt").read_text().strip().split("\n")
|
||||
long_description = pathlib.Path("README.md").read_text()
|
||||
|
||||
setup(
|
||||
name=PROJECT_NAME,
|
||||
description="CLI to manage Multi-tenant deployments for Frappe apps",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
version=VERSION,
|
||||
license="GPLv3",
|
||||
author="Frappe Technologies Pvt Ltd",
|
||||
author_email="developers@frappe.io",
|
||||
url="https://frappe.io/bench",
|
||||
project_urls={
|
||||
"Documentation": "https://frappeframework.com/docs/user/en/bench",
|
||||
"Source": "https://github.com/frappe/bench",
|
||||
"Changelog": "https://github.com/frappe/bench/releases",
|
||||
},
|
||||
classifiers=[
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Environment :: Console",
|
||||
"License :: OSI Approved :: GNU Affero General Public License v3",
|
||||
"Natural Language :: English",
|
||||
"Operating System :: MacOS",
|
||||
"Operating System :: OS Independent",
|
||||
"Topic :: Software Development :: Build Tools",
|
||||
"Topic :: Software Development :: User Interfaces",
|
||||
"Topic :: System :: Installation/Setup",
|
||||
],
|
||||
packages=find_packages(),
|
||||
python_requires=">=3.7",
|
||||
zip_safe=False,
|
||||
include_package_data=True,
|
||||
install_requires=install_requires,
|
||||
entry_points={"console_scripts": ["bench=bench.cli:cli"]},
|
||||
)
|
Loading…
Reference in New Issue
Block a user