Skip to content

Commit c69cf3a

Browse files
committed
Add Plone 6 compatibility, drop Plone 4 compatibility
WIP
1 parent eee3a18 commit c69cf3a

42 files changed

Lines changed: 613 additions & 3736 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.coverage

732 KB
Binary file not shown.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*.pyc
44
.installed.cfg
55
.mr.developer.cfg
6+
.plone.versioncheck.tracked.json
67
.project
78
.pydevproject
89
.settings/

Makefile

Lines changed: 100 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,103 @@
1+
#!/usr/bin/make
2+
# pyenv is a requirement, with 2.7, 3.7, 3.10, 3.13 python versions, and virtualenv installed in each version
3+
# plone parameter must be passed to create environment 'make setup plone=6.0' or after a make cleanall
4+
# The original Makefile can be found on https://github.com/IMIO/scripts-buildout
15

2-
.PHONY: cleanall
3-
cleanall:
4-
rm -rf bin develop-eggs include lib parts .installed.cfg .mr.developer.cfg pyvenv.cfg
6+
SHELL=/bin/bash
7+
plones=4.3 5.2 6.0 6.1
8+
b_o=
9+
old_plone=$(shell [ -e .plone-version ] && cat .plone-version)
10+
11+
ifeq (, $(shell which pyenv))
12+
$(error "pyenv command not found! Aborting")
13+
endif
14+
15+
ifndef plone
16+
ifeq (,$(filter setup,$(MAKECMDGOALS)))
17+
plone=$(old_plone)
18+
endif
19+
endif
20+
21+
ifneq ($(wildcard bin/instance),)
22+
b_o=-N
23+
endif
24+
25+
ifndef python
26+
ifeq ($(plone),4.3)
27+
python=2.7
28+
endif
29+
ifeq ($(plone),5.2)
30+
python=3.8
31+
endif
32+
ifeq ($(plone),6.0)
33+
python=3.10
34+
endif
35+
ifeq ($(plone),6.1)
36+
python=3.13
37+
endif
38+
endif
39+
40+
all: buildout
41+
42+
.PHONY: help
43+
help:
44+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-10s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
45+
46+
.python-version: ## Setups pyenv version
47+
@pyenv local `pyenv versions |grep " $(python)" |tail -1 |xargs`
48+
@echo "Local pyenv version is `cat .python-version`"
49+
@ 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
50+
51+
bin/buildout: .python-version ## Setups environment
52+
virtualenv .
53+
./bin/pip install --upgrade pip
54+
./bin/pip install -r requirements-$(plone).txt
55+
@echo "$(plone)" > .plone-version
56+
57+
.PHONY: setup
58+
setup: oneof-plone backup cleanall bin/buildout restore ## Setups environment
559

660
.PHONY: buildout
7-
buildout:
8-
virtualenv -p python2 .
9-
bin/pip install -r requirements.txt
10-
bin/buildout
61+
buildout: oneof-plone bin/buildout ## Runs setup and buildout
62+
rm -f .installed.cfg .mr.developer.cfg
63+
bin/buildout -t 5 -c test-$(plone).cfg ${b_o}
64+
65+
.PHONY: test
66+
test: oneof-plone bin/buildout ## run bin/test without robot
67+
# can be run by example with: make test opt='-t "settings"'
68+
bin/test -t \!robot ${opt}
69+
70+
.PHONY: cleanall
71+
cleanall: ## Cleans all installed buildout files
72+
rm -fr bin include lib local share develop-eggs downloads eggs parts .installed.cfg .mr.developer.cfg .python-version pyvenv.cfg
73+
74+
.PHONY: backup
75+
backup: ## Backups db files
76+
@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
77+
78+
.PHONY: restore
79+
restore: ## Restores db files
80+
@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
81+
82+
.PHONY: which-python
83+
which-python: oneof-plone ## Displays versions information
84+
@echo "current plone = $(old_plone)"
85+
@echo "current python = `cat .python-version`"
86+
@echo "plone var = $(plone)"
87+
@echo "python var = $(python)"
88+
89+
.PHONY: vcr
90+
vcr: ## Shows requirements in checkversion-r.html
91+
@bin/versioncheck -rbo checkversion-r-$(plone).html test-$(plone).cfg
92+
93+
.PHONY: vcn
94+
vcn: ## Shows newer packages in checkversion-n.html
95+
@bin/versioncheck -npbo checkversion-n-$(plone).html test-$(plone).cfg
96+
97+
.PHONY: guard-%
98+
guard-%:
99+
@ if [ "${${*}}" = "" ]; then echo "You must give a value for variable '$*' : like $*=xxx"; exit 1; fi
100+
101+
.PHONY: oneof-%
102+
oneof-%:
103+
@ if ! echo "${${*}s}" | tr " " '\n' |grep -Fqx "${${*}}"; then echo "Invalid '$*' parameter ('${${*}}') : must be one of '${${*}s}'"; exit 1; fi

base.cfg

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
[buildout]
2+
package-name = Products.CPUtils
3+
package-extras = [test]
4+
5+
extends =
6+
https://raw.githubusercontent.com/collective/buildout.plonetest/master/qa.cfg
7+
checkouts.cfg
8+
9+
extensions =
10+
mr.developer
11+
plone.versioncheck
12+
13+
parts +=
14+
instance
15+
omelette
16+
ploneversioncheck
17+
createcoverage
18+
robot
19+
# coverage
20+
# test-coverage
21+
# plone-helper-scripts
22+
23+
develop = .
24+
25+
eggs +=
26+
Plone
27+
Pillow
28+
# Products.PDBDebugMode
29+
# collective.profiler
30+
# ipdb
31+
pdbp
32+
# plone.reload
33+
34+
package-extras +=
35+
pdbp
36+
37+
always-checkout = force
38+
39+
[instance]
40+
environment-vars +=
41+
PYTHONBREAKPOINT pdbp.set_trace
42+
eggs +=
43+
${buildout:eggs}
44+
zcml +=
45+
46+
[test]
47+
environment = testenv
48+
initialization +=
49+
os.environ['PYTHONBREAKPOINT'] = 'pdbp.set_trace'
50+
51+
[testenv]
52+
zope_i18n_compile_mo_files = true
53+
54+
[omelette]
55+
recipe = collective.recipe.omelette
56+
eggs = ${test:eggs}
57+
58+
[ploneversioncheck]
59+
recipe = zc.recipe.egg
60+
eggs = plone.versioncheck
61+
62+
[code-analysis]
63+
recipe = plone.recipe.codeanalysis
64+
pre-commit-hook = True
65+
return-status-codes = True
66+
directory = ${buildout:directory}/src/Products/CPUtils
67+
flake8-ignore = E123,E124,E501,E126,E127,E128,W391,C901,W503,W504
68+
flake8-extensions =
69+
flake8-isort
70+
71+
[robot]
72+
recipe = zc.recipe.egg
73+
eggs =
74+
Pillow
75+
${test:eggs}
76+
plone.app.robotframework[reload, debug]
77+
78+
[coverage]
79+
recipe = zc.recipe.egg
80+
eggs = coverage
81+
82+
[test-coverage]
83+
recipe = collective.recipe.template
84+
input = inline:
85+
#!/bin/bash
86+
export TZ=UTC
87+
${buildout:directory}/bin/coverage run bin/test $*
88+
${buildout:directory}/bin/coverage html
89+
${buildout:directory}/bin/coverage report -m --fail-under=90
90+
# Fail (exit status 1) if coverage returns exit status 2 (this happens
91+
# when test coverage is below 100%.
92+
output = ${buildout:directory}/bin/test-coverage
93+
mode = 755
94+
95+
[plone-helper-scripts]
96+
recipe = zc.recipe.egg
97+
eggs =
98+
Products.CMFPlone
99+
${instance:eggs}
100+
interpreter = zopepy
101+
scripts =
102+
zopepy
103+
plone-compile-resources

buildout.cfg

Lines changed: 0 additions & 128 deletions
This file was deleted.

checkouts.cfg

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[buildout]
2+
always-checkout = force
3+
auto-checkout +=
4+
imio.helpers
5+
collective.ckeditor
6+
collective.quickupload
7+
collective.plonefinder
8+
9+
[remotes]
10+
imio = https://github.com/imio
11+
imio_push = git@github.com:imio
12+
plone = https://github.com/plone
13+
plone_push = git@github.com:plone
14+
ftw = https://github.com/4teamwork
15+
ftw_push = git@github.com:4teamwork
16+
zopefoundation = https://github.com/zopefoundation
17+
zopefoundation_push = git@github.com:zopefoundation
18+
zopesvn = svn://svn.zope.org/repos/main/
19+
collective = https://github.com/collective
20+
collective_push = git@github.com:collective
21+
22+
[sources]
23+
imio.helpers = git ${remotes:imio}/imio.helpers.git pushurl=${remotes:imio_push}/imio.helpers.git
24+
collective.ckeditor = git ${remotes:collective}/collective.ckeditor.git
25+
collective.quickupload = git ${remotes:collective}/collective.quickupload.git
26+
collective.plonefinder = git ${remotes:collective}/collective.plonefinder.git branch=plone5

ci.cfg

Lines changed: 0 additions & 7 deletions
This file was deleted.

gha.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[buildout]
2+
extends =
3+
test.cfg
4+
eggs-directory = ~/buildout-cache/eggs
5+
download-cache = ~/buildout-cache/downloads

requirements-6.0.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-c https://dist.plone.org/release/6.0-latest/requirements.txt
2+
setuptools
3+
zc.buildout

0 commit comments

Comments
 (0)