@@ -105,40 +105,33 @@ def sixth(x):
105
105
setup(
106
106
name='testcov',
107
107
packages=['testcov'],
108
- namespace_packages=['testcov'],
109
108
)
110
109
""" )
110
+ # https://packaging.python.org/en/latest/guides/packaging-namespace-packages/#pkgutil-style-namespace-packages
111
111
make_file ("bug888/app/testcov/__init__.py" , """\
112
- try: # pragma: no cover
113
- __import__('pkg_resources').declare_namespace(__name__)
114
- except ImportError: # pragma: no cover
115
- from pkgutil import extend_path
116
- __path__ = extend_path(__path__, __name__)
112
+ __path__ = __import__('pkgutil').extend_path(__path__, __name__)
117
113
""" )
118
- make_file ("bug888/app/testcov/main.py" , """\
119
- try: # pragma: no cover
120
- entry_points = __import__("pkg_resources").iter_entry_points('plugins')
121
- except ImportError: # pragma: no cover
122
- import importlib.metadata
123
- entry_points = importlib.metadata.entry_points(group="plugins")
124
- for entry_point in entry_points:
114
+ if env .PYVERSION < (3 , 10 ):
115
+ get_plugins = "entry_points['plugins']"
116
+ else :
117
+ get_plugins = "entry_points.select(group='plugins')"
118
+ make_file ("bug888/app/testcov/main.py" , f"""\
119
+ import importlib.metadata
120
+ entry_points = importlib.metadata.entry_points()
121
+ for entry_point in { get_plugins } :
125
122
entry_point.load()()
126
123
""" )
127
124
make_file ("bug888/plugin/setup.py" , """\
128
125
from setuptools import setup
129
126
setup(
130
127
name='testcov-plugin',
131
128
packages=['testcov'],
132
- namespace_packages=['testcov'],
133
129
entry_points={'plugins': ['testp = testcov.plugin:testp']},
134
130
)
135
131
""" )
132
+ # https://packaging.python.org/en/latest/guides/packaging-namespace-packages/#pkgutil-style-namespace-packages
136
133
make_file ("bug888/plugin/testcov/__init__.py" , """\
137
- try: # pragma: no cover
138
- __import__('pkg_resources').declare_namespace(__name__)
139
- except ImportError: # pragma: no cover
140
- from pkgutil import extend_path
141
- __path__ = extend_path(__path__, __name__)
134
+ __path__ = __import__('pkgutil').extend_path(__path__, __name__)
142
135
""" )
143
136
make_file ("bug888/plugin/testcov/plugin.py" , """\
144
137
def testp():
0 commit comments