From 0000390bb15e75a678a4260d6cbb3861872cd7c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= Date: Fri, 8 Aug 2025 20:08:39 +0200 Subject: [PATCH] packaging: migrate to declarative setup.cfg and remove system-installed data_files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This refactors the packaging to follow modern setuptools/PEP 517 practices: - Move package metadata (name, version, author, description, license, classifiers) into setup.cfg for declarative builds. - Use `version = attr: servicereportpkg.get_version` to retrieve version dynamically. - Add `console_scripts` entry point for `servicereport` CLI instead of installing a standalone wrapper script. - Drop `data_files` entries for manpages, docs, and systemd unit — these should be installed by distro packaging, not via pip/wheels, to ensure correct FHS placement. - Remove obsolete RPM compression workaround. - Simplify setup.py to a single `setup()` call. This improves PyPI compatibility, wheel portability, and distro packaging integration. Signed-off-by: Matěj Cepl --- servicereport | 15 --------------- setup.cfg | 23 +++++++++++++++++------ setup.py | 27 ++------------------------- 3 files changed, 19 insertions(+), 46 deletions(-) delete mode 100755 servicereport diff --git a/servicereport b/servicereport deleted file mode 100755 index 40e6a17..0000000 --- a/servicereport +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python3 - -# SPDX-License-Identifier: GPL-2.0-only -# -# (C) Copyright IBM Corp. 2018, 2019 -# Author: Sourabh Jain - -"""Entry point script""" - -import sys - -from servicereportpkg import main - -if __name__ == "__main__": - sys.exit(main()) diff --git a/setup.cfg b/setup.cfg index c4be73b..fb47079 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,10 +3,21 @@ # (C) Copyright IBM Corp. 2018, 2019 # Author: Sourabh Jain - [metadata] -name: ServiceReport -description: FFDC validation tool -long_description: Validation tool to verify First Failure Data Capture (FFDC) configurations -author: Sourabh Jain -author_email: sourabhjain@linux.ibm.com +name = ServiceReport +version = attr: servicereportpkg.get_version +author = Sourabh Jain +author_email = sourabhjain@linux.ibm.com +description = FFDC validation tool +long_description = file: README.md +license = GPL-2.0-only +classifiers = + Development Status :: 4 - Beta + Programming Language :: Python + +[options] +packages = find: + +[options.entry_points] +console_scripts = + servicereport = servicereportpkg:main diff --git a/setup.py b/setup.py index a716c71..6068493 100644 --- a/setup.py +++ b/setup.py @@ -1,26 +1,3 @@ -# SPDX-License-Identifier: GPL-2.0-only -# -# (C) Copyright IBM Corp. 2018, 2019 -# Author: Sourabh Jain +from setuptools import setup -import os -import sys -from setuptools import setup, find_packages - -from servicereportpkg import get_version - -# Workaround for https://bugs.python.org/issue644744 -if "bdist_rpm" in sys.argv[1:]: - os.putenv("COMPRESS", " ") - -setup(packages=find_packages(), - scripts=['servicereport'], - version=get_version(), - data_files=[('share/man/man8', ['man/servicereport.8']), - ('share/doc/ServiceReport', ['README.md']), - ('share/licenses/ServiceReport', ['COPYING']), - ('/usr/lib/systemd/system', - ['service/servicereport.service'])], - classifiers=[ - 'Development Status :: 4 - Beta', - 'Programming Language :: Python']) +setup()