Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove subprocess call from create_instance #1818

Merged
merged 1 commit into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/moin/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def _Help():


cli.add_command(create_instance.cli_CreateInstance)
cli.add_command(create_instance.cli_BuildInstance)

cli.add_command(index.cli_IndexCreate)
cli.add_command(index.IndexBuild)
Expand Down
16 changes: 7 additions & 9 deletions src/moin/cli/maint/create_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

import os
import shutil
import subprocess
import click

from flask.cli import FlaskGroup
Expand Down Expand Up @@ -66,10 +65,14 @@ def CreateInstance(full, **kwargs):
"""
Create wikiconfig and wiki instance directories and copy required files.
"""
path = kwargs.get("path", None)
if full and path:
logging.error("The parameter full and path are mutually exclusive.")
return False
logging.debug("Instance creation started.")
config_path = os.path.dirname(config.__file__)
contrib_path = os.path.dirname(contrib.__file__)
path = kwargs.get("path", None)

if not path:
path = os.getcwd()
if os.path.exists(path):
Expand All @@ -93,19 +96,14 @@ def CreateInstance(full, **kwargs):
logging.info("Instance creation finished.")

if full:
if path != os.getcwd():
os.chdir(path)
subprocess.call("moin build-instance", shell=True)
build_instance()


@cli.command("build-instance", hidden=True)
def cli_BuildInstance():
def build_instance():
"""
Create and build index, load help data and welcome page.
This command is hidden in help. For internal use in "create-instance --full" only!
"""
logging.info("Build Instance started.")
logging.debug("CWD: %s", os.getcwd())
if index.IndexCreate():
modify_item.LoadHelp(namespace="help-en", path_to_help=None)
modify_item.LoadHelp(namespace="help-common", path_to_help=None)
Expand Down
Loading