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

Modernize packaging of whoisd #1427

Merged
merged 1 commit into from
Jan 22, 2025
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
6 changes: 3 additions & 3 deletions whoisd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ buildrpm:
builddeb:
# build the source package in the parent directory
# then rename it to project_version.orig.tar.gz
$(PYTHON) setup.py sdist --dist-dir=../
rename -f 's/$(PROJECT)-(.*)\.tar\.gz/$(PROJECT)_$$1\.orig\.tar\.gz/' ../*
$(PYTHON) -m build --sdist --outdir=../
rename -f 's/nipap_whoisd-(.*)\.tar\.gz/$(PROJECT)_$$1\.orig\.tar\.gz/' ../*
# build the package
debuild -us -uc

Expand All @@ -45,7 +45,7 @@ clean:
.pc/ debian/$(PROJECT).debhelper.log debian/$(PROJECT).postinst.debhelper \
debian/$(PROJECT).prerm.debhelper debian/$(PROJECT).postrm.debhelper \
debian/$(PROJECT).substvars nipap-whoisd.8 debian/.debhelper \
debian/debhelper-build-stamp
debian/debhelper-build-stamp nipap_whoisd.egg-info
find . -name '*.pyc' -delete

VER := $(shell head -n1 ../NEWS | awk '{print $$2}')
Expand Down
1 change: 0 additions & 1 deletion whoisd/debian/compat

This file was deleted.

9 changes: 6 additions & 3 deletions whoisd/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ Source: nipap-whoisd
Maintainer: Kristian Larsson <[email protected]>
Section: python
Priority: optional
Build-Depends: python3 (>= 3.6), debhelper (>= 10), dh-python
Standards-Version: 4.4.0
Build-Depends: debhelper-compat (= 13),
dh-python,
python3-all,
python3-setuptools
Standards-Version: 4.6.1

Package: nipap-whoisd
Architecture: all
Depends: ${misc:Depends}, python3 (>= 3.6), python3-pynipap
Depends: ${misc:Depends}, ${python3:Depends}
Description: Neat IP Address Planner
The NIPAP whois daemon provides a whois-style interface for querying data in
the NIPAP backend. It receives whois queries, translates these into search
Expand Down
2 changes: 1 addition & 1 deletion whoisd/debian/init
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ set -e
# Short-Description: NIPAP whois daemon
### END INIT INFO

DAEMON=/usr/sbin/nipap-whoisd
DAEMON=/usr/bin/nipap-whoisd
CONFIGFILE=/etc/nipap/whoisd.conf
NAME=nipap-whoisd
LONGNAME="NIPAP whois daemon"
Expand Down
1 change: 1 addition & 0 deletions whoisd/debian/install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
whoisd.conf.dist etc/nipap
1 change: 1 addition & 0 deletions whoisd/debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (quilt)
39 changes: 39 additions & 0 deletions whoisd/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[project]
name = "nipap-whoisd"
dynamic = ["version", "description"]
readme = "README.rst"
license = {text = "MIT"}
classifiers = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Intended Audience :: Telecommunications Industry',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3',
'Topic :: Internet'
]
keywords = ["nipap"]
dependencies = [
"pynipap"
]

[project.urls]
Homepage = "http://SpriteLink.github.io/NIPAP"

[tool.setuptools.dynamic]
version = {attr = "nipap_whoisd.__version__"}

[build-system]
requires = [
"setuptools",
# Need to be pinned to 0.20.1 in Ubuntu 24.04 as using the latest 0.21.2
# gives a diff during .deb package build. Unfortunately the files are
# generated twice - first once in a virtualenv (using the version specified
# here) and then once without a virtualenv using the one from the system.
# There two runs produce different outputs (wich they shouldn't) causing a
# diff and the package utils to b0rk out.
"docutils==0.20.1"
]
build-backend = "setuptools.build_meta"
37 changes: 10 additions & 27 deletions whoisd/setup.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
#!/usr/bin/env python3

from distutils.core import setup
import subprocess
from setuptools import setup
import sys

import nipap_whoisd
from docutils.core import publish_cmdline
from docutils.writers import manpage


# return all the extra data files
def get_data_files():
# generate man pages using rst2man
try:
subprocess.call(["rst2man", "nipap-whoisd.man.rst", "nipap-whoisd.8"])
except OSError as exc:
print("rst2man failed to run: {}".format(str(exc)), file=sys.stderr)
publish_cmdline(writer=manpage.Writer(), argv=["nipap-whoisd.man.rst", "nipap-whoisd.8"])
except Exception as exc:
print("Failed to compile man file: {}".format(str(exc)), file=sys.stderr)
sys.exit(1)

files = [
('/etc/nipap/', ['whoisd.conf.dist']),
('/usr/sbin/', ['nipap-whoisd']),
('/usr/share/man/man8/', ['nipap-whoisd.8'])
('share/nipap/', ['whoisd.conf.dist']),
('bin/', ['nipap-whoisd']),
('share/man/man8/', ['nipap-whoisd.8'])
]

return files
Expand All @@ -28,26 +29,8 @@ def get_data_files():
short_desc = long_desc.split('\n')[0].split(' - ')[1].strip()

setup(
name = 'nipap-whoisd',
version = nipap_whoisd.__version__,
description = short_desc,
long_description = long_desc,
author = nipap_whoisd.__author__,
author_email = nipap_whoisd.__author_email__,
license = nipap_whoisd.__license__,
url = nipap_whoisd.__url__,
py_modules = ['nipap_whoisd'],
keywords = ['nipap-whoisd'],
requires = ['pynipap'],
data_files = get_data_files(),
classifiers = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Intended Audience :: Telecommunications Industry',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 2.6'
]
)
Loading