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

fix: add playbooks in the python package

This commit is contained in:
Gavin D'souza 2020-05-01 17:49:11 +05:30
parent e791410a31
commit 78e1f03cc4
87 changed files with 10 additions and 6 deletions

View File

@ -359,7 +359,7 @@ def run_playbook(playbook_name, sudo=False, extra_vars=None):
else: else:
cwd = os.path.join(os.path.expanduser('~'), 'bench') cwd = os.path.join(os.path.expanduser('~'), 'bench')
success = subprocess.check_call(args, cwd=os.path.join(cwd, 'playbooks'), stdout=log_stream, stderr=sys.stderr) success = subprocess.check_call(args, cwd=os.path.join(cwd, 'bench', 'playbooks'), stdout=log_stream, stderr=sys.stderr)
return success return success

View File

@ -961,7 +961,7 @@ def run_playbook(playbook_name, extra_vars=None, tag=None):
if tag: if tag:
args.extend(['-t', tag]) args.extend(['-t', tag])
subprocess.check_call(args, cwd=os.path.join(os.path.dirname(bench.__path__[0]), 'playbooks')) subprocess.check_call(args, cwd=os.path.join(bench.__path__[0], 'playbooks'))
def find_benches(directory=None): def find_benches(directory=None):

View File

@ -1,13 +1,16 @@
from setuptools import setup, find_packages import ast
import re, ast import os
import re
# get version from __version__ variable in bench/__init__.py from setuptools import find_packages, setup
_version_re = re.compile(r'__version__\s+=\s+(.*)')
playbooks_files = [os.path.join(dp, f) for dp, dn, filenames in os.walk("playbooks") for f in filenames]
with open('requirements.txt') as f: with open('requirements.txt') as f:
install_requires = f.read().strip().split('\n') install_requires = f.read().strip().split('\n')
with open('bench/__init__.py', 'rb') as f: with open('bench/__init__.py', 'rb') as f:
_version_re = re.compile(r'__version__\s+=\s+(.*)')
version = str(ast.literal_eval(_version_re.search( version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1))) f.read().decode('utf-8')).group(1)))
@ -21,6 +24,7 @@ setup(
zip_safe=False, zip_safe=False,
include_package_data=True, include_package_data=True,
install_requires=install_requires, install_requires=install_requires,
package_data={ 'bench': playbooks_files },
entry_points=''' entry_points='''
[console_scripts] [console_scripts]
bench=bench.cli:cli bench=bench.cli:cli