From a84678e12ce0c545935fb37ac52a676e3ec02d94 Mon Sep 17 00:00:00 2001 From: Robert Niederreiter Date: Mon, 17 Jun 2024 15:16:07 +0200 Subject: [PATCH 01/12] Add stub work for proxy targets --- src/mxmake/templates.py | 23 ++++++++++++++++ src/mxmake/tests/test_templates.py | 42 +++++++++++++++++++++++++----- 2 files changed, 58 insertions(+), 7 deletions(-) diff --git a/src/mxmake/templates.py b/src/mxmake/templates.py index 6226334..1380587 100644 --- a/src/mxmake/templates.py +++ b/src/mxmake/templates.py @@ -525,3 +525,26 @@ def template_variables(self): if not site["extension_ids"]: site["extension_ids"] = ["plone.volto:default"] return vars + + +############################################################################## +# proxy targets template +############################################################################## + + +@template("proxy") +class ProxyMk(MxIniBoundTemplate): + description: str = "Contains proxy targets for Makefiles of source folders" + target_name = "proxy.mk" + template_name = "proxy.mk" + + @property + def target_folder(self) -> Path: + return mxmake_files() + + @property + def template_variables(self): + targets = {} + for key, value in self.settings.items(): + ... + return targets diff --git a/src/mxmake/tests/test_templates.py b/src/mxmake/tests/test_templates.py index 32e27ab..28470ba 100644 --- a/src/mxmake/tests/test_templates.py +++ b/src/mxmake/tests/test_templates.py @@ -32,6 +32,7 @@ class Template(templates.Template): "makefile": templates.Makefile, "mx.ini": templates.MxIni, "pip-conf": templates.PipConf, + "proxy": templates.ProxyMk, "run-coverage": templates.CoverageScript, "run-tests": templates.TestScript, "topics.md": templates.Topics, @@ -830,13 +831,6 @@ def test_MxIni(self, tempdir): @testing.template_directory() def test_PloneSite_all_defaults(self, tempdir): mxini = tempdir / "mx.ini" - with mxini.open("w") as fd: - fd.write( - "[settings]\n" - "\n" - "[mxmake-plone-site]\n" - "distribution = mxmake.test:default\n" - ) with mxini.open("w") as fd: fd.write("[settings]\n") configuration = mxdev.Configuration(mxini, hooks=[hook.Hook()]) @@ -928,3 +922,37 @@ def asbool(value: str|bool|None) -> bool: ''', f.read(), ) + + @testing.template_directory() + def test_ProxyMk(self, tempdir): + mxini = tempdir / "mx.ini" + with mxini.open("w") as fd: + fd.write( + "[settings]\n" + "\n" + "[mxmake-proxy]\n" + "folder1 = *\n" + "folder2 =\n" + " applications.plone\n" + " i18n-lingua\n" + ) + configuration = mxdev.Configuration(mxini, hooks=[hook.Hook()]) + factory = templates.template.lookup("proxy") + template = factory(configuration, templates.get_template_environment()) + + self.assertEqual(template.description, "Contains proxy targets for Makefiles of source folders") + self.assertEqual(template.target_folder, utils.mxmake_files()) + self.assertEqual(template.target_name, "proxy.mk") + self.assertEqual(template.template_name, "proxy.mk") + self.assertEqual( + template.template_variables, + {} + ) + + #template.write() + #with (tempdir / "proxy.mk").open() as f: + # self.checkOutput( + # ''' + # ''', + # f.read(), + # ) From 661d240cd939d1e63f36fbfa044a429b870133dc Mon Sep 17 00:00:00 2001 From: Robert Niederreiter Date: Tue, 18 Jun 2024 09:06:53 +0200 Subject: [PATCH 02/12] Implement proxy target geeration --- src/mxmake/templates.py | 26 ++++++++-- src/mxmake/templates/Makefile | 4 ++ src/mxmake/templates/proxy.mk | 10 ++++ src/mxmake/tests/test_templates.py | 67 ++++++++++++++++++++----- src/mxmake/topics/applications/plone.mk | 6 ++- src/mxmake/topics/core/proxy.mk | 29 +++++++++++ 6 files changed, 123 insertions(+), 19 deletions(-) create mode 100644 src/mxmake/templates/proxy.mk create mode 100644 src/mxmake/topics/core/proxy.mk diff --git a/src/mxmake/templates.py b/src/mxmake/templates.py index 1380587..deb67ac 100644 --- a/src/mxmake/templates.py +++ b/src/mxmake/templates.py @@ -1,6 +1,7 @@ from jinja2 import Environment from jinja2 import PackageLoader from mxmake.topics import Domain +from mxmake.topics import get_topic from mxmake.topics import load_topics from mxmake.utils import gh_actions_path from mxmake.utils import mxmake_files @@ -277,7 +278,6 @@ def template_variables(self) -> typing.Dict[str, typing.Any]: additional_targets = {} topics = {domain.topic for domain in self.domains} additional_targets["qa"] = "qa" in topics - # additional_targets["docs"] = "docs" in topics # return template variables return dict( settings=settings, @@ -544,7 +544,23 @@ def target_folder(self) -> Path: @property def template_variables(self): - targets = {} - for key, value in self.settings.items(): - ... - return targets + targets = [] + for folder, proxy in self.settings.items(): + for item in [item.strip() for item in proxy.split('\n') if item.strip()]: + topic_name, domain_names = item.split(':') + topic = get_topic(topic_name.strip()) + domain_names = domain_names.split(',') + domains = [] + for domain_name in domain_names: + if domain_name == '*': + domains = topic.domains + break + else: + domains.append(topic.domain(domain_name.strip())) + for domain in domains: + for target in domain.targets: + targets.append(dict( + name=target.name, + folder=folder + )) + return dict(targets=targets) diff --git a/src/mxmake/templates/Makefile b/src/mxmake/templates/Makefile index 5136b99..733b3ec 100644 --- a/src/mxmake/templates/Makefile +++ b/src/mxmake/templates/Makefile @@ -39,6 +39,10 @@ TYPECHECK_TARGETS?= FORMAT_TARGETS?= {% endif %} {{ sections.read() }} +############################################################################## +# Custom includes +############################################################################## + -include $(INCLUDE_MAKEFILE) ############################################################################## diff --git a/src/mxmake/templates/proxy.mk b/src/mxmake/templates/proxy.mk new file mode 100644 index 0000000..b1b36d8 --- /dev/null +++ b/src/mxmake/templates/proxy.mk @@ -0,0 +1,10 @@ +############################################################################## +# proxy targets +############################################################################## + +{% for target in targets %} +.PHONY: {{ target["folder"] }}-{{ target["name"] }} +{{ target["folder"] }}-{{ target["name"] }}: + $(MAKE) -C "./{{ target["folder"] }}/" {{ target["name"] }} + +{% endfor %} \ No newline at end of file diff --git a/src/mxmake/tests/test_templates.py b/src/mxmake/tests/test_templates.py index 28470ba..4aa1443 100644 --- a/src/mxmake/tests/test_templates.py +++ b/src/mxmake/tests/test_templates.py @@ -741,6 +741,10 @@ def test_Makefile(self, tempdir): DIRTY_TARGETS+=mxenv-dirty CLEAN_TARGETS+=mxenv-clean + ############################################################################## + # Custom includes + ############################################################################## + -include $(INCLUDE_MAKEFILE) ############################################################################## @@ -931,10 +935,9 @@ def test_ProxyMk(self, tempdir): "[settings]\n" "\n" "[mxmake-proxy]\n" - "folder1 = *\n" - "folder2 =\n" - " applications.plone\n" - " i18n-lingua\n" + "folder =\n" + " applications:plone\n" + " i18n:*\n" ) configuration = mxdev.Configuration(mxini, hooks=[hook.Hook()]) factory = templates.template.lookup("proxy") @@ -946,13 +949,53 @@ def test_ProxyMk(self, tempdir): self.assertEqual(template.template_name, "proxy.mk") self.assertEqual( template.template_variables, - {} + {'targets': [ + {'name': 'plone-site-create', 'folder': 'folder'}, + {'name': 'plone-site-purge', 'folder': 'folder'}, + {'name': 'gettext-create', 'folder': 'folder'}, + {'name': 'gettext-update', 'folder': 'folder'}, + {'name': 'gettext-compile', 'folder': 'folder'}, + {'name': 'lingua-extract', 'folder': 'folder'}, + {'name': 'lingua', 'folder': 'folder'} + ]} ) - #template.write() - #with (tempdir / "proxy.mk").open() as f: - # self.checkOutput( - # ''' - # ''', - # f.read(), - # ) + template.write() + with (tempdir / "proxy.mk").open() as f: + self.checkOutput( + ''' + ############################################################################## + # proxy targets + ############################################################################## + + .PHONY: folder-plone-site-create + folder-plone-site-create: + $(MAKE) -C "./folder/" plone-site-create + + .PHONY: folder-plone-site-purge + folder-plone-site-purge: + $(MAKE) -C "./folder/" plone-site-purge + + .PHONY: folder-gettext-create + folder-gettext-create: + $(MAKE) -C "./folder/" gettext-create + + .PHONY: folder-gettext-update + folder-gettext-update: + $(MAKE) -C "./folder/" gettext-update + + .PHONY: folder-gettext-compile + folder-gettext-compile: + $(MAKE) -C "./folder/" gettext-compile + + .PHONY: folder-lingua-extract + folder-lingua-extract: + $(MAKE) -C "./folder/" lingua-extract + + .PHONY: folder-lingua + folder-lingua: + $(MAKE) -C "./folder/" lingua + + ''', + f.read(), + ) diff --git a/src/mxmake/topics/applications/plone.mk b/src/mxmake/topics/applications/plone.mk index 03bf7e4..1fd5db5 100644 --- a/src/mxmake/topics/applications/plone.mk +++ b/src/mxmake/topics/applications/plone.mk @@ -4,10 +4,12 @@ #:depends = applications.zope #: #:[target.plone-site-create] -#:description = Creates a Plone site using the script provided in `PLONE_SITE_SCRIPT` configuration. +#:description = Creates a Plone site using the script provided in +#: `PLONE_SITE_SCRIPT` configuration. #: #:[target.plone-site-purge] -#:description = Removes the Plone instance from the database, but the database itself is kept. +#:description = Removes the Plone instance from the database, but the database +#: itself is kept. #: #:[setting.PLONE_SITE_SCRIPT] #:description = Path to the script to create or purge a Plone site diff --git a/src/mxmake/topics/core/proxy.mk b/src/mxmake/topics/core/proxy.mk new file mode 100644 index 0000000..aca3c56 --- /dev/null +++ b/src/mxmake/topics/core/proxy.mk @@ -0,0 +1,29 @@ +#:[proxy] +#:title = Proxy targets +#:description = This domain includes proxy targets which are configured in +#: `mx.ini`. I is expected that defined folder(s) contains a Makefile which +#: is generated by `mxmake` and this Makefile contains the domains for which +#: proxy targets are created. The proxy configuration in the `mx.ini` file +#: looks as follows: +#: +#: ```ini +#: mxmake-templates = proxy +#: +#: [mxmake-proxy] +#: foldername = +#: applications:plone,zest-releaser +#: i18n:* +#: ``` +#: +#: Each setting in the `mxmake-proxy` section defines a child folder. The +#: value contains the topic name and the desired domains as comma +#: separated list. Wildcard `*` means to include all domains of this topic. +#: Topic and domains are colon separated. +#: +#:depends = core.mxfiles + +############################################################################## +# proxy +############################################################################## + +-include $(MXMAKE_FILES)/proxy.mk From 01cc96f016b79f7af8f9d4c483cbd51307ef1ff1 Mon Sep 17 00:00:00 2001 From: "Jens W. Klein" Date: Mon, 29 Jul 2024 01:00:57 +0200 Subject: [PATCH 03/12] more fine grained control over plone-site creation/purging --- CHANGES.md | 2 ++ src/mxmake/templates/plone-site.py | 44 ++++++++++++++++++------- src/mxmake/topics/applications/plone.mk | 22 +++++++++++++ 3 files changed, 57 insertions(+), 11 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index be6ab5d..75cd3e1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -9,6 +9,8 @@ - Add `plone-site` template configuration to `mx.ini` template. +- More fine grained control over plone site creation and purging. + ## 1.0a5 (2024-06-07) - Export `OS` environment variable in `mxenv` domain to prevent warning on diff --git a/src/mxmake/templates/plone-site.py b/src/mxmake/templates/plone-site.py index 7d8278a..617739f 100644 --- a/src/mxmake/templates/plone-site.py +++ b/src/mxmake/templates/plone-site.py @@ -10,7 +10,7 @@ TRUTHY = frozenset(("t", "true", "y", "yes", "on", "1")) -def asbool(value: str|bool|None) -> bool: +def asbool(value: str | bool | None) -> bool: """Return the boolean value ``True`` if the case-lowered value of string input ``s`` is a :term:`truthy string`. If ``s`` is already one of the boolean values ``True`` or ``False``, return it. @@ -22,7 +22,14 @@ def asbool(value: str|bool|None) -> bool: return value.strip().lower() in TRUTHY -PLONE_SITE_PURGE = asbool(os.getenv("PLONE_SITE_PURGE")) +PLONE_SITE_PURGE = asbool(os.getenv("PLONE_SITE_PURGE", "false")) +PLONE_SITE_PURGE_FAIL_IF_NOT_EXISTS = asbool( + os.getenv("PLONE_SITE_PURGE_FAIL_IF_NOT_EXISTS", "true") +) +PLONE_SITE_CREATE = asbool(os.getenv("PLONE_SITE_CREATE", "true")) +PLONE_SITE_CREATE_FAIL_IF_EXISTS = asbool( + os.getenv("PLONE_SITE_CREATE_FAIL_IF_EXISTS", "true") +) config = { {% for key, value in site.items() %} @@ -49,15 +56,30 @@ def asbool(value: str|bool|None) -> bool: app.manage_delObjects([config["site_id"]]) transaction.commit() app._p_jar.sync() + print(f"Existing site with id={config['site_id']} purged!") + if not PLONE_SITE_CREATE: + print("Done.") + exit(0) else: - print(f"Site with id {config['site_id']} does not exist!") - exit(0) + print(f"Site with id={config['site_id']} does not exist!") + if PLONE_SITE_PURGE_FAIL_IF_NOT_EXISTS: + print("...failure!") + exit(1) + if not PLONE_SITE_CREATE: + print("Done.") + exit(0) +if PLONE_SITE_CREATE: + if config["site_id"] in app.objectIds(): + print(f"Site with id={config['site_id']} already exists!") + if PLONE_SITE_CREATE_FAIL_IF_EXISTS: + print("...failure!") + exit(1) + print("Done.") + exit(0) -if config["site_id"] in app.objectIds(): - print(f"Site with id {config['site_id']} already exists!") - exit(1) - -site = create(app, "{{ distribution }}", config) -transaction.commit() -app._p_jar.sync() + site = create(app, "{{ distribution }}", config) + transaction.commit() + app._p_jar.sync() + print(f"New site with id={config['site_id']} created!") + print("Done.") diff --git a/src/mxmake/topics/applications/plone.mk b/src/mxmake/topics/applications/plone.mk index 03bf7e4..664bab7 100644 --- a/src/mxmake/topics/applications/plone.mk +++ b/src/mxmake/topics/applications/plone.mk @@ -9,9 +9,21 @@ #:[target.plone-site-purge] #:description = Removes the Plone instance from the database, but the database itself is kept. #: +#:[target.plone-site-recreate] +#:description = Removes the Plone instance from the database like in plone-site-purge, +#: then creates a new one like in plone-site-create. +#: #:[setting.PLONE_SITE_SCRIPT] #:description = Path to the script to create or purge a Plone site #:default = .mxmake/files/plone-site.py +#:#: +#:[setting.PLONE_SITE_CREATE_FAIL_IF_EXISTS] +#:description = Exit with an error if the Plone site already exists +#:default = True + +#:[setting.PLONE_SITE_PURGE_FAIL_IF_NOT_EXISTS] +#:description = Exit with an error if the Plone site does not exists +#:default = True ############################################################################## # plone @@ -20,10 +32,20 @@ .PHONY: plone-site-create plone-site-create: $(ZOPE_RUN_TARGET) @echo "Creating Plone Site" + @export PLONE_SITE_PURGE=False + @export PLONE_SITE_CREATE=True @zconsole run $(ZOPE_INSTANCE_FOLDER)/etc/zope.conf $(PLONE_SITE_SCRIPT) .PHONY: plone-site-purge plone-site-purge: $(ZOPE_RUN_TARGET) @echo "Purging Plone Site" @export PLONE_SITE_PURGE=True + @export PLONE_SITE_CREATE=False + @zconsole run $(ZOPE_INSTANCE_FOLDER)/etc/zope.conf $(PLONE_SITE_SCRIPT) + +.PHONY: plone-site-recreate +plone-site-recreate: $(ZOPE_RUN_TARGET) + @echo "Purging Plone Site" + @export PLONE_SITE_PURGE=True + @export PLONE_SITE_CREATE=True @zconsole run $(ZOPE_INSTANCE_FOLDER)/etc/zope.conf $(PLONE_SITE_SCRIPT) From a2ee18053eecc1266bb08a779f677b30de38dccf Mon Sep 17 00:00:00 2001 From: "Jens W. Klein" Date: Mon, 29 Jul 2024 01:06:39 +0200 Subject: [PATCH 04/12] drop Python 3.8 since dependencies broke --- .github/workflows/test.yml | 7 ------- .github/workflows/variants.yml | 6 +----- CHANGES.md | 2 ++ pyproject.toml | 2 +- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 94bff63..d4e6775 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,6 @@ jobs: fail-fast: false matrix: python-version: - - "3.8" - "3.9" - "3.10" - "3.11" @@ -18,12 +17,6 @@ jobs: - macos-latest - windows-latest exclude: - # python 3.8 and windows do not like each other here, so we do not support it - - python-version: "3.8" - os: windows-latest - # GH does not support macos and python 3.8 - - python-version: "3.8" - os: macos-latest # GH does not support macos and python 3.9 - python-version: "3.9" os: macos-latest diff --git a/.github/workflows/variants.yml b/.github/workflows/variants.yml index 33a0e51..f60f4ed 100644 --- a/.github/workflows/variants.yml +++ b/.github/workflows/variants.yml @@ -9,16 +9,12 @@ jobs: matrix: python-version: # we test on lowest and highest supported versions - - "3.8" + - "3.9" - "3.12" os: - ubuntu-latest - macos-latest - windows-latest - exclude: - # python 3.8 and windows do not like each other here, so we do not support it - - python-version: "3.8" - os: windows-latest runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 diff --git a/CHANGES.md b/CHANGES.md index 75cd3e1..729d174 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,6 +11,8 @@ - More fine grained control over plone site creation and purging. +- Drop Python 3.8 in tests. + ## 1.0a5 (2024-06-07) - Export `OS` environment variable in `mxenv` domain to prevent warning on diff --git a/pyproject.toml b/pyproject.toml index 963a97b..779ec85 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ keywords = ["development", "deployment", "make"] authors = [ {name = "MX Stack Developers", email = "dev@bluedynamics.com" } ] -requires-python = ">=3.7" +requires-python = ">=3.9" license = { text = "BSD 2-Clause License" } classifiers = [ "Development Status :: 3 - Alpha", From a02ac2667d644a9cca91f7a1009c1a5b3cacdd52 Mon Sep 17 00:00:00 2001 From: "Jens W. Klein" Date: Mon, 29 Jul 2024 01:09:28 +0200 Subject: [PATCH 05/12] fix test --- src/mxmake/tests/test_templates.py | 48 ++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/src/mxmake/tests/test_templates.py b/src/mxmake/tests/test_templates.py index 32e27ab..88a3379 100644 --- a/src/mxmake/tests/test_templates.py +++ b/src/mxmake/tests/test_templates.py @@ -877,7 +877,7 @@ def test_PloneSite_all_defaults(self, tempdir): TRUTHY = frozenset(("t", "true", "y", "yes", "on", "1")) - def asbool(value: str|bool|None) -> bool: + def asbool(value: str | bool | None) -> bool: """Return the boolean value ``True`` if the case-lowered value of string input ``s`` is a :term:`truthy string`. If ``s`` is already one of the boolean values ``True`` or ``False``, return it. @@ -889,7 +889,14 @@ def asbool(value: str|bool|None) -> bool: return value.strip().lower() in TRUTHY - PLONE_SITE_PURGE = asbool(os.getenv("PLONE_SITE_PURGE")) + PLONE_SITE_PURGE = asbool(os.getenv("PLONE_SITE_PURGE", "false")) + PLONE_SITE_PURGE_FAIL_IF_NOT_EXISTS = asbool( + os.getenv("PLONE_SITE_PURGE_FAIL_IF_NOT_EXISTS", "true") + ) + PLONE_SITE_CREATE = asbool(os.getenv("PLONE_SITE_CREATE", "true")) + PLONE_SITE_CREATE_FAIL_IF_EXISTS = asbool( + os.getenv("PLONE_SITE_CREATE_FAIL_IF_EXISTS", "true") + ) config = { "site_id": "Plone", @@ -913,18 +920,33 @@ def asbool(value: str|bool|None) -> bool: app.manage_delObjects([config["site_id"]]) transaction.commit() app._p_jar.sync() + print(f"Existing site with id={config['site_id']} purged!") + if not PLONE_SITE_CREATE: + print("Done.") + exit(0) else: - print(f"Site with id {config['site_id']} does not exist!") - exit(0) - - - if config["site_id"] in app.objectIds(): - print(f"Site with id {config['site_id']} already exists!") - exit(1) - - site = create(app, "", config) - transaction.commit() - app._p_jar.sync() + print(f"Site with id={config['site_id']} does not exist!") + if PLONE_SITE_PURGE_FAIL_IF_NOT_EXISTS: + print("...failure!") + exit(1) + if not PLONE_SITE_CREATE: + print("Done.") + exit(0) + + if PLONE_SITE_CREATE: + if config["site_id"] in app.objectIds(): + print(f"Site with id={config['site_id']} already exists!") + if PLONE_SITE_CREATE_FAIL_IF_EXISTS: + print("...failure!") + exit(1) + print("Done.") + exit(0) + + site = create(app, "", config) + transaction.commit() + app._p_jar.sync() + print(f"New site with id={config['site_id']} created!") + print("Done.") ''', f.read(), ) From 5e1328f06e70728c120483c32aafd8392197d693 Mon Sep 17 00:00:00 2001 From: "Jens W. Klein" Date: Fri, 2 Aug 2024 16:41:14 +0200 Subject: [PATCH 06/12] set all defaults to a Python 3.9 minimum --- CHANGES.md | 2 +- Makefile | 2 +- src/mxmake/topics/core/mxenv.mk | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 729d174..5947e73 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,7 +11,7 @@ - More fine grained control over plone site creation and purging. -- Drop Python 3.8 in tests. +- Drop Python 3.8 and set all defaults to a Python 3.9 minimum. ## 1.0a5 (2024-06-07) diff --git a/Makefile b/Makefile index 6342d58..8b73f1f 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ PRIMARY_PYTHON?=python3 # Minimum required Python version. # Default: 3.7 -PYTHON_MIN_VERSION?=3.7 +PYTHON_MIN_VERSION?=3.9 # Install packages using the given package installer method. # Supported are `pip` and `uv`. If uv is used, its global availability is diff --git a/src/mxmake/topics/core/mxenv.mk b/src/mxmake/topics/core/mxenv.mk index 3157388..c352fcf 100644 --- a/src/mxmake/topics/core/mxenv.mk +++ b/src/mxmake/topics/core/mxenv.mk @@ -28,7 +28,7 @@ #: #:[setting.PYTHON_MIN_VERSION] #:description = Minimum required Python version. -#:default = 3.7 +#:default = 3.9 #: #:[setting.PYTHON_PACKAGE_INSTALLER] #:description = Install packages using the given package installer method. From 776935fcd6a1823a445ebb462eb2b4f4e66aee77 Mon Sep 17 00:00:00 2001 From: "Jens W. Klein" Date: Fri, 2 Aug 2024 16:50:04 +0200 Subject: [PATCH 07/12] Preparing release 1.0a6 --- CHANGES.md | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 5947e73..438f272 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,6 @@ # Changelog -## 1.0a6 (unreleased) +## 1.0a6 (2024-08-02) - Fix bug in `Template.write` when creating target folders to also create parent folders if not exists. diff --git a/pyproject.toml b/pyproject.toml index 779ec85..3869d4a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "mxmake" description = "Generates a Python project-specific Makefile by using an extensible library of configurable Makefile snippets." -version = "1.0a6.dev0" +version = "1.0a6" keywords = ["development", "deployment", "make"] authors = [ {name = "MX Stack Developers", email = "dev@bluedynamics.com" } From 1b77a306cfef456a29743f0ee7619011882b9b55 Mon Sep 17 00:00:00 2001 From: "Jens W. Klein" Date: Fri, 2 Aug 2024 16:50:23 +0200 Subject: [PATCH 08/12] Back to development: 1.0a7 --- CHANGES.md | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 438f272..b648880 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,11 @@ # Changelog +## 1.0a7 (unreleased) + + +- Nothing changed yet. + + ## 1.0a6 (2024-08-02) - Fix bug in `Template.write` when creating target folders to also create diff --git a/pyproject.toml b/pyproject.toml index 3869d4a..6678850 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "mxmake" description = "Generates a Python project-specific Makefile by using an extensible library of configurable Makefile snippets." -version = "1.0a6" +version = "1.0a7.dev0" keywords = ["development", "deployment", "make"] authors = [ {name = "MX Stack Developers", email = "dev@bluedynamics.com" } From 5b88e1ea7f0838e481785be96d4a389f6784c1fe Mon Sep 17 00:00:00 2001 From: Robert Niederreiter Date: Thu, 24 Oct 2024 10:42:31 +0200 Subject: [PATCH 09/12] Fix tests --- src/mxmake/tests/test_templates.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mxmake/tests/test_templates.py b/src/mxmake/tests/test_templates.py index 9f0a7d2..fe1e213 100644 --- a/src/mxmake/tests/test_templates.py +++ b/src/mxmake/tests/test_templates.py @@ -525,7 +525,7 @@ def test_Makefile(self, tempdir): "core.base.INCLUDE_MAKEFILE": "include.mk", "core.base.EXTRA_PATH": "", "core.mxenv.PRIMARY_PYTHON": "python3", - "core.mxenv.PYTHON_MIN_VERSION": "3.7", + "core.mxenv.PYTHON_MIN_VERSION": "3.9", "core.mxenv.PYTHON_PACKAGE_INSTALLER": "pip", "core.mxenv.MXENV_UV_GLOBAL": "false", "core.mxenv.VENV_ENABLED": "true", @@ -586,8 +586,8 @@ def test_Makefile(self, tempdir): PRIMARY_PYTHON?=python3 # Minimum required Python version. - # Default: 3.7 - PYTHON_MIN_VERSION?=3.7 + # Default: 3.9 + PYTHON_MIN_VERSION?=3.9 # Install packages using the given package installer method. # Supported are `pip` and `uv`. If uv is used, its global availability is @@ -974,6 +974,7 @@ def test_ProxyMk(self, tempdir): {'targets': [ {'name': 'plone-site-create', 'folder': 'folder'}, {'name': 'plone-site-purge', 'folder': 'folder'}, + {'name': 'plone-site-recreate', 'folder': 'folder'}, {'name': 'gettext-create', 'folder': 'folder'}, {'name': 'gettext-update', 'folder': 'folder'}, {'name': 'gettext-compile', 'folder': 'folder'}, @@ -998,6 +999,10 @@ def test_ProxyMk(self, tempdir): folder-plone-site-purge: $(MAKE) -C "./folder/" plone-site-purge + .PHONY: folder-plone-site-recreate + folder-plone-site-recreate: + $(MAKE) -C "./folder/" plone-site-recreate + .PHONY: folder-gettext-create folder-gettext-create: $(MAKE) -C "./folder/" gettext-create From e5b4187eb37c81cfe27dd884ef3ccfb5984b203f Mon Sep 17 00:00:00 2001 From: Robert Niederreiter Date: Thu, 24 Oct 2024 10:50:56 +0200 Subject: [PATCH 10/12] Make mypy happy --- src/mxmake/main.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mxmake/main.py b/src/mxmake/main.py index 3f6a16e..4c9cd51 100644 --- a/src/mxmake/main.py +++ b/src/mxmake/main.py @@ -199,9 +199,8 @@ def create_config( preseed_value = ( preseed_domain.get(setting.name, unset) if preseed_domain else unset ) - setting_default = ( - preseed_value if preseed_value is not unset else setting_default - ) + if preseed_value is unset: + preseed_value = setting_default # use configured setting from parser if set elif sfqn in parser.settings: setting_default = parser.settings[sfqn] From 723acd35a75b66a28c8ee597abcd7df96ca76a89 Mon Sep 17 00:00:00 2001 From: Robert Niederreiter Date: Thu, 24 Oct 2024 10:55:22 +0200 Subject: [PATCH 11/12] Fix typo, Update changelog --- CHANGES.md | 2 ++ src/mxmake/topics/core/proxy.mk | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 18fab44..41c5ff0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,8 @@ ## 1.0a7 (unreleased) +- Add proxy target support. + **Breaking changes** - Rename `npm` domain to `nodejs` and add support for using `pnpm` as diff --git a/src/mxmake/topics/core/proxy.mk b/src/mxmake/topics/core/proxy.mk index aca3c56..344760e 100644 --- a/src/mxmake/topics/core/proxy.mk +++ b/src/mxmake/topics/core/proxy.mk @@ -1,7 +1,7 @@ #:[proxy] #:title = Proxy targets #:description = This domain includes proxy targets which are configured in -#: `mx.ini`. I is expected that defined folder(s) contains a Makefile which +#: `mx.ini`. It is expected that defined folder(s) contains a Makefile which #: is generated by `mxmake` and this Makefile contains the domains for which #: proxy targets are created. The proxy configuration in the `mx.ini` file #: looks as follows: From 3b3abd56e1f9fd593ff58d993900d2156e9f287b Mon Sep 17 00:00:00 2001 From: Robert Niederreiter Date: Thu, 24 Oct 2024 11:05:16 +0200 Subject: [PATCH 12/12] Add 3.13 to tests --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d4e6775..dc53ff2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,6 +12,7 @@ jobs: - "3.10" - "3.11" - "3.12" + - "3.13" os: - ubuntu-latest - macos-latest