Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace dash with lowdash in project_name #16

Merged
merged 8 commits into from
Feb 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ name: tests

on:
push:
branches:
- main
pull_request:
schedule:
- cron: '13 7 * * 0' # run once a week on Sunday
Expand Down
4 changes: 4 additions & 0 deletions buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ develop =
../../test-packages/example.different
../../test-packages/example.different2
../../test-packages/example.metaoverrides
../../test-packages/example.plone-dash-addon
../../test-packages/example.ploneaddon
../../test-packages/example.ploneintegration
../../test-packages/example.zopeaddon
../../test-packages/example.zopeintegration
../../test-packages/example.multipleeps
../../test-packages/ExampleCamelCase
../../test-packages/namespaceexample.native
../../test-packages/namespaceexample.pkgutilns
parts =
Expand All @@ -35,10 +37,12 @@ eggs =
example.different
example.different2
example.metaoverrides
example.plone-dash-addon
example.ploneaddon
example.ploneintegration
example.zopeaddon
example.zopeintegration
example.multipleeps
ExampleCamelCase
namespaceexample.native
namespaceexample.pkgutilns
1 change: 1 addition & 0 deletions news/16.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Replace dash with lowdash in project_name, as Python Project are normally divided by dash and modul name uses lowdash [MrTango]
4 changes: 2 additions & 2 deletions src/plone/autoinclude/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def load_z3c_packages(target=""):
# we can include it.
if target and ep.module_name != target:
continue
module_name = ep.dist.project_name
module_name = ep.dist.project_name.replace("-", "_")
if module_name not in _known_module_names:
try:
dist = importlib.import_module(module_name)
Expand Down Expand Up @@ -78,7 +78,7 @@ def load_own_packages(target=""):
if target and eps["target"].module_name != target:
# entry point defines target X but we only want target Y.
continue
module_name = wsdist.project_name
module_name = wsdist.project_name.replace("-", "_")
if "module" in eps:
# We could load the dist with ep.load(), but we do it differently.
module_name = eps["module"].module_name
Expand Down
7 changes: 7 additions & 0 deletions src/plone/autoinclude/tests/test_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def test_load_z3c_packages(self):
"example.multipleeps",
]:
self.assertIn(package, packages.keys())

package = packages["example.ploneaddon"]
import example.ploneaddon

Expand All @@ -73,13 +74,19 @@ def test_load_own_packages(self):
for package in [
"example.somethingelse2",
"example.multipleeps",
"example.plone_dash_addon",
]:
self.assertIn(package, packages.keys())
package = packages["example.somethingelse2"]
import example.somethingelse2

self.assertEqual(package, example.somethingelse2)

package = packages["example.plone_dash_addon"]
import example.plone_dash_addon

self.assertEqual(package, example.plone_dash_addon)

def test_get_zcml_file(self):
from plone.autoinclude.loader import get_zcml_file

Expand Down
2 changes: 2 additions & 0 deletions test-packages/ExampleCamelCase/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
recursive-include src *.py
recursive-include src *.zcml
25 changes: 25 additions & 0 deletions test-packages/ExampleCamelCase/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
from setuptools import find_packages
from setuptools import setup


setup(
name="ExampleCamelCase",
version="1.0a1",
description="An add-on for Plone",
long_description="long_description",
author="Maurits van Rees",
author_email="m.van.rees@zestsoftware.nl",
license="GPL version 2",
packages=find_packages("src", exclude=["ez_setup"]),
package_dir={"": "src"},
include_package_data=True,
zip_safe=False,
install_requires=[
"setuptools",
],
entry_points="""
[z3c.autoinclude.plugin]
target = plone
""",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#
10 changes: 10 additions & 0 deletions test-packages/ExampleCamelCase/src/ExampleCamelCase/configure.zcml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
xmlns:i18n="http://namespaces.zope.org/i18n"
xmlns:plone="http://namespaces.plone.org/plone"
i18n_domain="ExampleCamelCase">

<!-- FOR TESTS: This is configure.zcml from ExampleCamelCase. -->

</configure>
11 changes: 11 additions & 0 deletions test-packages/ExampleCamelCase/src/ExampleCamelCase/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from example.basetestpackage.package_base import PackageTestCase

import unittest


class TestPackage(PackageTestCase, unittest.TestCase):
project_name = "ExampleCamelCase"
meta_files = []
configure_files = ["configure.zcml"]
overrides_files = []
standard_z3c_autoinclude = True
2 changes: 2 additions & 0 deletions test-packages/example.plone-dash-addon/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
recursive-include src *.py
recursive-include src *.zcml
26 changes: 26 additions & 0 deletions test-packages/example.plone-dash-addon/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
from setuptools import find_packages
from setuptools import setup


setup(
name="example.plone-dash-addon",
version="1.0a1",
description="An add-on for Plone",
long_description="long_description",
author="Maurits van Rees",
author_email="m.van.rees@zestsoftware.nl",
license="GPL version 2",
packages=find_packages("src", exclude=["ez_setup"]),
namespace_packages=["example"],
package_dir={"": "src"},
include_package_data=True,
zip_safe=False,
install_requires=[
"setuptools",
],
entry_points="""
[plone.autoinclude.plugin]
target = plone
""",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
__import__("pkg_resources").declare_namespace(__name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser">

</configure>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
xmlns:i18n="http://namespaces.zope.org/i18n"
xmlns:plone="http://namespaces.plone.org/plone"
i18n_domain="example.ploneaddon">

<!--
Be careful if you use general includeDependencies, it can have side effects!
Better import explicit packages or configurations ;)
-->
<!--<includeDependencies package="." />-->

<include package=".browser" />

<include file="permissions.zcml" />

<!-- FOR TESTS: This is configure.zcml from example.plone_dash_addon. -->

</configure>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<configure
xmlns="http://namespaces.zope.org/zope">

</configure>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from example.basetestpackage.package_base import PackageTestCase

import unittest


class TestPackage(PackageTestCase, unittest.TestCase):
project_name = "example.plone_dash_addon"
meta_files = []
configure_files = ["configure.zcml", "permissions.zcml", "browser/configure.zcml"]
overrides_files = []
standard_z3c_autoinclude = True
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ class TestIntegration(IntegrationTestCase, unittest.TestCase):
}
configure_files = {
"example.ploneintegration": ["configure.zcml"],
"ExampleCamelCase": ["configure.zcml"],
"example.plone_dash_addon": [
"configure.zcml",
"permissions.zcml",
"browser/configure.zcml",
],
"example.ploneaddon": [
"configure.zcml",
"permissions.zcml",
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ deps =
-e test-packages/example.different2
-e test-packages/example.metaoverrides
-e test-packages/example.ploneaddon
-e test-packages/example.plone-dash-addon
-e test-packages/example.ploneintegration
-e test-packages/example.zopeaddon
-e test-packages/example.zopeintegration
-e test-packages/example.multipleeps
-e test-packages/ExampleCamelCase
-e test-packages/namespaceexample.native
-e test-packages/namespaceexample.pkgutilns
# extras =
Expand Down