Skip to content
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
9 changes: 9 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ Changelog
3.0.0 (unreleased)
------------------

- When ``bin/develop`` is called without arguments, show the help text instead of an ugly error.
[maurits]

- Move to PEP-420 native namespaces. [maurits]

- Replace our use of ``pkg_resources`` with ``importlib.metadata``. [maurits]

- Require ``zc.buildout`` 3.0.0 or higher. [maurits]

- Add support for Python 3.14 and 3.15. [maurits]

- Require Python 3.10 or higher. [maurits]
Expand Down
21 changes: 4 additions & 17 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@
version = "3.0.0.dev0"


install_requires = [
"setuptools",
"zc.buildout",
]

tests_require = ["mock"]

extras_require = {"test": tests_require}


def get_text_from_file(fn):
text = open(fn, "rb").read()
return text.decode("utf-8")
Expand Down Expand Up @@ -48,16 +38,13 @@ def get_text_from_file(fn):
author_email="florian.schulze@gmx.net",
url="https://github.com/fschulze/mr.developer",
license="BSD",
packages=["mr", "mr.developer", "mr.developer.tests"],
package_dir={"": "src"},
namespace_packages=["mr", "mr.developer"],
include_package_data=True,
zip_safe=False,
install_requires=install_requires,
tests_require=tests_require,
extras_require=extras_require,
install_requires=[
"zc.buildout>=3.0.0",
],
extras_require={"test": "mock"},
python_requires=">=3.10",
test_suite="mr.developer.tests",
entry_points="""
[console_scripts]
develop = mr.developer.develop:develop
Expand Down
7 changes: 0 additions & 7 deletions src/mr/__init__.py

This file was deleted.

7 changes: 0 additions & 7 deletions src/mr/developer/__init__.py

This file was deleted.

20 changes: 8 additions & 12 deletions src/mr/developer/common.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from configparser import RawConfigParser
from importlib.metadata import entry_points

import logging
import os
import pkg_resources
import platform
import queue
import re
Expand Down Expand Up @@ -190,10 +190,10 @@ def get_workingcopytypes():
group = "mr.developer.workingcopytypes"
_workingcopytypes = {}
addons = {}
for entrypoint in pkg_resources.iter_entry_points(group=group):
for entrypoint in entry_points().select(group=group):
key = entrypoint.name
workingcopytype = entrypoint.load()
if entrypoint.dist.project_name == "mr.developer":
if entrypoint.dist.name == "mr.developer":
_workingcopytypes[key] = workingcopytype
else:
if key in addons:
Expand All @@ -205,7 +205,7 @@ def get_workingcopytypes():
logger.info(
"Overwriting '%s' with addon from '%s'.",
key,
entrypoint.dist.project_name,
entrypoint.dist.name,
)
addons[key] = workingcopytype
_workingcopytypes.update(addons)
Expand All @@ -216,10 +216,10 @@ def get_commands():
commands = {}
group = "mr.developer.commands"
addons = {}
for entrypoint in pkg_resources.iter_entry_points(group=group):
for entrypoint in entry_points().select(group=group):
key = entrypoint.name
command = entrypoint.load()
if entrypoint.dist.project_name == "mr.developer":
if entrypoint.dist.name == "mr.developer":
commands[key] = command
else:
if key in addons:
Expand All @@ -230,7 +230,7 @@ def get_commands():
logger.info(
'Overwriting "%s" with addon from "%s".',
key,
entrypoint.dist.project_name,
entrypoint.dist.name,
)
addons[key] = command
commands.update(addons)
Expand Down Expand Up @@ -394,11 +394,7 @@ def parse_buildout_args(args):
debug=False,
)
options = []
version = pkg_resources.get_distribution("zc.buildout").version
if tuple(version.split(".")[:2]) <= ("1", "4"):
option_str = "vqhWUoOnNDA"
else:
option_str = "vqhWUoOnNDAs"
option_str = "vqhWUoOnNDAs"
while args:
if args[0][0] == "-":
op = orig_op = args.pop(0)
Expand Down
13 changes: 11 additions & 2 deletions src/mr/developer/develop.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

import argparse
import atexit
import importlib.metadata
import logging
import os
import pkg_resources
import sys
import textwrap

Expand Down Expand Up @@ -60,7 +60,7 @@ def __call__(self, *args, **kwargs):
ch.setFormatter(logging.Formatter("%(levelname)s: %(message)s"))
logger.addHandler(ch)
self.parser = ArgumentParser()
version = pkg_resources.get_distribution("mr.developer").version
version = importlib.metadata.version("mr.developer")
self.parser.add_argument(
"-v", "--version", action="version", version="mr.developer %s" % version
)
Expand All @@ -73,6 +73,15 @@ def __call__(self, *args, **kwargs):
args = None
args = self.parser.parse_args(args)

# When you call `bin/develop` without any arguments, you will get an
# error later on because we call `args.func` and there is no `func`:
# AttributeError: 'Namespace' object has no attribute 'func'
if not hasattr(args, "func"):
# So pretend the user has asked for the help function.
args = self.parser.parse_args(["help"])
args.func(args)
return

try:
self.buildout_dir = find_base()
except OSError:
Expand Down
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ commands = py.test --cov {envsitepackagesdir}/mr/developer --cov-report=term --c
deps =
{[base]deps}
pytest-cov
configparser: configparser


[testenv:lint]
Expand Down