Fixes in install_module
This commit is contained in:
parent
5e98ed5289
commit
a8274d74fa
2 changed files with 39 additions and 5 deletions
|
|
@ -126,7 +126,6 @@ class I18n:
|
||||||
Method for get a string from selected language but object oriented and using module and symbol by default
|
Method for get a string from selected language but object oriented and using module and symbol by default
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
symbol (str): The symbol used for identify the text string.
|
|
||||||
text_default (str): The text default used. You have use how base for translations.
|
text_default (str): The text default used. You have use how base for translations.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
@ -158,7 +157,6 @@ class I18n:
|
||||||
Method for get a string from selected language but object oriented and using module and symbol by default
|
Method for get a string from selected language but object oriented and using module and symbol by default
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
symbol (str): The symbol used for identify the text string.
|
|
||||||
text_default (str): The text default used. You have use how base for translations.
|
text_default (str): The text default used. You have use how base for translations.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,12 +48,48 @@ def start():
|
||||||
if not e.name in config.apps:
|
if not e.name in config.apps:
|
||||||
#print(e.name)
|
#print(e.name)
|
||||||
if args.git_url.find(e.name)!=-1:
|
if args.git_url.find(e.name)!=-1:
|
||||||
real_path=e.name
|
real_path=os.path.basename(e.name)
|
||||||
|
|
||||||
# Add to json configuration.
|
# Add dependencies using pip
|
||||||
|
|
||||||
os.chdir('../')
|
os.chdir('../')
|
||||||
|
|
||||||
|
dependencies_file='./modules/{}/dependencies.json'.format(real_path)
|
||||||
|
|
||||||
|
if os.path.isfile(dependencies_file):
|
||||||
|
#print('install dependencies')
|
||||||
|
dep_json=[]
|
||||||
|
|
||||||
|
with open(dependencies_file) as f:
|
||||||
|
|
||||||
|
content=f.read()
|
||||||
|
|
||||||
|
try:
|
||||||
|
dep_json=json.loads(content)
|
||||||
|
except:
|
||||||
|
dep_json=[]
|
||||||
|
print('Error: cannot install dependencies for the package. Malformed json {}'.format(content))
|
||||||
|
|
||||||
|
if len(dep_json)>0:
|
||||||
|
if 'packages' in dep_json:
|
||||||
|
print('Install dependencies for the module...')
|
||||||
|
arr_packages=" ".join(dep_json['packages'])
|
||||||
|
if subprocess.call("pip install {}".format(arr_packages), shell=True) > 0:
|
||||||
|
print('Error, cannot install the pip libraries. Do you have installed pip?.')
|
||||||
|
|
||||||
|
if 'models' in dep_json:
|
||||||
|
print('Creating database tables from models in module...')
|
||||||
|
for model in dep_json['models']:
|
||||||
|
if subprocess.call("paramecio2db --model modules/{}/models/{}.py".format(real_path, model), shell=True) > 0:
|
||||||
|
|
||||||
|
print('Error, cannot install the model {}.'.format(model))
|
||||||
|
|
||||||
|
#print(real_path)
|
||||||
|
|
||||||
|
#
|
||||||
|
|
||||||
|
# Add to json configuration.
|
||||||
|
|
||||||
if real_path!='':
|
if real_path!='':
|
||||||
|
|
||||||
if os.path.isfile('settings/modules.json'):
|
if os.path.isfile('settings/modules.json'):
|
||||||
|
|
@ -61,7 +97,7 @@ def start():
|
||||||
modules_json={}
|
modules_json={}
|
||||||
|
|
||||||
with open('settings/modules.json') as f:
|
with open('settings/modules.json') as f:
|
||||||
|
print('Inserting new module in modules.json...')
|
||||||
#apps={'monit2': ['modules.monit2', 'monit2_app', '/'], 'welcome': ['paramecio2.modules.welcome', 'welcome_app', '/'], 'pastafari2': ['modules.pastafari2', 'pastafari_app', '/'], 'apache': ['modules.apache', 'apache_app', '/'], 'mariadb': ['modules.mariadb', 'mariadb_app', '/'], 'apiv1': ['modules.apiv1', 'apiv1_app', '/'], 'admin': ['paramecio2.modules.admin', 'admin_app', '/']}
|
#apps={'monit2': ['modules.monit2', 'monit2_app', '/'], 'welcome': ['paramecio2.modules.welcome', 'welcome_app', '/'], 'pastafari2': ['modules.pastafari2', 'pastafari_app', '/'], 'apache': ['modules.apache', 'apache_app', '/'], 'mariadb': ['modules.mariadb', 'mariadb_app', '/'], 'apiv1': ['modules.apiv1', 'apiv1_app', '/'], 'admin': ['paramecio2.modules.admin', 'admin_app', '/']}
|
||||||
|
|
||||||
json_text=f.read()
|
json_text=f.read()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue