diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index b51f684..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: collective.blueprint.usersandgroups CI -on: [push] -jobs: - build: - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: - python-version: [2.7] - tox-environment: [py27-Plone43, py27-Plone51, py27-Plone52] - include: - - python-version: 3.7 - tox-environment: py37-Plone52 - - python-version: 3.8 - tox-environment: py38-Plone52 - - python-version: 3.8 - tox-environment: py38-lint - - steps: - # git checkout - - uses: actions/checkout@v2 - - # python setup - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - # python cache - - uses: actions/cache@v1 - with: - path: | - ~/.cache/pip - ~/buildout-cache - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - - name: Install xmllint - run: sudo apt-get install libxml2-dev libxslt1-dev - - # before install - - name: before install - run: | - mkdir -p $HOME/buildout-cache/{downloads,eggs,extends} - mkdir -p $HOME/buildout-cache/{downloads,eggs,extends} - mkdir -p $HOME/.buildout - echo "[buildout]" > $HOME/.buildout/default.cfg - echo "download-cache = $HOME/buildout-cache/downloads" >> $HOME/.buildout/default.cfg - echo "eggs-directory = $HOME/buildout-cache/eggs" >> $HOME/.buildout/default.cfg - echo "extends-cache = $HOME/buildout-cache/extends" >> $HOME/.buildout/default.cfg - echo "abi-tag-eggs = true" >> $HOME/.buildout/default.cfg - git config --global user.email "githubaction@github.com" - git config --global user.name "GitHub Action CI" - - # virtualenv install - - run: pip install virtualenv - - # Install dependencies - - run: pip install -U tox coveralls coverage -c constraints.txt - - # test - - name: test - run: PYTEST_ADDOPTS="-s -vv" tox -e ${{ matrix.tox-environment }} diff --git a/.github/workflows/code-analysis.yml b/.github/workflows/code-analysis.yml new file mode 100644 index 0000000..f2ca094 --- /dev/null +++ b/.github/workflows/code-analysis.yml @@ -0,0 +1,67 @@ +name: Code Analysis +on: + push: + +jobs: + black: + name: Black + runs-on: ubuntu-latest + + steps: + - name: Checkout codebase + uses: actions/checkout@v3 + + - name: Run check + uses: plone/code-analysis-action@v2 + with: + check: 'black' + + flake8: + name: flake8 + runs-on: ubuntu-latest + + steps: + - name: Checkout codebase + uses: actions/checkout@v2 + + - name: Run check + uses: plone/code-analysis-action@v2 + with: + check: 'flake8' + + isort: + runs-on: ubuntu-latest + steps: + - name: Checkout codebase + uses: actions/checkout@v2 + + - name: Run check + uses: plone/code-analysis-action@v2 + with: + check: 'isort' + + pyroma: + name: pyroma + runs-on: ubuntu-latest + + steps: + - name: Checkout codebase + uses: actions/checkout@v2 + + - name: Run check + uses: plone/code-analysis-action@v2 + with: + check: 'pyroma' + + zpretty: + name: zpretty + runs-on: ubuntu-latest + + steps: + - name: Checkout codebase + uses: actions/checkout@v2 + + - name: Run check + uses: plone/code-analysis-action@v2 + with: + check: 'zpretty' diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..2887e8b --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,39 @@ +name: Tests +on: [push] +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python: ["3.7", "3.8", "3.9", "3.10", "3.11"] + plone: ["6.0-latest", "5.2-latest"] + exclude: + - plone: "5.2-latest" + python: "3.9" + - plone: "5.2-latest" + python: "3.10" + - plone: "5.2-latest" + python: "3.11" + - plone: "6.0-latest" + python: "3.7" + + steps: + # git checkout + - uses: actions/checkout@v3 + + - name: Setup Plone ${{ matrix.plone }} with Python ${{ matrix.python }} + id: setup + uses: plone/setup-plone@v2.0.0 + with: + python-version: ${{ matrix.python }} + plone-version: ${{ matrix.plone }} + + - name: Install package + run: | + pip install -e ".[test]" + + # test + - name: test + run: | + zope-testrunner --auto-color --auto-progress --test-path src diff --git a/.gitignore b/.gitignore index 08bb2ab..82e2eed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,41 +1,41 @@ +.*project .coverage +.coverage.* +.installed.cfg +.mr.developer.cfg +.tox/ +.vscode/ *.egg-info *.log *.mo *.py? *.swp -.*project -.coverage.* +/.settings +/compiled-doc.rst +/local.cfg +/pyvenv.cfg +/src/collective* # dirs -.settings +# files bin/ buildout-cache/ develop-eggs/ +dist/* eggs/ +etc htmlcov/ include/ +inituser lib/ -local/ -node_modules/ -parts/ -dist/* -test.plone_addon/ -var/ -# files -.installed.cfg -.mr.developer.cfg lib64 +local/ log.html +node_modules/ output.xml +parts/ pip-selfcheck.json report.html -.vscode/ -.tox/ reports/ -docs/Makefile -docs/make.bat -docs/doctrees -docs/html -/pyvenv.cfg -local.cfg -/src/collective.transmogrifier* +test.plone_addon/ +var/ +venv/ diff --git a/CHANGES.rst b/CHANGES.md similarity index 50% rename from CHANGES.rst rename to CHANGES.md index d46eee5..4268fb5 100644 --- a/CHANGES.rst +++ b/CHANGES.md @@ -1,18 +1,25 @@ -0.3.2 (unreleased) ------------------- +## 1.0.0 (unreleased) -- Nothing changed yet. +- Add support to Plone 6.0. + [wesleybl] + +- Add support to Python 3.9, 3.10 and 3.11. + [wesleybl] + +- Drop support to Python 2.7. + [wesleybl] + +- Drop support to Plone 4.3 and 5.1. + [wesleybl] -0.3.1 (2023-04-28) ------------------- +## 0.3.1 (2023-04-28) - Fix python_requires, in order to allow the package to be installed with pip. [wesleybl] -0.3.0 (2021-09-28) ------------------- +## 0.3.0 (2021-09-28) - Add support to Python 3.7 and Python 3.8. [wesleybl] @@ -24,8 +31,6 @@ [wesleybl] -0.2.0 (2015-06-07) ------------------- +## 0.2.0 (2015-06-07) - Fixed MANIFEST.in - diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.md similarity index 71% rename from CONTRIBUTORS.rst rename to CONTRIBUTORS.md index a004c49..3bf3e70 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.md @@ -1,5 +1,4 @@ -Contributors -============ +## Contributors - Rok Garbas, rok@garbas.si - Wesley Barroso, wesleybl@gmail.com diff --git a/DEVELOP.rst b/DEVELOP.rst deleted file mode 100644 index cd8979a..0000000 --- a/DEVELOP.rst +++ /dev/null @@ -1,42 +0,0 @@ -Using the development buildout -============================== - -Create a virtualenv in the package:: - - $ virtualenv --clear . - -Install requirements with pip:: - - $ ./bin/pip install -r requirements.txt - -Run buildout:: - - $ ./bin/buildout - -Start Plone in foreground: - - $ ./bin/instance fg - - -Running tests -------------- - - $ tox - -list all tox environments: - - $ tox -l - py27-Plone43 - py27-Plone51 - py27-Plone52 - py37-Plone52 - build_instance - code-analysis - lint-py27 - lint-py37 - coverage-report - -run a specific tox env: - - $ tox -e py37-Plone52 - diff --git a/LICENSE.rst b/LICENSE.md similarity index 100% rename from LICENSE.rst rename to LICENSE.md diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b5fc01e --- /dev/null +++ b/Makefile @@ -0,0 +1,109 @@ +### Defensive settings for make: +# https://tech.davis-hansson.com/p/make/ +SHELL:=bash +.ONESHELL: +.SHELLFLAGS:=-xeu -o pipefail -O inherit_errexit -c +.SILENT: +.DELETE_ON_ERROR: +MAKEFLAGS+=--warn-undefined-variables +MAKEFLAGS+=--no-builtin-rules + +# We like colors +# From: https://coderwall.com/p/izxssa/colored-makefile-for-golang-projects +RED=`tput setaf 1` +GREEN=`tput setaf 2` +RESET=`tput sgr0` +YELLOW=`tput setaf 3` + +PLONE5=5.2-latest +PLONE6=6.0-latest + +ifndef LOG_LEVEL + LOG_LEVEL=INFO +endif + +CODE_QUALITY_VERSION=2.0.0 +CURRENT_USER=$$(whoami) +USER_INFO=$$(id -u ${CURRENT_USER}):$$(getent group ${CURRENT_USER}|cut -d: -f3) +BASE_FOLDER=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) +LINT=docker run -e LOG_LEVEL="${LOG_LEVEL}" --rm -v "${BASE_FOLDER}":/github/workspace plone/code-quality:${CODE_QUALITY_VERSION} check +FORMAT=docker run --user="${USER_INFO}" -e LOG_LEVEL="${LOG_LEVEL}" --rm -v "${BASE_FOLDER}":/github/workspace plone/code-quality:${CODE_QUALITY_VERSION} format + +all: build + +# Add the following 'help' target to your Makefile +# And add help text after each target name starting with '\#\#' +.PHONY: help +help: ## This help message + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + +bin/pip: + @echo "$(GREEN)==> Setup Virtual Env$(RESET)" + python3.11 -m venv . + bin/pip install -U pip wheel + +.PHONY: build +build: bin/pip ## Build Plone 6.0 + @echo "$(GREEN)==> Build with Plone 6.0$(RESET)" + bin/pip install Plone -c https://dist.plone.org/release/$(PLONE6)/constraints.txt + bin/pip install "zest.releaser[recommended]" + bin/pip install -e ".[test]" + bin/mkwsgiinstance -d . -u admin:admin + +.PHONY: clean +clean: ## Remove old virtualenv and creates a new one + @echo "$(RED)==> Cleaning environment and build$(RESET)" + rm -rf bin lib lib64 include share etc var inituser pyvenv.cfg .installed.cfg + +.PHONY: format +format: ## Format the codebase according to our standards + @echo "$(GREEN)==> Format codebase$(RESET)" + $(FORMAT) + +.PHONY: format-black +format-black: ## Format the codebase with black + @echo "$(GREEN)==> Format codebase with black$(RESET)" + $(FORMAT) black ${CODEPATH} + +.PHONY: format-isort +format-isort: ## Format the codebase with isort + @echo "$(GREEN)==> Format codebase with isort$(RESET)" + $(FORMAT) isort ${CODEPATH} + +.PHONY: format-zpretty +format-zpretty: ## Format the codebase with zpretty + @echo "$(GREEN)==> Format codebase with zpretty$(RESET)" + $(FORMAT) zpretty ${CODEPATH} + +.PHONY: lint +lint: ## check code style + $(LINT) + +.PHONY: lint-black +lint-black: ## validate black formating + $(LINT) black ${CODEPATH} + +.PHONY: lint-flake8 +lint-flake8: ## validate black formating + $(LINT) flake8 ${CODEPATH} + +.PHONY: lint-isort +lint-isort: ## validate using isort + $(LINT) isort ${CODEPATH} + +.PHONY: lint-pyroma +lint-pyroma: ## validate using pyroma + $(LINT) pyroma ${CODEPATH} + +.PHONY: lint-zpretty +lint-zpretty: ## validate ZCML/XML using zpretty + $(LINT) zpretty ${CODEPATH} + +.PHONY: test +test: ## run tests + PYTHONWARNINGS=ignore ./bin/zope-testrunner --auto-color --auto-progress --test-path src/ + +.PHONY: start +start: ## Start a Plone instance on localhost:8080 + PYTHONWARNINGS=ignore ./bin/runwsgi etc/zope.ini + diff --git a/README.md b/README.md new file mode 100644 index 0000000..63dcde3 --- /dev/null +++ b/README.md @@ -0,0 +1,61 @@ +

collective.blueprint.usersandgroups

+ +
+ +[![PyPI](https://img.shields.io/pypi/v/collective.blueprint.usersandgroups)](https://pypi.org/project/collective.blueprint.usersandgroups/) +[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/collective.blueprint.usersandgroups)](https://pypi.org/project/collective.blueprint.usersandgroups/) +[![PyPI - Wheel](https://img.shields.io/pypi/wheel/collective.blueprint.usersandgroups)](https://pypi.org/project/collective.blueprint.usersandgroups/) +[![PyPI - License](https://img.shields.io/pypi/l/collective.blueprint.usersandgroups)](https://pypi.org/project/collective.blueprint.usersandgroups/) +[![PyPI - Status](https://img.shields.io/pypi/status/collective.blueprint.usersandgroups)](https://pypi.org/project/collective.blueprint.usersandgroups/) + + +[![PyPI - Plone Versions](https://img.shields.io/pypi/frameworkversions/plone/collective.blueprint.usersandgroups)](https://pypi.org/project/collective.blueprint.usersandgroups/) + +[![Code analysis checks](https://github.com/collective/collective.blueprint.usersandgroups/actions/workflows/code-analysis.yml/badge.svg)](https://github.com/collective/collective.blueprint.usersandgroups/actions/workflows/code-analysis.yml) +[![Tests](https://github.com/collective/collective.blueprint.usersandgroups/actions/workflows/tests.yml/badge.svg)](https://github.com/collective/collective.blueprint.usersandgroups/actions/workflows/tests.yml) +![Code Style](https://img.shields.io/badge/Code%20Style-Black-000000) + +[![GitHub contributors](https://img.shields.io/github/contributors/collective/collective.blueprint.usersandgroups)](https://github.com/collective/collective.blueprint.usersandgroups) +[![GitHub Repo stars](https://img.shields.io/github/stars/collective/collective.blueprint.usersandgroups?style=social)](https://github.com/collective/collective.blueprint.usersandgroups) + +
+ +Transmogrifier blueprint to migrate users and groups + +## Developing this package + +Create the virtual enviroment and install all dependencies: + +```shell +make build +``` + +Start Plone in foreground: + +```shell +make start +``` + + +### Running tests + +```shell +make tests +``` + + +### Formatting the codebase + +```shell +make format +``` + +### Linting the codebase + +```shell +make lint +``` + +## License + +The project is licensed under the GPLv2. diff --git a/README.rst b/README.rst deleted file mode 100644 index 6178f3a..0000000 --- a/README.rst +++ /dev/null @@ -1,94 +0,0 @@ -.. This README is meant for consumption by humans and pypi. Pypi can render rst files so please do not use Sphinx features. - If you want to learn more about writing documentation, please check out: http://docs.plone.org/about/documentation_styleguide.html - This text does not appear on pypi or github. It is a comment. - -.. image:: https://travis-ci.org/collective/collective.blueprint.usersandgroups.svg?branch=master - :target: https://travis-ci.org/collective/collective.blueprint.usersandgroups - -.. image:: https://coveralls.io/repos/github/collective/collective.blueprint.usersandgroups/badge.svg?branch=master - :target: https://coveralls.io/github/collective/collective.blueprint.usersandgroups?branch=master - :alt: Coveralls - -.. image:: https://img.shields.io/pypi/v/collective.blueprint.usersandgroups.svg - :target: https://pypi.python.org/pypi/collective.blueprint.usersandgroups/ - :alt: Latest Version - -.. image:: https://img.shields.io/pypi/status/collective.blueprint.usersandgroups.svg - :target: https://pypi.python.org/pypi/collective.blueprint.usersandgroups - :alt: Egg Status - -.. image:: https://img.shields.io/pypi/pyversions/collective.blueprint.usersandgroups.svg?style=plastic :alt: Supported - Python Versions - -.. image:: https://img.shields.io/pypi/l/collective.blueprint.usersandgroups.svg - :target: https://pypi.python.org/pypi/collective.blueprint.usersandgroups/ - :alt: License - - -=================================== -collective.blueprint.usersandgroups -=================================== - -Tell me what your product does - -Features --------- - -- Can be bullet points - - -Examples --------- - -This add-on can be seen in action at the following sites: -- Is there a page on the internet where everybody can see the features? - - -Documentation -------------- - -Full documentation for end users can be found in the "docs" folder, and is also available online at http://docs.plone.org/foo/bar - - -Translations ------------- - -This product has been translated into - -- Klingon (thanks, K'Plai) - - -Installation ------------- - -Install collective.blueprint.usersandgroups by adding it to your buildout:: - - [buildout] - - ... - - eggs = - collective.blueprint.usersandgroups - - -and then running ``bin/buildout`` - - -Contribute ----------- - -- Issue Tracker: https://github.com/collective/collective.blueprint.usersandgroups/issues -- Source Code: https://github.com/collective/collective.blueprint.usersandgroups -- Documentation: https://docs.plone.org/foo/bar - - -Support -------- - -If you are having issues, please let us know. -We have a mailing list located at: project@example.com - - -License -------- - -The project is licensed under the GPLv2. diff --git a/base.cfg b/base.cfg deleted file mode 100644 index 96f7109..0000000 --- a/base.cfg +++ /dev/null @@ -1,116 +0,0 @@ -[buildout] -show-picked-versions = true -extensions = - mr.developer - -parts = - instance - test -# we use tox for testing and linting, by default -# code-analysis - coverage - test-coverage - createcoverage - releaser - i18ndude - omelette - robot - plone-helper-scripts - -develop = . - - -[instance] -recipe = plone.recipe.zope2instance -user = admin:admin -http-address = 8080 -environment-vars = - zope_i18n_compile_mo_files true -eggs = - Plone - Pillow - collective.blueprint.usersandgroups [test] - -# [code-analysis] -# recipe = plone.recipe.codeanalysis -# directory = ${buildout:directory}/src/collective -# return-status-codes = False - - -[omelette] -recipe = collective.recipe.omelette -eggs = ${instance:eggs} - - -[test] -recipe = zc.recipe.testrunner -eggs = ${instance:eggs} -initialization = - os.environ['TZ'] = 'UTC' -defaults = ['-s', 'collective.blueprint.usersandgroups', '--auto-color', '--auto-progress'] - - -[coverage] -recipe = zc.recipe.egg -eggs = coverage - - -[test-coverage] -recipe = collective.recipe.template -input = inline: - #!/bin/bash - export TZ=UTC - ${buildout:directory}/bin/coverage run bin/test $* - ${buildout:directory}/bin/coverage html - ${buildout:directory}/bin/coverage report -m --fail-under=90 - # Fail (exit status 1) if coverage returns exit status 2 (this happens - # when test coverage is below 100%. -output = ${buildout:directory}/bin/test-coverage -mode = 755 - - -[createcoverage] -recipe = zc.recipe.egg -eggs = createcoverage - - -[robot] -recipe = zc.recipe.egg -eggs = - ${test:eggs} - plone.app.robotframework[debug,reload] - - -[releaser] -recipe = zc.recipe.egg -eggs = zest.releaser - - -[i18ndude] -recipe = zc.recipe.egg -eggs = i18ndude - -[plone-helper-scripts] -recipe = zc.recipe.egg -eggs = - Products.CMFPlone - ${instance:eggs} -interpreter = zopepy -scripts = - zopepy - plone-compile-resources - -[versions] -# Don't use a released version of collective.blueprint.usersandgroups -collective.blueprint.usersandgroups = - -# keep in sync with requirements.txt -setuptools = 65.7.0 -zc.buildout = 3.0.1 -wheel = 0.38.4 - -[versions:python27] -# !! keep in sync with requirements.txt !! -setuptools = 42.0.2 -zc.buildout = 2.13.8 -wheel = 0.37.1 diff --git a/bobtemplate.cfg b/bobtemplate.cfg deleted file mode 100644 index f02f7d1..0000000 --- a/bobtemplate.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[main] -version = 5.2.5 -template = plone_addon -git_init = False -python = python3.8 diff --git a/buildout.cfg b/buildout.cfg deleted file mode 100644 index 55c8a3c..0000000 --- a/buildout.cfg +++ /dev/null @@ -1,8 +0,0 @@ -[buildout] - -# use this extend one of the buildout configuration: -extends = -# -*- mrbob: extra extends -*- -# test_plone43.cfg -# test_plone51.cfg - test_plone52.cfg diff --git a/constraints.txt b/constraints.txt deleted file mode 100644 index 24cbf87..0000000 --- a/constraints.txt +++ /dev/null @@ -1 +0,0 @@ --c constraints_plone52.txt diff --git a/constraints_plone43.txt b/constraints_plone43.txt deleted file mode 100644 index 848b28f..0000000 --- a/constraints_plone43.txt +++ /dev/null @@ -1 +0,0 @@ --c https://dist.plone.org/release/5.2-latest/requirements.txt diff --git a/constraints_plone51.txt b/constraints_plone51.txt deleted file mode 100644 index 848b28f..0000000 --- a/constraints_plone51.txt +++ /dev/null @@ -1 +0,0 @@ --c https://dist.plone.org/release/5.2-latest/requirements.txt diff --git a/constraints_plone52.txt b/constraints_plone52.txt deleted file mode 100644 index 848b28f..0000000 --- a/constraints_plone52.txt +++ /dev/null @@ -1 +0,0 @@ --c https://dist.plone.org/release/5.2-latest/requirements.txt diff --git a/docs/conf.py b/docs/conf.py index 65f3091..cfe76db 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # collective.blueprint.usersandgroups documentation build configuration file, # created by sphinx-quickstart on Mon Sep 14 7:18:09 2010. @@ -44,8 +43,8 @@ master_doc = "index" # General information about the project. -project = u"collective.blueprint.usersandgroups" -copyright = u"2010, garbas" +project = "collective.blueprint.usersandgroups" +copyright = "2010, garbas" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -185,8 +184,8 @@ ( "index", "collective-blueprint-usersandgroups.tex", - u"collective.blueprint.usersandgroups Documentation", - u"garbas", + "collective.blueprint.usersandgroups Documentation", + "garbas", "manual", ), ] @@ -223,8 +222,8 @@ ( "index", "usersandgroups", - u"collective.blueprint.usersandgroups documentation", - [u"garbas"], + "collective.blueprint.usersandgroups documentation", + ["garbas"], 1, ) ] @@ -233,10 +232,10 @@ # -- Options for Epub output --------------------------------------------------- # Bibliographic Dublin Core info. -epub_title = u"collective.blueprint.usersandgroups" -epub_author = u"garbas" -epub_publisher = u"garbas" -epub_copyright = u"2010, garbas" +epub_title = "collective.blueprint.usersandgroups" +epub_author = "garbas" +epub_publisher = "garbas" +epub_copyright = "2010, garbas" # The language of the text. It defaults to the language option # or en if the language is not set. diff --git a/docs/creategroup.rst b/docs/creategroup.md similarity index 56% rename from docs/creategroup.rst rename to docs/creategroup.md index ca08fa6..9933d5a 100644 --- a/docs/creategroup.rst +++ b/docs/creategroup.md @@ -1,21 +1,18 @@ -``collective.blueprint.usersandgroups.creategroup`` -=================================================== +

collective.blueprint.usersandgroups.creategroup

Create groups. -Parameters ----------- +# Parameters No parameters. Expected data in pipeline: - * **_groupname**: group name +> - **\_groupname**: group name -Example -------- +# Example -Configuration:: +Configuration: [tranmogrifier] pipeline = @@ -27,11 +24,8 @@ Configuration:: [creategroup] blueprint = collective.blueprint.usersandgroups.creategroup -Data in pipeline:: +Data in pipeline: { "_groupname": "Administrators" } - - - diff --git a/docs/createuser.md b/docs/createuser.md new file mode 100644 index 0000000..7810bdf --- /dev/null +++ b/docs/createuser.md @@ -0,0 +1,39 @@ +

collective.blueprint.usersandgroups.createuser

+ +Create users. + +TODO + +: since in plone2.0 are passwords stored in plain text I didn\'t even + try to migrate already encripted passwords. This might happen when I + do migration from plone2.5 site (or somebody else does it). + +# Parameters + +No parameters. + +Expected data in pipeline: + +> - **\_username**: username +> - **\_password**: plain password + +# Example + +Configuration: + + [tranmogrifier] + pipeline = + source + createuser + + ... + + [createuser] + blueprint = collective.blueprint.usersandgroups.createuser + +Data in pipeline: + + { + "_username": "rokgarbas", + "_password": "rok-garbas-password" + } diff --git a/docs/createuser.rst b/docs/createuser.rst deleted file mode 100644 index 1997dfa..0000000 --- a/docs/createuser.rst +++ /dev/null @@ -1,42 +0,0 @@ -``collective.blueprint.usersandgroups.createuser`` -================================================== - -Create users. - -:TODO: since in plone2.0 are passwords stored in plain text I didn't even try - to migrate already encripted passwords. This might happen when I do - migration from plone2.5 site (or somebody else does it). - -Parameters ----------- - -No parameters. - -Expected data in pipeline: - - * **_username**: username - * **_password**: plain password - -Example -------- - -Configuration:: - - [tranmogrifier] - pipeline = - source - createuser - - ... - - [createuser] - blueprint = collective.blueprint.usersandgroups.createuser - -Data in pipeline:: - - { - "_username": "rokgarbas", - "_password": "rok-garbas-password" - } - - diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..dcbb235 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,24 @@ +# collective.blueprint.usersandgroups\'s documentation! + +List of blueprints built to help you import users and groups in Plone. + +In source of this package in `exports_scripts` directory is also a +helping export script `plone2.0_export.py` which provides a external +method `export` to export data from Plone 2.0 (script might also work +with higher versions of plone 2.1, 2.5, but was not tested) in format +that is suitable for `collective.blueprint.usersandgroups.*` blueprints. + +And if you might forgot, migration is a bitch \... but somebody has to +do it :P + +# Avaliable blueprints + +::: {.toctree maxdepth="1"} +createuser updateuserproperty creategroup updategroupproperty +::: + +# Indices and tables + +- `genindex`{.interpreted-text role="ref"} +- `modindex`{.interpreted-text role="ref"} +- `search`{.interpreted-text role="ref"} diff --git a/docs/index.rst b/docs/index.rst deleted file mode 100644 index 6f74e2c..0000000 --- a/docs/index.rst +++ /dev/null @@ -1,32 +0,0 @@ -collective.blueprint.usersandgroups's documentation! -==================================================== - -List of blueprints built to help you import users and groups in Plone. - -In source of this package in ``exports_scripts`` directory is also a helping -export script ``plone2.0_export.py`` which provides a external method -``export`` to export data from Plone 2.0 (script might also work with -higher versions of plone 2.1, 2.5, but was not tested) in format that is -suitable for ``collective.blueprint.usersandgroups.*`` blueprints. - -And if you might forgot, migration is a bitch ... but somebody has to do it :P - - -Avaliable blueprints -==================== - -.. toctree:: - :maxdepth: 1 - - createuser - updateuserproperty - creategroup - updategroupproperty - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` - diff --git a/docs/updategroupproperty.md b/docs/updategroupproperty.md new file mode 100644 index 0000000..e0adc55 --- /dev/null +++ b/docs/updategroupproperty.md @@ -0,0 +1,63 @@ +

collective.blueprint.usersandgroups.updategroupproperty

+ +Update group properties. + +TODO + +: need to review this blueprint since it was done just to solve + problem. Things to fix: + +> - `_roles` key in data pipeline should be ranamed to `_group_roles` +> or similar. +> - `_properties` key in data pipeline should be renamed to +> `_group_properties` or similar. +> - `_plone_site` shoud be removed and plone site resolved from +> context. +> - get rid of `_root_group`, since this problem should be solved in +> the pipeline + +# Parameters + +No parameters. + +Expected data in pipeline: + +> - **\_groupname**: group name we want to update +> - **\_roles**: roles of group +> - **\_plone_site**: plone site to operate on +> - **\_properties**: group properties +> - **\_group_groups**: groups of group +> - **\_root_group**: marking group as root group + +# Example + +Configuration: + + [tranmogrifier] + pipeline = + source + updategroupproperty + + ... + + [updategroupproperty] + blueprint = collective.blueprint.usersandgroups.updategroupproperty + +Data in pipeline: + + { + "_groupname": "Administrators", + "_root_group": true, + "_plone_site": "/Plone", + "_roles": [ + "Manager", + ], + "_properties": { + "email": "admins@site.tld" + ... + }, + "_group_groups": [ + "ContentAdministrators", + ... + ], + } diff --git a/docs/updategroupproperty.rst b/docs/updategroupproperty.rst deleted file mode 100644 index 6b2c647..0000000 --- a/docs/updategroupproperty.rst +++ /dev/null @@ -1,65 +0,0 @@ -``collective.blueprint.usersandgroups.updategroupproperty`` -=========================================================== - -Update group properties. - -:TODO: need to review this blueprint since it was done just to solve problem. Things to fix: - - * ``_roles`` key in data pipeline should be ranamed to - ``_group_roles`` or similar. - * ``_properties`` key in data pipeline should be renamed to - ``_group_properties`` or similar. - * ``_plone_site`` shoud be removed and plone site resolved from context. - * get rid of ``_root_group``, since this problem should be solved in the pipeline - -Parameters ----------- - -No parameters. - -Expected data in pipeline: - - * **_groupname**: group name we want to update - * **_roles**: roles of group - * **_plone_site**: plone site to operate on - * **_properties**: group properties - * **_group_groups**: groups of group - * **_root_group**: marking group as root group - -Example -------- - -Configuration:: - - [tranmogrifier] - pipeline = - source - updategroupproperty - - ... - - [updategroupproperty] - blueprint = collective.blueprint.usersandgroups.updategroupproperty - -Data in pipeline:: - - { - "_groupname": "Administrators", - "_root_group": true, - "_plone_site": "/Plone", - "_roles": [ - "Manager", - ], - "_properties": { - "email": "admins@site.tld" - ... - }, - "_group_groups": [ - "ContentAdministrators", - ... - ], - } - - - - diff --git a/docs/updateuserproperty.md b/docs/updateuserproperty.md new file mode 100644 index 0000000..30b40a0 --- /dev/null +++ b/docs/updateuserproperty.md @@ -0,0 +1,46 @@ +

collective.blueprint.usersandgroups.updateuserproperty

+ +Update user properties. + +TODO + +: need to review this blueprint since it was done just to solve + problem. Lots of things to rename and fix. + +# Parameters + +No parameters. + +Expected data in pipeline: + +> - **\_username**: username of user we want to update +> - **\_properties**: user properties +> - **\_user_groups**: groups of user +> - **\_root_roles**: roles of userfolder +> - **\_local_roles**: local roles for site we operate on +> - **\_plone_site**: plone site to which to apply `_local_roles` + +# Example + +Configuration: + + [tranmogrifier] + pipeline = + source + updateuserproperty + + ... + + [updateuserproperty] + blueprint = collective.blueprint.usersandgroups.updateuserproperty + +Data in pipeline: + + { + "_username": "rokgarbas", + "_properties": { + "email": "some@email.tld" + ... + }, + ... + } diff --git a/docs/updateuserproperty.rst b/docs/updateuserproperty.rst deleted file mode 100644 index cfa91b8..0000000 --- a/docs/updateuserproperty.rst +++ /dev/null @@ -1,52 +0,0 @@ -``collective.blueprint.usersandgroups.updateuserproperty`` -========================================================== - -Update user properties. - -:TODO: need to review this blueprint since it was done just to solve problem. - Lots of things to rename and fix. - -Parameters ----------- - -No parameters. - -Expected data in pipeline: - - * **_username**: username of user we want to update - * **_properties**: user properties - * **_user_groups**: groups of user - * **_root_roles**: roles of userfolder - * **_local_roles**: local roles for site we operate on - * **_plone_site**: plone site to which to apply ``_local_roles`` - -Example -------- - -Configuration:: - - [tranmogrifier] - pipeline = - source - updateuserproperty - - ... - - [updateuserproperty] - blueprint = collective.blueprint.usersandgroups.updateuserproperty - -Data in pipeline:: - - { - "_username": "rokgarbas", - "_properties": { - "email": "some@email.tld" - ... - }, - ... - } - - - - - diff --git a/export_scripts/plone2.0_export.py b/export_scripts/plone2.0_export.py index 316ab32..6d32b90 100644 --- a/export_scripts/plone2.0_export.py +++ b/export_scripts/plone2.0_export.py @@ -1,4 +1,3 @@ - import os import simplejson diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..ed365b2 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,27 @@ +[tool.black] +target-version = ['py38'] +include = '\.pyi?$' + +[tool.isort] +profile = "black" +force_alphabetical_sort = true +force_single_line = true +lines_after_imports = 2 +line_length = 88 + +[tool.flakeheaven.plugins] +# Disable some checks. +# - E501 line too long +# flake8 is already testing this, with max-line-length=100000 in .flake8, +# so pycodestyle should not test it. +# - W503 line break before binary operator +# Outdated recommendation, see https://www.flake8rules.com/rules/W503.html +mccabe = ["+*"] +pycodestyle = ["+*", "-E501", "-W503"] +pyflakes = ["+*"] +pylint = ["+*"] + +[tool.plone-code-analysis] +checkers = ["black", "flake8", "isort", "pyroma", "zpretty"] +formatters = ["black", "isort", "zpretty"] +paths = "setup.py src/" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 06390bd..0000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ --c constraints.txt -setuptools -zc.buildout diff --git a/setup.py b/setup.py index 437c54c..ef06f9d 100644 --- a/setup.py +++ b/setup.py @@ -1,22 +1,20 @@ -# -*- coding: utf-8 -*- """Installer for the collective.blueprint.usersandgroups package.""" +from pathlib import Path from setuptools import find_packages from setuptools import setup -long_description = "\n\n".join( - [ - open("README.rst").read(), - open("CONTRIBUTORS.rst").read(), - open("CHANGES.rst").read(), - ] -) +long_description = f""" +{Path("README.md").read_text()}\n +{Path("CONTRIBUTORS.md").read_text()}\n +{Path("CHANGES.md").read_text()}\n +""" setup( name="collective.blueprint.usersandgroups", - version='0.3.2.dev0', + version="0.3.2.dev0", description="transmogrifier blueprints for importing users and groups into plone", long_description=long_description, # Get more from https://pypi.org/classifiers/ @@ -25,13 +23,14 @@ "Environment :: Web Environment", "Framework :: Plone", "Framework :: Plone :: Addon", - "Framework :: Plone :: 4.3", - "Framework :: Plone :: 5.1", "Framework :: Plone :: 5.2", + "Framework :: Plone :: 6.0", "Programming Language :: Python", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Operating System :: OS Independent", "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", ], @@ -51,13 +50,17 @@ package_dir={"": "src"}, include_package_data=True, zip_safe=False, - python_requires=">=2.7", + python_requires=">=3.7", install_requires=[ "collective.transmogrifier", "setuptools", ], extras_require={ - "test": ["plone.api", "plone.app.testing"], + "test": [ + "plone.api", + "plone.app.testing", + "zope.testrunner", + ], }, entry_points=""" [z3c.autoinclude.plugin] diff --git a/src/collective/__init__.py b/src/collective/__init__.py index 03d08ff..5284146 100644 --- a/src/collective/__init__.py +++ b/src/collective/__init__.py @@ -1,2 +1 @@ -# -*- coding: utf-8 -*- __import__("pkg_resources").declare_namespace(__name__) diff --git a/src/collective/blueprint/__init__.py b/src/collective/blueprint/__init__.py index 03d08ff..5284146 100644 --- a/src/collective/blueprint/__init__.py +++ b/src/collective/blueprint/__init__.py @@ -1,2 +1 @@ -# -*- coding: utf-8 -*- __import__("pkg_resources").declare_namespace(__name__) diff --git a/src/collective/blueprint/usersandgroups/__init__.py b/src/collective/blueprint/usersandgroups/__init__.py index 40a96af..e69de29 100644 --- a/src/collective/blueprint/usersandgroups/__init__.py +++ b/src/collective/blueprint/usersandgroups/__init__.py @@ -1 +0,0 @@ -# -*- coding: utf-8 -*- diff --git a/src/collective/blueprint/usersandgroups/blueprint.py b/src/collective/blueprint/usersandgroups/blueprint.py index a58d019..77a2c58 100644 --- a/src/collective/blueprint/usersandgroups/blueprint.py +++ b/src/collective/blueprint/usersandgroups/blueprint.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from AccessControl.interfaces import IRoleManager from collective.transmogrifier.interfaces import ISection from collective.transmogrifier.interfaces import ISectionBlueprint @@ -10,7 +9,7 @@ @provider(ISectionBlueprint) @implementer(ISection) -class CreateUser(object): +class CreateUser: """ """ def __init__(self, transmogrifier, name, options, previous): @@ -38,7 +37,7 @@ def __iter__(self): @provider(ISectionBlueprint) @implementer(ISection) -class CreateGroup(object): +class CreateGroup: """ """ def __init__(self, transmogrifier, name, options, previous): @@ -58,7 +57,7 @@ def __iter__(self): @provider(ISectionBlueprint) @implementer(ISection) -class UpdateUserProperties(object): +class UpdateUserProperties: """ """ def __init__(self, transmogrifier, name, options, previous): @@ -114,7 +113,7 @@ def __iter__(self): @provider(ISectionBlueprint) @implementer(ISection) -class UpdateGroupProperties(object): +class UpdateGroupProperties: """ """ def __init__(self, transmogrifier, name, options, previous): diff --git a/src/collective/blueprint/usersandgroups/configure.zcml b/src/collective/blueprint/usersandgroups/configure.zcml index e1e08d3..42c828e 100644 --- a/src/collective/blueprint/usersandgroups/configure.zcml +++ b/src/collective/blueprint/usersandgroups/configure.zcml @@ -1,25 +1,26 @@ + i18n_domain="collective.blueprint.usersandgroups" + > + name="collective.blueprint.usersandgroups.createuser" + component=".blueprint.CreateUser" + /> + name="collective.blueprint.usersandgroups.updateuserproperty" + component=".blueprint.UpdateUserProperties" + /> + name="collective.blueprint.usersandgroups.creategroup" + component=".blueprint.CreateGroup" + /> + name="collective.blueprint.usersandgroups.updategroupproperty" + component=".blueprint.UpdateGroupProperties" + /> diff --git a/src/collective/blueprint/usersandgroups/testing.py b/src/collective/blueprint/usersandgroups/testing.py index 878ac87..924b0b1 100644 --- a/src/collective/blueprint/usersandgroups/testing.py +++ b/src/collective/blueprint/usersandgroups/testing.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from plone.app.testing import FunctionalTesting from plone.app.testing import IntegrationTesting from plone.app.testing import PLONE_FIXTURE diff --git a/src/collective/blueprint/usersandgroups/tests/__init__.py b/src/collective/blueprint/usersandgroups/tests/__init__.py index 40a96af..e69de29 100644 --- a/src/collective/blueprint/usersandgroups/tests/__init__.py +++ b/src/collective/blueprint/usersandgroups/tests/__init__.py @@ -1 +0,0 @@ -# -*- coding: utf-8 -*- diff --git a/src/collective/blueprint/usersandgroups/tests/test_blueprint.py b/src/collective/blueprint/usersandgroups/tests/test_blueprint.py index 8abcf0d..ff3d417 100644 --- a/src/collective/blueprint/usersandgroups/tests/test_blueprint.py +++ b/src/collective/blueprint/usersandgroups/tests/test_blueprint.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Setup tests blueprint.""" from collective.blueprint.usersandgroups.blueprint import CreateGroup from collective.blueprint.usersandgroups.blueprint import CreateUser diff --git a/test_plone43.cfg b/test_plone43.cfg deleted file mode 100644 index 7b3de24..0000000 --- a/test_plone43.cfg +++ /dev/null @@ -1,22 +0,0 @@ -[buildout] - -extends = - https://raw.githubusercontent.com/collective/buildout.plonetest/master/test-4.3.x.cfg - https://raw.githubusercontent.com/collective/buildout.plonetest/master/qa.cfg - base.cfg - -update-versions-file = test_plone43.cfg - -index = https://pypi.org/simple/ - -[versions] - -# Added by buildout at 2021-07-12 16:58:12.243262 -collective.recipe.cmd = 0.11 -createcoverage = 1.5 -pathtools = 0.1.2 -pkginfo = 1.7.0 - -# Required by: -# zest.releaser==6.13.5 -colorama = 0.4.4 diff --git a/test_plone51.cfg b/test_plone51.cfg deleted file mode 100644 index 3e6285a..0000000 --- a/test_plone51.cfg +++ /dev/null @@ -1,30 +0,0 @@ -[buildout] - -extends = - https://raw.githubusercontent.com/collective/buildout.plonetest/master/test-5.1.x.cfg - https://raw.githubusercontent.com/collective/buildout.plonetest/master/qa.cfg - base.cfg - -update-versions-file = test_plone51.cfg - -[versions] -collective.transmogrifier = -plone.app.transmogrifier = - -# Added by buildout at 2021-07-12 17:09:44.984495 -bleach = 3.3.0 -collective.recipe.cmd = 0.11 -createcoverage = 1.5 -pathtools = 0.1.2 -pkginfo = 1.7.1 -pyparsing = 2.4.7 -readme-renderer = 29.0 -requests-toolbelt = 0.9.1 - -# Required by: -# bleach==3.3.0 -packaging = 21.0 - -# Required by: -# bleach==3.3.0 -webencodings = 0.5.1 diff --git a/test_plone52.cfg b/test_plone52.cfg deleted file mode 100644 index 4cc2459..0000000 --- a/test_plone52.cfg +++ /dev/null @@ -1,8 +0,0 @@ -[buildout] - -extends = - https://raw.githubusercontent.com/collective/buildout.plonetest/master/test-5.2.x.cfg - https://raw.githubusercontent.com/collective/buildout.plonetest/master/qa.cfg - base.cfg - -[versions] diff --git a/tox.ini b/tox.ini deleted file mode 100644 index d76f4f0..0000000 --- a/tox.ini +++ /dev/null @@ -1,153 +0,0 @@ -[tox] -envlist = - py38-lint, - py{27}-Plone{43,51}, - py{27,37,38}-Plone{52}, -# build_instance, -# docs, -# coverage-report, - -skip_missing_interpreters = True - -[testenv] -skip_install = true - -extras = - develop - test - -commands = - {envbindir}/buildout -q -c {toxinidir}/{env:version_file} buildout:directory={envdir} buildout:develop={toxinidir} bootstrap -# {envbindir}/buildout -c {toxinidir}/{env:version_file} buildout:directory={envdir} buildout:develop={toxinidir} annotate - {envbindir}/buildout -n -qq -c {toxinidir}/{env:version_file} buildout:directory={envdir} buildout:develop={toxinidir} install test robot - coverage run {envbindir}/test -v1 --auto-color {posargs} - # coverage run {envbindir}/test -v --all -t robot {posargs} - -setenv = - COVERAGE_FILE=.coverage.{envname} - version_file=test_plone52.cfg - Plone43: version_file=test_plone43.cfg - Plone51: version_file=test_plone51.cfg - Plone52: version_file=test_plone52.cfg - -deps = - -rrequirements.txt - Plone43: -cconstraints_plone43.txt - Plone51: -cconstraints_plone51.txt - Plone52: -cconstraints_plone52.txt - coverage - - -[testenv:coverage-report] -skip_install = true -usedevelop = True -basepython = python3.7 - -deps = - coverage - -cconstraints_plone52.txt - -setenv = - COVERAGE_FILE=.coverage - -commands = - coverage erase - coverage combine - coverage html - coverage xml - coverage report - - -[lint] -skip_install = true - -deps = - isort - flake8 - # helper to generate HTML reports: - flake8-html - # Useful flake8 plugins that are Python and Plone specific: - flake8-coding - flake8-debugger - flake8-deprecated - flake8-print - #flake8-pytest - flake8-todo - mccabe - # Potential flake8 plugins that should be used: # TBD - #flake8-blind-except - #flake8-commas - #flake8-docstrings - #flake8-mypy - #flake8-pep3101 - #flake8-plone-hasattr - #flake8-string-format - #flake8_strict - #flake8-quotes - #flake8-polyfill - -commands = - mkdir -p {toxinidir}/reports/flake8 - - flake8 --format=html --htmldir={toxinidir}/reports/flake8 --doctests src setup.py - flake8 --doctests src setup.py - isort --check-only {toxinidir}/src {toxinidir}/docs {toxinidir}/setup.py - -allowlist_externals = - mkdir - -[testenv:isort-apply] -skip_install = true - -deps = - isort - -commands = - isort --check-only {toxinidir}/src {toxinidir}/docs {toxinidir}/setup.py - -[testenv:py38-lint] -basepython = python3.8 -skip_install = true -deps = {[lint]deps} -commands = {[lint]commands} -allowlist_externals = {[lint]allowlist_externals} - -[testenv:docs] -skip_install = true - -deps = - Sphinx - -commands = - sphinx-build -b html -d _build/docs/doctrees docs _build/docs/html - -[testenv:update_translation] -skip_install = true - -deps = - i18ndude - -commands = - i18ndude find-untranslated - i18ndude rebuild-pot - i18ndude merge - i18ndude sync - i18ndude list - -[testenv:release] -basepython = python3.7 -skip_install = true - -deps = - zest.releaser[recommended] - -commands = - fullrelease --no-input -v - -[testenv:build_instance] -basepython = python3.7 -skip_install = true - -commands = - {envbindir}/buildout -c {toxinidir}/{env:version_file} buildout:directory={toxinidir} bootstrap - {envbindir}/buildout -c {toxinidir}/{env:version_file} buildout:directory={toxinidir} annotate - {envbindir}/buildout -c {toxinidir}/{env:version_file} buildout:directory={toxinidir}