Skip to content

Commit

Permalink
[fc] Repository: Products.CMFPlone
Browse files Browse the repository at this point in the history
Branch: refs/heads/master
Date: 2024-09-24T23:50:50+02:00
Author: Peter Mathis (petschki) <peter.mathis@kombinat.at>
Commit: plone/Products.CMFPlone@881e366

Fix false positive missing_packages for profiles from submodules

Files changed:
A news/4015.bugfix
M Products/CMFPlone/browser/admin.py
Repository: Products.CMFPlone

Branch: refs/heads/master
Date: 2024-09-25T12:11:12+02:00
Author: Maurits van Rees (mauritsvanrees) <maurits@py76.be>
Commit: plone/Products.CMFPlone@840f075

Merge pull request #4016 from plone/plone-upgrade-missing-package-fix

Fix false positive `missing_packages` in `@@plone-upgrade`

Files changed:
A news/4015.bugfix
M Products/CMFPlone/browser/admin.py
  • Loading branch information
mauritsvanrees committed Sep 25, 2024
1 parent f5e104e commit 8246d00
Showing 1 changed file with 26 additions and 17 deletions.
43 changes: 26 additions & 17 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
Repository: plone.restapi
Repository: Products.CMFPlone


Branch: refs/heads/main
Date: 2024-09-21T09:08:30-07:00
Author: Steve Piercy (stevepiercy) <web@stevepiercy.com>
Commit: https://github.com/plone/plone.restapi/commit/682567a86b9fc022fbad32e27906475c5410eee1
Branch: refs/heads/master
Date: 2024-09-24T23:50:50+02:00
Author: Peter Mathis (petschki) <peter.mathis@kombinat.at>
Commit: https://github.com/plone/Products.CMFPlone/commit/881e3669b5475d24d625c527f88142e9fa6daba6

Revert duplication of pip install -r requirements-docs.txt in GitHub … (#1817)
Fix false positive missing_packages for profiles from submodules

* Revert duplication of pip install -r requirements-docs.txt in GitHub workflow

* news

* Delete news/1817.internal

---------

Co-authored-by: David Glick &lt;david@glicksoftware.com&gt;
Files changed:
A news/4015.bugfix
M Products/CMFPlone/browser/admin.py

b'diff --git a/Products/CMFPlone/browser/admin.py b/Products/CMFPlone/browser/admin.py\nindex e6273a812a..0e1df304b4 100644\n--- a/Products/CMFPlone/browser/admin.py\n+++ b/Products/CMFPlone/browser/admin.py\n@@ -2,6 +2,7 @@\n from AccessControl.Permissions import view as View\n from collections import OrderedDict\n from functools import cached_property\n+from importlib import import_module\n from importlib.metadata import distribution\n from importlib.metadata import PackageNotFoundError\n from OFS.interfaces import IApplication\n@@ -354,7 +355,12 @@ def missing_packages(self):\n try:\n distribution(package)\n except PackageNotFoundError:\n- missing.append(package)\n+ try:\n+ # profiles can live in submodules of packages.\n+ # check if we can import the module namespace\n+ import_module(package)\n+ except ModuleNotFoundError:\n+ missing.append(package)\n return missing\n \n def versions(self):\ndiff --git a/news/4015.bugfix b/news/4015.bugfix\nnew file mode 100644\nindex 0000000000..1c13769dd1\n--- /dev/null\n+++ b/news/4015.bugfix\n@@ -0,0 +1,2 @@\n+Do not warn about missing profiles when they are registered in submodules of packages.\n+[petschki]\n'

Repository: Products.CMFPlone


Branch: refs/heads/master
Date: 2024-09-25T12:11:12+02:00
Author: Maurits van Rees (mauritsvanrees) <maurits@py76.be>
Commit: https://github.com/plone/Products.CMFPlone/commit/840f075613c764036b773a4a93b11b036623130b

Merge pull request #4016 from plone/plone-upgrade-missing-package-fix

Fix false positive `missing_packages` in `@@plone-upgrade`

Files changed:
M .github/workflows/tests.yml
A news/4015.bugfix
M Products/CMFPlone/browser/admin.py

b'diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml\nindex 64f7dc2ee..73447527b 100644\n--- a/.github/workflows/tests.yml\n+++ b/.github/workflows/tests.yml\n@@ -60,7 +60,7 @@ jobs:\n \n # build sphinx\n - name: sphinx\n- run: if [ "${{ matrix.plone-version }}" == "6.0" ] && [ ${{ matrix.python-version }} == \'3.12\' ]; then pip install -r requirements-docs.txt && make docs-html; fi\n+ run: if [ "${{ matrix.plone-version }}" == "6.0" ] && [ ${{ matrix.python-version }} == \'3.12\' ]; then make docs-html; fi\n \n # test\n - name: test\n'
b'diff --git a/Products/CMFPlone/browser/admin.py b/Products/CMFPlone/browser/admin.py\nindex e6273a812a..0e1df304b4 100644\n--- a/Products/CMFPlone/browser/admin.py\n+++ b/Products/CMFPlone/browser/admin.py\n@@ -2,6 +2,7 @@\n from AccessControl.Permissions import view as View\n from collections import OrderedDict\n from functools import cached_property\n+from importlib import import_module\n from importlib.metadata import distribution\n from importlib.metadata import PackageNotFoundError\n from OFS.interfaces import IApplication\n@@ -354,7 +355,12 @@ def missing_packages(self):\n try:\n distribution(package)\n except PackageNotFoundError:\n- missing.append(package)\n+ try:\n+ # profiles can live in submodules of packages.\n+ # check if we can import the module namespace\n+ import_module(package)\n+ except ModuleNotFoundError:\n+ missing.append(package)\n return missing\n \n def versions(self):\ndiff --git a/news/4015.bugfix b/news/4015.bugfix\nnew file mode 100644\nindex 0000000000..1c13769dd1\n--- /dev/null\n+++ b/news/4015.bugfix\n@@ -0,0 +1,2 @@\n+Do not warn about missing profiles when they are registered in submodules of packages.\n+[petschki]\n'

0 comments on commit 8246d00

Please sign in to comment.