Skip to content

Commit

Permalink
Merge pull request #2774 from jimklimov/issue-2773
Browse files Browse the repository at this point in the history
Fix PEP-0625 naming for PyNUTClient tarball
  • Loading branch information
jimklimov authored Jan 20, 2025
2 parents a2077e8 + d770719 commit 26f3868
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 6 deletions.
5 changes: 5 additions & 0 deletions NEWS.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,11 @@ relocated into new `shutdown.default` INSTCMD definitions. [#2670]
module in the build or execution environment (deprecated in Python 3.11,
removed since Python 3.13). [#2183]
- the PyPI distribution of the `PyNUTClient` module tarball should now use a
lower-cased file name (and immediate versioned directory name inside) to
match the requirements of link:https://peps.python.org/pep-0625/[PEP-0625].
The Python module name (and its directory) should remain camel-cased. [#2773]
- enabled installation of built single-file PDF and HTML (including man page
renditions) under the configured `docdir`. It seems previously they were
only built (if requested) but not installed via `make`, unlike the common
Expand Down
7 changes: 7 additions & 0 deletions UPGRADING.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ Changes from 2.8.2 to 2.8.3
depending on `target_cpu` of the build. If you had any scripts relying
on the older pattern, they may have to be updated.
- the PyPI distribution of the `PyNUTClient` module tarball should now use a
lower-cased file name (and immediate versioned directory name inside) to
match the requirements of link:https://peps.python.org/pep-0625/[PEP-0625].
The Python module name (and its directory) should remain camel-cased.
OS distribution package recipes that deliver the module separately (e.g.
as part of Python ecosystem rather than NUT) may have to adjust. [#2773]
- Updated man page generation with `configure` script options to specify that
manual sections on the target platform differ from (Linux-based) defaults
hard-coded into page sources; this should allow to simplify NUT packaging
Expand Down
14 changes: 9 additions & 5 deletions scripts/python/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ sensitive):

import PyNUT

This module provides a `PyNUTClient` class that can be used to connect and
get data from an `upsd` data server.
This module provides a `(PyNUT.)PyNUTClient` class that can be used to connect
and get data from an `upsd` data server.

To install the `PyNUT` module on Debian/Ubuntu, copy it to:
`/usr/share/python-support/python-pynut/`
Expand All @@ -42,7 +42,7 @@ Historically, the `PyNUTClient` class relied on `telnetlib` module for socket
communications with the NUT data server, which was provided as part of Python
core installation with tested 2.6+ and 3.* versions. The module was, however,
marked deprecated since Python 3.11 and not provided since 3.13. Due to this,
as a quick stop-gap solution, NUT sources provide `nut_telnetlib.py` - a copy
as a quick stop-gap solution, NUT sources provide `nut_telnetlib.py` -- a copy
of the module from Python 3.10 installation, and no longer should require its
presence in the Python deployment.

Expand All @@ -56,6 +56,9 @@ app
This directory contains the `NUT-Monitor` UI application, which uses the
`PyNUT` class, along with its own resources.

NOTE: Do not mistake it for `nut-monitor` service for the `upsmon` client in
some distributions' NUT packaging.

There are two closely related separate implementations, for Python 2 with GTK2
and for Python 3 with Qt5. Both can be installed at the same time, if your
distribution has not yet outlawed the obsolete Python 2 interpreters.
Expand All @@ -72,5 +75,6 @@ To install it, you will either need to keep the files together, or to install:
- finally, `nut-monitor-py2gtk2.desktop` and/or `nut-monitor-py3qt5.desktop`
(optionally symlinked as `nut-monitor.desktop`) to `/usr/share/applications/`

The `PyNUT` module can be kept nearby, or must be installed as a "site" or "vendor"
provided script into your Python modules location. See the wrapper script for more technical details.
The `PyNUT` module can be kept nearby, or must be installed as a "site" or
"vendor" provided script into your Python modules location. See the wrapper
scripts of the app for more technical details.
4 changes: 4 additions & 0 deletions scripts/python/module/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
# Note: this Makefile is focused on PyPI publication
# The usual autotools stuff including clean-up is in parent dir
# (to allow easier mixing of the module and app, if/when desired)
#
# NOTE: Due to PEP-0625, the versioned tarball and directory names
# must be normalized to lower-case, as achieved by setup.py(.in).
# The module name remains camel-cased as it always was.

# Non-maintainers can at most generate the source layout for python setuptools
# (having only shell scripting as a prerequisite suffices for that)
Expand Down
2 changes: 2 additions & 0 deletions scripts/python/module/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ of the original project, allowing to develop other classes nearby later.
It is published to PyPI repository as
link:https://pypi.org/project/PyNUTClient/[PyNUTClient]
and so should be installable with `pip` tooling.
Note that the file name of the distribution tarball is lower-cased per
PEP-0625 requirements, while the module name is camel-cased historically.

Currently the module is regularly tested to work with Python interpreter
versions 2.7, 3.4, 3.5 and 3.7.
Expand Down
7 changes: 6 additions & 1 deletion scripts/python/module/setup.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ with codecs.open(os.path.join(here, "README.txt"), encoding="utf-8") as fh:
long_description = "\n" + fh.read()

setup(
name = "PyNUTClient",
name = "pynutclient", ### "PyNUTClient" lower-cased due to PEP-0625
version = '@NUT_SOURCE_GITREV_NUMERIC@',
author = "The Network UPS Tools project",
license = "GPL-3.0-or-later",
license_files = ('LICENSE-GPL3',),
author_email = "[email protected]",
description = "Python client bindings for NUT",
Expand All @@ -39,6 +40,10 @@ setup(
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"Topic :: System :: Monitoring",
"Topic :: System :: Systems Administration",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
Expand Down

0 comments on commit 26f3868

Please sign in to comment.