Skip to content

Commit

Permalink
handle package creation with plonecli
Browse files Browse the repository at this point in the history
  • Loading branch information
erral committed Apr 22, 2024
1 parent a3cdb43 commit 812bbc9
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
27 changes: 23 additions & 4 deletions hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,32 @@ def clean_up_backend_tests():
sys.exit(1)


def prepare_backend():
def prepare_backend(python_package_name):
"""Apply black and isort to the generated codebase."""
print("Backend codebase")
# Clean up unused test folders
clean_up_backend_tests()
steps = [
["Format generated code in the backend", ["make", "format"], False, "backend"]
[
"Create python package using plonecli",
[
"pipx run plonecli create --bobconfig=src/.mrbob.ini addon "
f" src/{python_package_name}"
],
True,
"backend",
],
[
"Use the plone_site_initialization template in plonecli to create"
" some defaults",
[
"pipx run plonecli add --bobconfig=../.mrbob.ini"
" site_initialization",
],
True,
f"backend/src/{python_package_name}",
],
["Format generated code in the backend", ["make", "format"], False, "backend"],
]
for step in steps:
msg, command, shell, cwd = step
Expand All @@ -283,7 +302,7 @@ def prepare_backend():
volto_generator_version = "{{ cookiecutter.volto_generator_version }}"
volto_addon_name = "{{ cookiecutter.volto_addon_name }}"
description = "{{ cookiecutter.description }}"

python_package_name = "{{ cookiecutter.python_package_name }}"

def main():
"""Final fixes."""
Expand All @@ -298,7 +317,7 @@ def main():
)
print("")
# Setup backend
prepare_backend()
prepare_backend(python_package_name=python_package_name)
print("")
print(f"{MSG_DELIMITER}")
msg = dedent(
Expand Down
17 changes: 17 additions & 0 deletions {{ cookiecutter.project_slug }}/backend/src/.mrbob.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[mr.bob]
verbose = True

[variables]
author.name = {{ cookiecutter.author }}
author.email = {{ cookiecutter.email }}
author.github.user = {{ cookiecutter.github_organization }}
package.description = {{ cookiecutter.description }}
package.git.init = n
package.git.disabled = y

plone.version = {{ cookiecutter.plone_version }}
python.version = 3.10
vscode_support = n

language = {{ cookiecutter.language_code }}
site_name = {{ cookiecutter.project_title }}

0 comments on commit 812bbc9

Please sign in to comment.