Skip to content

Commit b076e33

Browse files
committed
MOD-1080: Removed the duplicated "no value" option of the style_template field
1 parent 063668e commit b076e33

16 files changed

Lines changed: 257 additions & 363 deletions

File tree

.github/workflows/python-package.yml

Lines changed: 5 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
1+
# This workflow will install Python dependencies, run tests and lint
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33

44
name: Push tests
5-
# run-name: ${{ github.actor }} push tests
65

76
on:
87
push:
@@ -11,14 +10,6 @@ on:
1110
jobs:
1211
test:
1312
runs-on: ubuntu-24.04
14-
strategy:
15-
fail-fast: false
16-
matrix:
17-
include:
18-
- python: 3.10.11
19-
plone: "6.0"
20-
# - python: 3.13.1
21-
# plone: "6.1"
2213
services:
2314
libreoffice:
2415
image: harbor.imio.be/library/libreoffice:7.3
@@ -40,71 +31,22 @@ jobs:
4031
- name: Set up pyenv and Python
4132
uses: "gabrielfalcao/pyenv-action@v18"
4233
with:
43-
default: "${{ matrix.python }}"
34+
default: "3.13.1"
4435
- name: Setup Python env
4536
run: |
4637
pip install --upgrade pip
47-
pip install -r requirements-${{ matrix.plone }}.txt
48-
- name: Cache eggs
49-
uses: actions/cache@v4
50-
env:
51-
cache-name: cache-eggs
52-
with:
53-
path: ~/buildout-cache/eggs
54-
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ matrix.python }}-${{ matrix.plone }}
55-
- name: buildout
56-
run: |
57-
sed -ie "s#test.cfg#test-${{matrix.plone}}.cfg#" gha.cfg
58-
buildout -c gha.cfg annotate
59-
buildout -c gha.cfg
60-
- name: test
61-
run: |
62-
bin/test -t !robot
63-
coverage:
64-
runs-on: ubuntu-24.04
65-
strategy:
66-
fail-fast: false
67-
matrix:
68-
include:
69-
- python: 3.13.1
70-
plone: "6.1"
71-
services:
72-
libreoffice:
73-
image: harbor.imio.be/library/libreoffice:7.3
74-
ports:
75-
- 2002:2002
76-
volumes:
77-
- /tmp:/tmp
78-
- /var/tmp:/var/tmp
79-
steps:
80-
- name: Checkout
81-
uses: actions/checkout@v4
82-
- name: Setup Env
83-
run: |
84-
mkdir -p -m 777 /tmp/appy/
85-
sudo add-apt-repository ppa:libreoffice/ppa -y
86-
sudo apt update -qq -y
87-
sudo apt-get install -qq -y libreoffice libreoffice-script-provider-python
88-
mkdir -p buildout-cache/{eggs,downloads}
89-
- name: Set up pyenv and Python
90-
uses: "gabrielfalcao/pyenv-action@v18"
91-
with:
92-
default: "${{ matrix.python }}"
93-
- name: Setup Python env
94-
run: |
95-
pip install --upgrade pip
96-
pip install -r requirements-${{ matrix.plone }}.txt
38+
pip install -r requirements-6.1.txt
9739
pip install -U coveralls
9840
- name: Cache eggs
9941
uses: actions/cache@v4
10042
env:
10143
cache-name: cache-eggs
10244
with:
10345
path: ~/buildout-cache/eggs
104-
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ matrix.python }}-${{ matrix.plone }}
46+
key: ${{ runner.os }}-test-${{ env.cache-name }}-3.13.1-6.1
10547
- name: buildout
10648
run: |
107-
sed -ie "s#test.cfg#test-${{matrix.plone}}.cfg#" gha.cfg
49+
buildout -c gha.cfg annotate
10850
buildout -c gha.cfg
10951
- name: code-analysis
11052
run: |

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,9 @@ CACHEDIR.TAG
5454
temp_auto_push.bat
5555
temp_interactive_push.bat
5656
.gitignore
57+
58+
# Buildout / pyenv
59+
.plone-version
60+
.plone.versioncheck.tracked.json
61+
.python-version
62+
checkversion*.html

CHANGES.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ Changelog
66

77
- Removed `.` at the end of field title `Templates to merge` and field title `Context variables`.
88
[gbastien]
9+
- Removed the duplicated "no value" option of the `style_template` field.
10+
[chris-adam]
11+
- Dropped Plone 6.0 support: only Plone 6.1 / Python 3.13 is supported.
12+
[chris-adam]
13+
- Reorganized the buildout configuration files and Makefile.
14+
[chris-adam]
915

1016
4.0 (2025-08-26)
1117
----------------

Makefile

Lines changed: 101 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,116 @@
11
#!/usr/bin/make
2-
#
3-
lo_version="7.3"
2+
# pyenv is a requirement, with the 3.13 python version, and virtualenv installed in it
3+
# plone parameter must be passed to create environment 'make setup plone=6.1' or after a make cleanall
4+
# The original Makefile can be found on https://github.com/IMIO/scripts-buildout
45

5-
args = $(filter-out $@,$(MAKECMDGOALS))
6+
SHELL=/bin/bash
7+
plones=6.1
8+
lo_version=7.3
9+
b_o=
10+
old_plone=$(shell [ -e .plone-version ] && cat .plone-version)
11+
12+
ifeq (, $(shell which pyenv))
13+
$(error "pyenv command not found! Aborting")
14+
endif
15+
16+
ifndef plone
17+
ifeq (,$(filter setup,$(MAKECMDGOALS)))
18+
plone=$(old_plone)
19+
endif
20+
endif
21+
22+
ifneq ($(wildcard bin/instance),)
23+
b_o=-N
24+
endif
25+
26+
ifndef python
27+
ifeq ($(plone),6.1)
28+
python=3.13
29+
endif
30+
endif
631

732
all: run
8-
py:=3.9
933

10-
.PHONY: bootstrap buildout run test cleanall startlibreoffice stoplibreoffice
11-
bootstrap:
12-
virtualenv -p python$(py) .
13-
bin/pip install -r requirements.txt
34+
.PHONY: help
35+
help:
36+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-18s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
1437

15-
buildout:
16-
if ! test -f bin/buildout;then make bootstrap;fi
17-
bin/buildout -Nt 5
38+
.python-version: ## Setups pyenv version
39+
@pyenv local `pyenv versions |grep " $(python)" |tail -1 |xargs`
40+
@echo "Local pyenv version is `cat .python-version`"
41+
@ if [[ `pyenv which virtualenv` != `pyenv prefix`* ]] ; then echo "You need to install virtualenv in `cat .python-version` pyenv python (pip install virtualenv)"; exit 1; fi
1842

19-
run:
20-
if ! test -f bin/instance;then make buildout;fi
43+
bin/buildout: .python-version ## Setups environment
44+
virtualenv .
45+
./bin/pip install --upgrade pip
46+
./bin/pip install -r requirements-$(plone).txt
47+
@echo "$(plone)" > .plone-version
48+
49+
.PHONY: setup
50+
setup: oneof-plone backup cleanall bin/buildout restore ## Setups environment for the given plone= version
51+
52+
.PHONY: buildout
53+
buildout: oneof-plone bin/buildout ## Runs setup and buildout
54+
bin/buildout -t 5 -c test-$(plone).cfg ${b_o}
55+
56+
.PHONY: run
57+
run: buildout ## Starts the instance in foreground
2158
mkdir -p var/tmp
22-
make startlibreoffice
59+
$(MAKE) startlibreoffice
2360
bin/instance fg
2461

25-
test:
26-
if ! test -f bin/test;then make buildout;fi
27-
make startlibreoffice
62+
.PHONY: test
63+
test: oneof-plone bin/buildout ## Runs the tests without robot
64+
# can be run by example with: make test opt='-t "settings"'
65+
$(MAKE) startlibreoffice
2866
rm -fr htmlcov
2967
bin/translation-manage -c
30-
if test -z "$(args)" ;then bin/test;else bin/test -t $(args);fi
31-
make stoplibreoffice
32-
33-
cleanall:
34-
rm -fr bin develop-eggs devel htmlcov include .installed.cfg lib .mr.developer.cfg parts downloads eggs local
35-
36-
startlibreoffice:
37-
make stoplibreoffice
38-
docker run -p 2002:2002\
39-
-d \
40-
--rm \
41-
--pull always \
42-
--name="oo_server" \
43-
-v /tmp:/tmp \
44-
-v /var/tmp:/var/tmp \
45-
harbor.imio.be/library/libreoffice:$(lo_version)
68+
bin/test -t \!robot ${opt}
69+
$(MAKE) stoplibreoffice
70+
71+
.PHONY: cleanall
72+
cleanall: ## Cleans all installed buildout files
73+
rm -fr bin include lib local share develop-eggs downloads eggs parts htmlcov .installed.cfg .mr.developer.cfg .python-version pyvenv.cfg
74+
75+
.PHONY: backup
76+
backup: ## Backups db files
77+
@if [ '$(old_plone)' != '' ] && [ -f var/filestorage/Data.fs ]; then mv var/filestorage/Data.fs var/filestorage/Data.fs.$(old_plone); mv var/blobstorage var/blobstorage.$(old_plone); fi
78+
79+
.PHONY: restore
80+
restore: ## Restores db files
81+
@if [ '$(plone)' != '' ] && [ -f var/filestorage/Data.fs.$(plone) ]; then mv var/filestorage/Data.fs.$(plone) var/filestorage/Data.fs; mv var/blobstorage.$(plone) var/blobstorage; fi
82+
83+
.PHONY: which-python
84+
which-python: oneof-plone ## Displays versions information
85+
@echo "current plone = $(old_plone)"
86+
@echo "current python = `cat .python-version`"
87+
@echo "plone var = $(plone)"
88+
@echo "python var = $(python)"
89+
90+
.PHONY: vcr
91+
vcr: ## Shows requirements in checkversion-r.html
92+
@bin/versioncheck -rbo checkversion-r-$(plone).html test-$(plone).cfg
93+
94+
.PHONY: vcn
95+
vcn: ## Shows newer packages in checkversion-n.html
96+
@bin/versioncheck -npbo checkversion-n-$(plone).html test-$(plone).cfg
97+
98+
.PHONY: startlibreoffice
99+
startlibreoffice: ## Starts the LibreOffice server container
100+
$(MAKE) stoplibreoffice
101+
docker run -p 2002:2002 -d --rm --pull always --name="oo_server" \
102+
-v /tmp:/tmp -v /var/tmp:/var/tmp \
103+
harbor.imio.be/library/libreoffice:$(lo_version)
46104
docker ps
47105

48-
stoplibreoffice:
106+
.PHONY: stoplibreoffice
107+
stoplibreoffice: ## Stops the LibreOffice server container
49108
if docker ps | grep oo_server;then docker stop oo_server;fi
109+
110+
.PHONY: guard-%
111+
guard-%:
112+
@ if [ "${${*}}" = "" ]; then echo "You must give a value for variable '$*' : like $*=xxx"; exit 1; fi
113+
114+
.PHONY: oneof-%
115+
oneof-%:
116+
@ if ! echo "${${*}s}" | tr " " '\n' |grep -Fqx "${${*}}"; then echo "Invalid '$*' parameter ('${${*}}') : must be one of '${${*}s}'"; exit 1; fi

base.cfg

Lines changed: 96 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,33 @@
22
package-name = collective.documentgenerator
33
package-extras = [test]
44

5+
extends =
6+
https://raw.github.com/collective/buildout.plonetest/master/qa.cfg
7+
checkouts.cfg
8+
59
show-picked-versions = true
610
allow-picked-versions = true
711

812
develop = .
913

10-
eggs +=
11-
Pillow
12-
1314
extensions +=
1415
mr.developer
16+
plone.versioncheck
1517

16-
always-checkout = force
17-
sources = sources
18+
parts +=
19+
instance
20+
omelette
21+
translation
22+
test
23+
robot
24+
createcoverage
25+
ploneversioncheck
1826

19-
sources-dir = devel
27+
eggs +=
28+
Pillow
29+
plone.reload
30+
Products.PDBDebugMode
31+
ipdb
2032

2133
[debug]
2234
eggs =
@@ -25,3 +37,81 @@ eggs =
2537
profilehooks
2638
zcml =
2739
iw.debug
40+
41+
[instance]
42+
eggs +=
43+
${debug:eggs}
44+
zcml +=
45+
${debug:zcml}
46+
47+
environment-vars =
48+
PYTHON_EGG_CACHE ${buildout:directory}/python-eggs
49+
zope_i18n_compile_mo_files true
50+
PYTHON_UNO /usr/bin/python3
51+
CUSTOM_TMP /tmp/appy
52+
ACTIVE_BIGBANG True
53+
PLONE_EXTENSION_IDS plonetheme.barceloneta:default,plone.app.caching:default,collective.documentgenerator:demo
54+
55+
[omelette]
56+
recipe = collective.recipe.omelette
57+
eggs = ${test:eggs}
58+
59+
[translation]
60+
recipe = infrae.i18nextract
61+
packages = ${buildout:package-name}
62+
output = ${buildout:directory}/src/collective/documentgenerator/locales
63+
output-package = ${buildout:package-name}
64+
domain = ${buildout:package-name}
65+
66+
[test]
67+
recipe = zc.recipe.testrunner
68+
eggs =
69+
${buildout:eggs}
70+
${buildout:package-name} ${buildout:package-extras}
71+
${debug:eggs}
72+
zcml =
73+
${debug:zcml}
74+
defaults = ['-s', '${buildout:package-name}', '--auto-color', '--auto-progress']
75+
environment = testenv
76+
77+
[testenv]
78+
zope_i18n_compile_mo_files = true
79+
OO_PORT = 2002
80+
PYTHON_UNO = /usr/bin/python3
81+
CUSTOM_TMP = /tmp/appy
82+
USE_STREAM = False
83+
84+
[robot]
85+
recipe = zc.recipe.egg
86+
eggs =
87+
Pillow
88+
${test:eggs}
89+
plone.app.robotframework[reload]
90+
91+
[ploneversioncheck]
92+
recipe = zc.recipe.egg
93+
eggs = plone.versioncheck
94+
95+
[code-analysis]
96+
flake8-max-complexity = 50
97+
flake8-ignore = E501, W503, W504, E203, Q000, C812
98+
directory = ${buildout:directory}/src/collective/documentgenerator
99+
flake8-extensions =
100+
flake8-isort
101+
102+
[coverage]
103+
recipe = zc.recipe.egg
104+
eggs = coverage
105+
106+
[test-coverage]
107+
recipe = collective.recipe.template
108+
input = inline:
109+
#!/bin/bash
110+
export TZ=UTC
111+
${buildout:directory}/bin/coverage run bin/test $*
112+
${buildout:directory}/bin/coverage html
113+
${buildout:directory}/bin/coverage report -m --fail-under=90
114+
# Fail (exit status 1) if coverage returns exit status 2 (this happens
115+
# when test coverage is below 100%.
116+
output = ${buildout:directory}/bin/test-coverage
117+
mode = 755

0 commit comments

Comments
 (0)