diff --git a/backend_addon/cookiecutter.json b/backend_addon/cookiecutter.json index 88fa36f..6145b4c 100644 --- a/backend_addon/cookiecutter.json +++ b/backend_addon/cookiecutter.json @@ -10,8 +10,8 @@ "feature_headless": ["1", "0"], "__feature_headless": "{{ cookiecutter.feature_headless }}", "__feature_distribution": "0", - "__package_name": "{{ cookiecutter.python_package_name | package_name }}", - "__package_namespace": "{{ cookiecutter.python_package_name | package_namespace }}", + "__package_namespaces": "{{ cookiecutter.python_package_name | package_namespaces }}", + "__package_path": "{{ cookiecutter.python_package_name | package_path }}", "__folder_name": "{{ cookiecutter.python_package_name }}", "__python_package_name_upper": "{{ cookiecutter.python_package_name | pascal_case }}", "__profile_language": "en", @@ -41,8 +41,8 @@ "cookieplone.filters.latest_plone", "cookieplone.filters.use_prerelease_versions", "cookieplone.filters.pascal_case", - "cookieplone.filters.package_name", - "cookieplone.filters.package_namespace" + "cookieplone.filters.package_namespaces", + "cookieplone.filters.package_path" ], "__cookieplone_repository_path": "", "__cookieplone_template": "" diff --git a/backend_addon/hooks/post_gen_project.py b/backend_addon/hooks/post_gen_project.py index 98bd59d..ee31c55 100644 --- a/backend_addon/hooks/post_gen_project.py +++ b/backend_addon/hooks/post_gen_project.py @@ -1,9 +1,11 @@ """Post generation hook.""" +import os from collections import OrderedDict from copy import deepcopy from pathlib import Path +from cookieplone.settings import QUIET_MODE_VAR from cookieplone.utils import console, files, git, plone context: OrderedDict = {{cookiecutter}} @@ -18,12 +20,20 @@ def handle_feature_headless(context: OrderedDict, output_dir: Path): - package_namespace = context.get("__package_namespace") - package_name = context.get("__package_name") - output_dir = output_dir / "src" / package_namespace / package_name + output_dir = output_dir / "src" / "packagename" files.remove_files(output_dir, FEATURES_TO_REMOVE["feature_headless"]) +def handle_create_namespace_packages(context: OrderedDict, output_dir: Path): + plone.create_namespace_packages( + output_dir / "src/packagename", context["python_package_name"] + ) + + +def handle_format(context: OrderedDict, output_dir: Path): + plone.format_python_codebase(output_dir) + + def handle_git_initialization(context: OrderedDict, output_dir: Path): """Initialize a GIT repository for the project codebase.""" git.initialize_repository(output_dir) @@ -32,9 +42,11 @@ def handle_git_initialization(context: OrderedDict, output_dir: Path): def main(): """Final fixes.""" output_dir = Path().cwd() + is_subtemplate = os.environ.get(QUIET_MODE_VAR) == "1" remove_headless = not int( context.get("feature_headless") ) # {{ cookiecutter.__feature_headless }} + create_namespace_packages = not is_subtemplate initialize_git = bool( int(context.get("__backend_addon_git_initialize")) ) # {{ cookiecutter.__backend_addon_git_initialize }} @@ -48,6 +60,16 @@ def main(): "Remove files used in headless setup", remove_headless, ], + [ + handle_create_namespace_packages, + "Create namespace packages", + create_namespace_packages, + ], + [ + handle_format, + "Format code", + backend_format, + ], [ handle_git_initialization, "Initialize Git repository", @@ -61,18 +83,10 @@ def main(): console.print(f" -> {title}") func(new_context, output_dir) - # Run format - if backend_format: - plone.format_python_codebase(output_dir) - msg = """ [bold blue]{{ cookiecutter.title }}[/bold blue] - Now, enter the repository run the code formatter with: - - make format - - start coding, and push to your organization. + Now, enter the repository, start coding, and push to your organization. Sorry for the convenience, The Plone Community. diff --git a/backend_addon/hooks/pre_prompt.py b/backend_addon/hooks/pre_prompt.py index 964f158..c614b99 100644 --- a/backend_addon/hooks/pre_prompt.py +++ b/backend_addon/hooks/pre_prompt.py @@ -3,12 +3,13 @@ import sys try: + from cookieplone import __version__ as cookieplone_version from cookieplone import data from cookieplone.utils import commands, console, sanity - - HAS_COOKIEPLONE = True except ModuleNotFoundError: - HAS_COOKIEPLONE = False + print("This template should be run with cookieplone") + sys.exit(1) +from packaging.version import Version SUPPORTED_PYTHON_VERSIONS = [ @@ -23,6 +24,16 @@ def sanity_check() -> data.SanityCheckResults: """Run sanity checks on the system.""" checks = [ + data.SanityCheck( + "Cookieplone", + lambda: ( + "" + if Version(cookieplone_version) > Version("0.8.0.dev0") + else "This template requires Cookieplone 0.8 or higher." + ), + [], + "error", + ), data.SanityCheck( "Python", commands.check_python_version, @@ -36,9 +47,6 @@ def sanity_check() -> data.SanityCheckResults: def main(): """Validate context.""" - if not HAS_COOKIEPLONE: - print("This template should be run with cookieplone") - sys.exit(1) msg = """ Creating a new Plone Addon diff --git a/backend_addon/tests/test_cutter.py b/backend_addon/tests/test_cutter.py index f4c2123..c49ac1e 100644 --- a/backend_addon/tests/test_cutter.py +++ b/backend_addon/tests/test_cutter.py @@ -1,5 +1,6 @@ """Test cookiecutter generation with all features enabled.""" +from copy import deepcopy from pathlib import Path import pytest @@ -40,10 +41,8 @@ def test_root_files_generated(cutter_result, file_path): @pytest.mark.parametrize("file_path", PKG_SRC_FILES) def test_pkg_src_files_generated(cutter_result, file_path: str): """Check if distribution files were generated.""" - package_namespace = cutter_result.context["__package_namespace"] - package_name = cutter_result.context["__package_name"] - file_path = file_path.format(package_name=package_name) - src_path = cutter_result.project_path / "src" / package_namespace / package_name + package_path = cutter_result.context["__package_path"] + src_path = cutter_result.project_path / "src" / package_path path = src_path / file_path assert path.exists() assert path.is_file() @@ -52,9 +51,8 @@ def test_pkg_src_files_generated(cutter_result, file_path: str): @pytest.mark.parametrize("file_path", PKG_SRC_FEATURE_HEADLESS) def test_pkg_src_feature_files_generated(cutter_result, file_path: str): """Check if feature-specific files were generated.""" - package_namespace = cutter_result.context["__package_namespace"] - package_name = cutter_result.context["__package_name"] - src_path = cutter_result.project_path / "src" / package_namespace / package_name + package_path = cutter_result.context["__package_path"] + src_path = cutter_result.project_path / "src" / package_path path = src_path / file_path assert path.exists() assert path.is_file() @@ -89,3 +87,41 @@ def test_git_initialization_not_set(cookies, context_no_git): cutter_result = cookies.bake(extra_context=context_no_git) path = cutter_result.project_path assert git.check_path_is_repository(path) is False + + +@pytest.fixture(scope="session") +def cutter_result_no_namespace(context, cookies_session) -> dict: + """Cookiecutter context without namespace package.""" + new_context = deepcopy(context) + new_context["python_package_name"] = "addon" + return cookies_session.bake(extra_context=new_context) + + +@pytest.fixture(scope="session") +def cutter_result_two_namespaces(context, cookies_session) -> dict: + """Cookiecutter context with 2 namespace packages.""" + new_context = deepcopy(context) + new_context["python_package_name"] = "foo.bar.baz" + return cookies_session.bake(extra_context=new_context) + + +@pytest.mark.parametrize("file_path", PKG_SRC_FILES) +def test_pkg_src_files_generated_without_namespace( + cutter_result_no_namespace, file_path: str +): + """Check package contents with no namespaces.""" + src_path = cutter_result_no_namespace.project_path / "src/addon" + path = src_path / file_path + assert path.exists() + assert path.is_file() + + +@pytest.mark.parametrize("file_path", PKG_SRC_FILES) +def test_pkg_src_files_generated_with_two_namespaces( + cutter_result_two_namespaces, file_path: str +): + """Check package contents with 2 namespaces.""" + src_path = cutter_result_two_namespaces.project_path / "src/foo/bar/baz" + path = src_path / file_path + assert path.exists() + assert path.is_file() diff --git a/backend_addon/tests/test_cutter_no_headless.py b/backend_addon/tests/test_cutter_no_headless.py index 0e5ab54..0295b21 100644 --- a/backend_addon/tests/test_cutter_no_headless.py +++ b/backend_addon/tests/test_cutter_no_headless.py @@ -44,10 +44,8 @@ def test_root_files_generated(cutter_result, file_path): @pytest.mark.parametrize("file_path", PKG_SRC_FILES) def test_pkg_src_files_generated(cutter_result, file_path: str): """Check if distribution files were generated.""" - package_namespace = cutter_result.context["__package_namespace"] - package_name = cutter_result.context["__package_name"] - file_path = file_path.format(package_name=package_name) - src_path = cutter_result.project_path / "src" / package_namespace / package_name + package_path = cutter_result.context["__package_path"] + src_path = cutter_result.project_path / "src" / package_path path = src_path / file_path assert path.exists() assert path.is_file() @@ -56,8 +54,7 @@ def test_pkg_src_files_generated(cutter_result, file_path: str): @pytest.mark.parametrize("file_path", PKG_SRC_FEATURE_HEADLESS) def test_pkg_src_headless_files_not_generated(cutter_result, file_path: str): """Check feature-specific files were not generated.""" - package_namespace = cutter_result.context["__package_namespace"] - package_name = cutter_result.context["__package_name"] - src_path = cutter_result.project_path / "src" / package_namespace / package_name + package_path = cutter_result.context["__package_path"] + src_path = cutter_result.project_path / "src" / package_path path = src_path / file_path assert path.exists() is False diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/MANIFEST.in b/backend_addon/{{ cookiecutter.__folder_name }}/MANIFEST.in index 3123abd..0cf7171 100644 --- a/backend_addon/{{ cookiecutter.__folder_name }}/MANIFEST.in +++ b/backend_addon/{{ cookiecutter.__folder_name }}/MANIFEST.in @@ -1,4 +1,4 @@ -graft src/{{ cookiecutter.__package_namespace }} +graft src/{{ cookiecutter.__package_path }} graft docs graft news graft tests diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/setup.py b/backend_addon/{{ cookiecutter.__folder_name }}/setup.py index 2c8828f..506341f 100644 --- a/backend_addon/{{ cookiecutter.__folder_name }}/setup.py +++ b/backend_addon/{{ cookiecutter.__folder_name }}/setup.py @@ -47,7 +47,7 @@ }, license="GPL version 2", packages=find_packages("src", exclude=["ez_setup"]), - namespace_packages=["{{ cookiecutter.__package_namespace }}"], + namespace_packages=[{{ cookiecutter.__package_namespaces }}], package_dir={"": "src"}, include_package_data=True, zip_safe=False, diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/__init__.py b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/__init__.py similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/__init__.py rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/__init__.py diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/configure.zcml b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/configure.zcml similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/configure.zcml rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/configure.zcml diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/content/__init__.py b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/content/__init__.py similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/content/__init__.py rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/content/__init__.py diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/controlpanel/__init__.py b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/controlpanel/__init__.py similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/controlpanel/__init__.py rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/controlpanel/__init__.py diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/controlpanel/configure.zcml b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/controlpanel/configure.zcml similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/controlpanel/configure.zcml rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/controlpanel/configure.zcml diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/dependencies.zcml b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/dependencies.zcml similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/dependencies.zcml rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/dependencies.zcml diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/indexers/__init__.py b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/indexers/__init__.py similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/indexers/__init__.py rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/indexers/__init__.py diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/indexers/configure.zcml b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/indexers/configure.zcml similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/indexers/configure.zcml rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/indexers/configure.zcml diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/interfaces.py b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/interfaces.py similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/interfaces.py rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/interfaces.py diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/locales/__init__.py b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/locales/__init__.py similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/locales/__init__.py rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/locales/__init__.py diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/locales/en/LC_MESSAGES/{{ cookiecutter.python_package_name }}.po b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/locales/en/LC_MESSAGES/{{ cookiecutter.python_package_name }}.po similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/locales/en/LC_MESSAGES/{{ cookiecutter.python_package_name }}.po rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/locales/en/LC_MESSAGES/{{ cookiecutter.python_package_name }}.po diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/locales/update.py b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/locales/update.py similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/locales/update.py rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/locales/update.py diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/locales/{{ cookiecutter.python_package_name }}.pot b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/locales/{{ cookiecutter.python_package_name }}.pot similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/locales/{{ cookiecutter.python_package_name }}.pot rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/locales/{{ cookiecutter.python_package_name }}.pot diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles.zcml b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles.zcml similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles.zcml rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles.zcml diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/browserlayer.xml b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles/default/browserlayer.xml similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/browserlayer.xml rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles/default/browserlayer.xml diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/catalog.xml b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles/default/catalog.xml similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/catalog.xml rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles/default/catalog.xml diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/controlpanel.xml b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles/default/controlpanel.xml similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/controlpanel.xml rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles/default/controlpanel.xml diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/diff_tool.xml b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles/default/diff_tool.xml similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/diff_tool.xml rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles/default/diff_tool.xml diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/metadata.xml b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles/default/metadata.xml similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/metadata.xml rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles/default/metadata.xml diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/registry/.gitkeep b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles/default/registry/.gitkeep similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/registry/.gitkeep rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles/default/registry/.gitkeep diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/repositorytool.xml b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles/default/repositorytool.xml similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/repositorytool.xml rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles/default/repositorytool.xml diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/rolemap.xml b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles/default/rolemap.xml similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/rolemap.xml rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles/default/rolemap.xml diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/theme.xml b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles/default/theme.xml similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/theme.xml rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles/default/theme.xml diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/types.xml b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles/default/types.xml similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/types.xml rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles/default/types.xml diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/types/.gitkeep b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles/default/types/.gitkeep similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/types/.gitkeep rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles/default/types/.gitkeep diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/uninstall/browserlayer.xml b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles/uninstall/browserlayer.xml similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/uninstall/browserlayer.xml rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/profiles/uninstall/browserlayer.xml diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/serializers/__init__.py b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/serializers/__init__.py similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/serializers/__init__.py rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/serializers/__init__.py diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/serializers/configure.zcml b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/serializers/configure.zcml similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/serializers/configure.zcml rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/serializers/configure.zcml diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/serializers/summary.py b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/serializers/summary.py similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/serializers/summary.py rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/serializers/summary.py diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/__init__.py b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/setuphandlers/__init__.py similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/__init__.py rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/setuphandlers/__init__.py diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/testing.py b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/testing.py similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/testing.py rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/testing.py diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/upgrades/__init__.py b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/upgrades/__init__.py similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/upgrades/__init__.py rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/upgrades/__init__.py diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/upgrades/configure.zcml b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/upgrades/configure.zcml similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/upgrades/configure.zcml rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/upgrades/configure.zcml diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/vocabularies/__init__.py b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/vocabularies/__init__.py similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/vocabularies/__init__.py rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/vocabularies/__init__.py diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/vocabularies/configure.zcml b/backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/vocabularies/configure.zcml similarity index 100% rename from backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/vocabularies/configure.zcml rename to backend_addon/{{ cookiecutter.__folder_name }}/src/packagename/vocabularies/configure.zcml diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/__init__.py b/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/__init__.py deleted file mode 100644 index 5284146..0000000 --- a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__import__("pkg_resources").declare_namespace(__name__) diff --git a/frontend_addon/tests/test_cutter.py b/frontend_addon/tests/test_cutter.py index 22cc7a2..26aff5c 100644 --- a/frontend_addon/tests/test_cutter.py +++ b/frontend_addon/tests/test_cutter.py @@ -91,7 +91,6 @@ def test_root_files_generated(cutter_result, file_path): def test_pkg_src_files_generated(cutter_result, file_path: str): """Check if package files were generated.""" package_name = cutter_result.context["frontend_addon_name"] - file_path = file_path.format(package_name=package_name) src_path = cutter_result.project_path / "packages" / package_name path = src_path / file_path assert path.exists() diff --git a/project/cookiecutter.json b/project/cookiecutter.json index 615acb3..dbe93d3 100644 --- a/project/cookiecutter.json +++ b/project/cookiecutter.json @@ -12,23 +12,10 @@ "frontend_addon_name": "volto-{{ cookiecutter.python_package_name|replace('_', '-')|replace('.', '-') }}", "language_code": ["en", "de", "es", "pt-br", "nl", "fi"], "github_organization": "collective", - "container_registry": [ - "github", - "docker_hub", - "gitlab" - ], - "devops_cache": [ - "1", - "0" - ], - "devops_ansible": [ - "1", - "0" - ], - "devops_gha_deploy": [ - "1", - "0" - ], + "container_registry": ["github", "docker_hub", "gitlab"], + "devops_cache": ["1", "0"], + "devops_ansible": ["1", "0"], + "devops_gha_deploy": ["1", "0"], "__feature_headless": "1", "__npm_package_name": "{{ cookiecutter.frontend_addon_name }}", "__folder_name": "{{ cookiecutter.project_slug }}", @@ -67,8 +54,8 @@ "__devops_varnish_version": "7.6", "__devops_db_version": "14", "__devops_db_password": "{{ random_ascii_string(12) }}", - "__backend_addon_format": "1", "__backend_addon_git_initialize": "0", + "__backend_addon_format": "1", "__project_git_initialize": "1", "__prompts__": { "title": "Project Title", @@ -120,7 +107,6 @@ "devops/requirements", "devops/tasks", "devops/inventory/group_vars/all/users.yml" - ], "_extensions": [ "cookieplone.filters.use_prerelease_versions", diff --git a/project/hooks/post_gen_project.py b/project/hooks/post_gen_project.py index 818e8c4..7cdef06 100644 --- a/project/hooks/post_gen_project.py +++ b/project/hooks/post_gen_project.py @@ -145,6 +145,11 @@ def main(): console.print(f" -> {title}") func(new_context, output_dir) + # Create namespace packages + plone.create_namespace_packages( + output_dir / "backend/src/packagename", context["python_package_name"] + ) + # Run format if backend_format: backend_folder = output_dir / "backend" diff --git a/project/hooks/pre_prompt.py b/project/hooks/pre_prompt.py index d904d7c..a2eb40a 100644 --- a/project/hooks/pre_prompt.py +++ b/project/hooks/pre_prompt.py @@ -2,10 +2,14 @@ import sys -from cookieplone import data -from cookieplone.utils import commands, console, sanity - -HAS_COOKIEPLONE = True +try: + from cookieplone import __version__ as cookieplone_version + from cookieplone import data + from cookieplone.utils import commands, console, sanity +except ModuleNotFoundError: + print("This template should be run with cookieplone") + sys.exit(1) +from packaging.version import Version SUPPORTED_PYTHON_VERSIONS = [ "3.8", @@ -19,6 +23,16 @@ def sanity_check() -> data.SanityCheckResults: """Run sanity checks on the system.""" checks = [ + data.SanityCheck( + "Cookieplone", + lambda: ( + "" + if Version(cookieplone_version) > Version("0.8.0.dev0") + else "This template requires Cookieplone 0.8 or higher." + ), + [], + "error", + ), data.SanityCheck( "Python", commands.check_python_version, @@ -41,9 +55,6 @@ def sanity_check() -> data.SanityCheckResults: def main(): """Validate context.""" - if not HAS_COOKIEPLONE: - print("This template should be run with cookieplone") - sys.exit(1) msg = """ Creating a new Plone Project diff --git a/requirements.txt b/requirements.txt index 1b3107a..74f128d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,6 @@ isort pytest pytest-cookies pytest-jsonschema >= 1.0.0a2 -cookieplone>=0.7.0 +cookieplone >= 0.8.0 GitPython wheel diff --git a/sub/cache/cookiecutter.json b/sub/cache/cookiecutter.json index c77b572..d550dd0 100644 --- a/sub/cache/cookiecutter.json +++ b/sub/cache/cookiecutter.json @@ -3,16 +3,9 @@ "project_slug": "{{ cookiecutter.title | slugify }}", "author": "Plone Foundation", "email": "collective@plone.org", - "python_package_name": "{{ cookiecutter.project_slug|replace(' ', '')|replace('-', '.') }}", "github_organization": "collective", - "container_registry": [ - "github", - "docker_hub", - "gitlab" - ], + "container_registry": ["github", "docker_hub", "gitlab"], "__folder_name": "{{ cookiecutter.project_slug }}", - "__package_name": "{{ cookiecutter.python_package_name | package_name }}", - "__package_namespace": "{{ cookiecutter.python_package_name | package_namespace }}", "__container_registry_prefix": "{{ cookiecutter.container_registry | image_prefix }}", "__container_image_prefix": "{{ cookiecutter.__container_registry_prefix }}{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug }}", "__gha_version_checkout": "v4", @@ -22,13 +15,10 @@ "__gha_version_docker_login": "v3", "__gha_version_docker_build_push": "v4", "__devops_varnish_version": "7.6", - "_copy_without_render": [ - ], + "_copy_without_render": [], "_extensions": [ "cookieplone.filters.extract_host", - "cookieplone.filters.image_prefix", - "cookieplone.filters.package_name", - "cookieplone.filters.package_namespace" + "cookieplone.filters.image_prefix" ], "__cookieplone_repository_path": "", "__cookieplone_template": "" diff --git a/sub/cache/hooks/post_gen_project.py b/sub/cache/hooks/post_gen_project.py index f7d8660..a8abbbd 100644 --- a/sub/cache/hooks/post_gen_project.py +++ b/sub/cache/hooks/post_gen_project.py @@ -39,9 +39,7 @@ def set_configurations(package_root: Path, context: OrderedDict): def main(): """Final fixes.""" output_dir = Path().cwd() - namespace = context.get("__package_namespace") - package_name = context.get("__package_name") - package_root = output_dir / "backend/src" / namespace / package_name + package_root = output_dir / "backend/src/packagename" set_configurations(package_root, context) diff --git a/sub/cache/tests/test_cutter.py b/sub/cache/tests/test_cutter.py index a5b95d1..21e0e7b 100644 --- a/sub/cache/tests/test_cutter.py +++ b/sub/cache/tests/test_cutter.py @@ -41,8 +41,8 @@ def test_json_schema( "file_path", [ ".github/workflows/varnish.yml", - "backend/src/project/title/profiles/default/registry/plone.cachepurging.interfaces.ICachePurgingSettings.xml", # noQA - "backend/src/project/title/profiles/default/registry/plone.caching.interfaces.ICacheSettings.xml", # noQA + "backend/src/packagename/profiles/default/registry/plone.cachepurging.interfaces.ICachePurgingSettings.xml", # noQA + "backend/src/packagename/profiles/default/registry/plone.caching.interfaces.ICacheSettings.xml", # noQA "devops/varnish/etc/varnish.vcl", "devops/varnish/Dockerfile", ], diff --git a/sub/cache/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/registry/plone.cachepurging.interfaces.ICachePurgingSettings.xml b/sub/cache/{{ cookiecutter.__folder_name }}/backend/src/packagename/profiles/default/registry/plone.cachepurging.interfaces.ICachePurgingSettings.xml similarity index 100% rename from sub/cache/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/registry/plone.cachepurging.interfaces.ICachePurgingSettings.xml rename to sub/cache/{{ cookiecutter.__folder_name }}/backend/src/packagename/profiles/default/registry/plone.cachepurging.interfaces.ICachePurgingSettings.xml diff --git a/sub/cache/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/registry/plone.caching.interfaces.ICacheSettings.xml b/sub/cache/{{ cookiecutter.__folder_name }}/backend/src/packagename/profiles/default/registry/plone.caching.interfaces.ICacheSettings.xml similarity index 100% rename from sub/cache/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/registry/plone.caching.interfaces.ICacheSettings.xml rename to sub/cache/{{ cookiecutter.__folder_name }}/backend/src/packagename/profiles/default/registry/plone.caching.interfaces.ICacheSettings.xml diff --git a/sub/project_settings/cookiecutter.json b/sub/project_settings/cookiecutter.json index e2d66fd..d9dda27 100644 --- a/sub/project_settings/cookiecutter.json +++ b/sub/project_settings/cookiecutter.json @@ -15,8 +15,8 @@ "__container_registry_prefix": "{{ cookiecutter.container_registry | image_prefix }}", "__container_image_prefix": "{{ cookiecutter.__container_registry_prefix }}{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug }}", "__folder_name": "{{ cookiecutter.project_slug }}", - "__package_name": "{{ cookiecutter.python_package_name | package_name }}", - "__package_namespace": "{{ cookiecutter.python_package_name | package_namespace }}", + "__package_namespaces": "{{ cookiecutter.python_package_name | package_namespaces }}", + "__package_path": "{{ cookiecutter.python_package_name | package_path }}", "__profile_language": "{{ cookiecutter.language_code|gs_language_code }}", "__locales_language": "{{ cookiecutter.language_code|locales_language_code }}", "__version_pnpm": "9.1.1", @@ -29,8 +29,8 @@ "cookieplone.filters.pascal_case", "cookieplone.filters.locales_language_code", "cookieplone.filters.gs_language_code", - "cookieplone.filters.package_name", - "cookieplone.filters.package_namespace", + "cookieplone.filters.package_namespaces", + "cookieplone.filters.package_path", "cookieplone.filters.latest_volto", "cookieplone.filters.latest_plone" ], diff --git a/sub/project_settings/tests/test_cutter.py b/sub/project_settings/tests/test_cutter.py index 0b786b1..eddc3be 100644 --- a/sub/project_settings/tests/test_cutter.py +++ b/sub/project_settings/tests/test_cutter.py @@ -32,27 +32,27 @@ def test_variable_substitution(build_files_list, variable_pattern, cutter_result "backend/Makefile", "backend/scripts/create_site.py", "backend/setup.py", - "backend/src/project/title/locales/__init__.py", - "backend/src/project/title/locales/en/LC_MESSAGES/project.title.po", - "backend/src/project/title/locales/project.title.pot", - "backend/src/project/title/locales/update.py", - "backend/src/project/title/profiles/default/registry/plone.base.interfaces.controlpanel.IMailSchema.xml", # noQA - "backend/src/project/title/profiles/default/registry/plone.base.interfaces.controlpanel.ISiteSchema.xml", # noQA - "backend/src/project/title/profiles/default/registry/plone.i18n.interfaces.ILanguageSchema.xml", - "backend/src/project/title/profiles/initial/metadata.xml", - "backend/src/project/title/setuphandlers/examplecontent/.gitkeep", - "backend/src/project/title/setuphandlers/examplecontent/content/__metadata__.json", - "backend/src/project/title/setuphandlers/examplecontent/content/a58ccead718140c1baa98d43595fc3e6/data.json", - "backend/src/project/title/setuphandlers/examplecontent/content/a58ccead718140c1baa98d43595fc3e6/image/plone-foundation.png", - "backend/src/project/title/setuphandlers/examplecontent/content/a720393b3c0240e5bd27c43fcd2cfd1e/data.json", - "backend/src/project/title/setuphandlers/examplecontent/content/plone_site_root/data.json", - "backend/src/project/title/setuphandlers/examplecontent/discussions.json", - "backend/src/project/title/setuphandlers/examplecontent/portlets.json", - "backend/src/project/title/setuphandlers/examplecontent/principals.json", - "backend/src/project/title/setuphandlers/examplecontent/redirects.json", - "backend/src/project/title/setuphandlers/examplecontent/relations.json", - "backend/src/project/title/setuphandlers/examplecontent/translations.json", - "backend/src/project/title/setuphandlers/initial.py", + "backend/src/packagename/locales/__init__.py", + "backend/src/packagename/locales/en/LC_MESSAGES/project.title.po", + "backend/src/packagename/locales/project.title.pot", + "backend/src/packagename/locales/update.py", + "backend/src/packagename/profiles/default/registry/plone.base.interfaces.controlpanel.IMailSchema.xml", # noQA + "backend/src/packagename/profiles/default/registry/plone.base.interfaces.controlpanel.ISiteSchema.xml", # noQA + "backend/src/packagename/profiles/default/registry/plone.i18n.interfaces.ILanguageSchema.xml", + "backend/src/packagename/profiles/initial/metadata.xml", + "backend/src/packagename/setuphandlers/examplecontent/.gitkeep", + "backend/src/packagename/setuphandlers/examplecontent/content/__metadata__.json", + "backend/src/packagename/setuphandlers/examplecontent/content/a58ccead718140c1baa98d43595fc3e6/data.json", + "backend/src/packagename/setuphandlers/examplecontent/content/a58ccead718140c1baa98d43595fc3e6/image/plone-foundation.png", + "backend/src/packagename/setuphandlers/examplecontent/content/a720393b3c0240e5bd27c43fcd2cfd1e/data.json", + "backend/src/packagename/setuphandlers/examplecontent/content/plone_site_root/data.json", + "backend/src/packagename/setuphandlers/examplecontent/discussions.json", + "backend/src/packagename/setuphandlers/examplecontent/portlets.json", + "backend/src/packagename/setuphandlers/examplecontent/principals.json", + "backend/src/packagename/setuphandlers/examplecontent/redirects.json", + "backend/src/packagename/setuphandlers/examplecontent/relations.json", + "backend/src/packagename/setuphandlers/examplecontent/translations.json", + "backend/src/packagename/setuphandlers/initial.py", "frontend/.dockerignore", "frontend/Dockerfile", "frontend/Makefile", diff --git a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/Makefile b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/Makefile index a5d80bf..0732146 100644 --- a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/Makefile +++ b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/Makefile @@ -36,7 +36,7 @@ endif PLONE_SITE_ID=Plone BACKEND_FOLDER=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) PLONE_VERSION=$(shell cat $(BACKEND_FOLDER)/version.txt) -EXAMPLE_CONTENT_FOLDER=${BACKEND_FOLDER}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent +EXAMPLE_CONTENT_FOLDER=${BACKEND_FOLDER}/src/{{ cookiecutter.__package_path }}/setuphandlers/examplecontent GIT_FOLDER=$(BACKEND_FOLDER)/.git VENV_FOLDER=$(BACKEND_FOLDER)/.venv @@ -137,7 +137,7 @@ build-image: ## Build Docker Images # Acceptance tests .PHONY: acceptance-backend-start acceptance-backend-start: ## Start backend acceptance server - ZSERVER_HOST=0.0.0.0 ZSERVER_PORT=55001 LISTEN_PORT=55001 APPLY_PROFILES="{{ cookiecutter.__package_namespace }}.{{ cookiecutter.__package_name }}:default" CONFIGURE_PACKAGES="plone.restapi,plone.volto,plone.volto.cors,{{ cookiecutter.__package_namespace }}.{{ cookiecutter.__package_name }}" $(BIN_FOLDER)/robot-server plone.app.robotframework.testing.VOLTO_ROBOT_TESTING + ZSERVER_HOST=0.0.0.0 ZSERVER_PORT=55001 LISTEN_PORT=55001 APPLY_PROFILES="{{ cookiecutter.python_package_name }}:default" CONFIGURE_PACKAGES="plone.restapi,plone.volto,plone.volto.cors,{{ cookiecutter.python_package_name }}" $(BIN_FOLDER)/robot-server plone.app.robotframework.testing.VOLTO_ROBOT_TESTING .PHONY: acceptance-image-build acceptance-image-build: ## Build Docker Images diff --git a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/setup.py b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/setup.py index 9f6acca..cd4609d 100644 --- a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/setup.py +++ b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/setup.py @@ -43,7 +43,7 @@ }, license="GPL version 2", packages=find_packages("src", exclude=["ez_setup"]), - namespace_packages=["{{ cookiecutter.__package_namespace }}"], + namespace_packages=[{{ cookiecutter.__package_namespaces }}], package_dir={"": "src"}, include_package_data=True, zip_safe=False, diff --git a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/locales/__init__.py b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/locales/__init__.py similarity index 100% rename from sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/locales/__init__.py rename to sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/locales/__init__.py diff --git a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/locales/update.py b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/locales/update.py similarity index 100% rename from sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/locales/update.py rename to sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/locales/update.py diff --git a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/locales/{{ cookiecutter.__locales_language }}/LC_MESSAGES/{{ cookiecutter.python_package_name }}.po b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/locales/{{ cookiecutter.__locales_language }}/LC_MESSAGES/{{ cookiecutter.python_package_name }}.po similarity index 100% rename from sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/locales/{{ cookiecutter.__locales_language }}/LC_MESSAGES/{{ cookiecutter.python_package_name }}.po rename to sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/locales/{{ cookiecutter.__locales_language }}/LC_MESSAGES/{{ cookiecutter.python_package_name }}.po diff --git a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/locales/{{ cookiecutter.python_package_name }}.pot b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/locales/{{ cookiecutter.python_package_name }}.pot similarity index 100% rename from sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/locales/{{ cookiecutter.python_package_name }}.pot rename to sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/locales/{{ cookiecutter.python_package_name }}.pot diff --git a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles.zcml b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/profiles.zcml similarity index 100% rename from sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles.zcml rename to sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/profiles.zcml diff --git a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/registry/plone.base.interfaces.controlpanel.IMailSchema.xml b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/profiles/default/registry/plone.base.interfaces.controlpanel.IMailSchema.xml similarity index 100% rename from sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/registry/plone.base.interfaces.controlpanel.IMailSchema.xml rename to sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/profiles/default/registry/plone.base.interfaces.controlpanel.IMailSchema.xml diff --git a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/registry/plone.base.interfaces.controlpanel.ISiteSchema.xml b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/profiles/default/registry/plone.base.interfaces.controlpanel.ISiteSchema.xml similarity index 100% rename from sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/registry/plone.base.interfaces.controlpanel.ISiteSchema.xml rename to sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/profiles/default/registry/plone.base.interfaces.controlpanel.ISiteSchema.xml diff --git a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/registry/plone.i18n.interfaces.ILanguageSchema.xml b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/profiles/default/registry/plone.i18n.interfaces.ILanguageSchema.xml similarity index 100% rename from sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/registry/plone.i18n.interfaces.ILanguageSchema.xml rename to sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/profiles/default/registry/plone.i18n.interfaces.ILanguageSchema.xml diff --git a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/initial/metadata.xml b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/profiles/initial/metadata.xml similarity index 100% rename from sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/initial/metadata.xml rename to sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/profiles/initial/metadata.xml diff --git a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent/.gitkeep b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/examplecontent/.gitkeep similarity index 100% rename from sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent/.gitkeep rename to sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/examplecontent/.gitkeep diff --git a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent/content/__metadata__.json b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/examplecontent/content/__metadata__.json similarity index 100% rename from sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent/content/__metadata__.json rename to sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/examplecontent/content/__metadata__.json diff --git a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent/content/a58ccead718140c1baa98d43595fc3e6/data.json b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/examplecontent/content/a58ccead718140c1baa98d43595fc3e6/data.json similarity index 100% rename from sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent/content/a58ccead718140c1baa98d43595fc3e6/data.json rename to sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/examplecontent/content/a58ccead718140c1baa98d43595fc3e6/data.json diff --git a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent/content/a58ccead718140c1baa98d43595fc3e6/image/plone-foundation.png b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/examplecontent/content/a58ccead718140c1baa98d43595fc3e6/image/plone-foundation.png similarity index 100% rename from sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent/content/a58ccead718140c1baa98d43595fc3e6/image/plone-foundation.png rename to sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/examplecontent/content/a58ccead718140c1baa98d43595fc3e6/image/plone-foundation.png diff --git a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent/content/a720393b3c0240e5bd27c43fcd2cfd1e/data.json b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/examplecontent/content/a720393b3c0240e5bd27c43fcd2cfd1e/data.json similarity index 100% rename from sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent/content/a720393b3c0240e5bd27c43fcd2cfd1e/data.json rename to sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/examplecontent/content/a720393b3c0240e5bd27c43fcd2cfd1e/data.json diff --git a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent/content/plone_site_root/data.json b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/examplecontent/content/plone_site_root/data.json similarity index 100% rename from sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent/content/plone_site_root/data.json rename to sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/examplecontent/content/plone_site_root/data.json diff --git a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent/discussions.json b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/examplecontent/discussions.json similarity index 100% rename from sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent/discussions.json rename to sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/examplecontent/discussions.json diff --git a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent/portlets.json b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/examplecontent/portlets.json similarity index 100% rename from sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent/portlets.json rename to sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/examplecontent/portlets.json diff --git a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent/principals.json b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/examplecontent/principals.json similarity index 100% rename from sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent/principals.json rename to sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/examplecontent/principals.json diff --git a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent/redirects.json b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/examplecontent/redirects.json similarity index 100% rename from sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent/redirects.json rename to sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/examplecontent/redirects.json diff --git a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent/relations.json b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/examplecontent/relations.json similarity index 100% rename from sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent/relations.json rename to sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/examplecontent/relations.json diff --git a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent/translations.json b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/examplecontent/translations.json similarity index 100% rename from sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/examplecontent/translations.json rename to sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/examplecontent/translations.json diff --git a/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/initial.py b/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/initial.py similarity index 100% rename from sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/setuphandlers/initial.py rename to sub/project_settings/{{ cookiecutter.__folder_name }}/backend/src/packagename/setuphandlers/initial.py