Skip to content

Commit

Permalink
Merge changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
rnixx committed Oct 24, 2024
2 parents 661d240 + 1b77a30 commit bd59b5e
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 44 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
Expand All @@ -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
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/variants.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 10 additions & 4 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Changelog

## 1.0a6 (unreleased)
## 1.0a7 (unreleased)

**Breaking changes**

- Rename `npm` domain to `nodejs` and add support for using `pnpm` as
alternative package manager.

## 1.0a6 (2024-08-02)

- Fix bug in `Template.write` when creating target folders to also create
parent folders if not exists.
Expand All @@ -9,10 +16,9 @@

- Add `plone-site` template configuration to `mx.ini` template.

**Breaking changes**
- More fine grained control over plone site creation and purging.

- Rename `npm` domain to `nodejs` and add support for using `pnpm` as
alternative package manager.
- Drop Python 3.8 and set all defaults to a Python 3.9 minimum.

## 1.0a5 (2024-06-07)

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[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.0a7.dev0"
keywords = ["development", "deployment", "make"]
authors = [
{name = "MX Stack Developers", email = "[email protected]" }
]
requires-python = ">=3.7"
requires-python = ">=3.9"
license = { text = "BSD 2-Clause License" }
classifiers = [
"Development Status :: 3 - Alpha",
Expand Down
44 changes: 33 additions & 11 deletions src/mxmake/templates/plone-site.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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() %}
Expand All @@ -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.")
48 changes: 35 additions & 13 deletions src/mxmake/tests/test_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,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.
Expand All @@ -887,7 +887,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",
Expand All @@ -911,18 +918,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(),
)
Expand Down
22 changes: 22 additions & 0 deletions src/mxmake/topics/applications/plone.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,21 @@
#: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
Expand All @@ -22,10 +34,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)
2 changes: 1 addition & 1 deletion src/mxmake/topics/core/mxenv.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit bd59b5e

Please sign in to comment.