1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-21 16:36:18 +00:00

Build and include man pages in distributions

I do not fully understand how the building process works, and have some doubts
on what a "source distribution" should be.
The sdist might be polluted if a "man" directory exists at the project root
when building the distribution.
The inclusion of man pages in the wheel requires it to be built from the sdist,
so it's best to build both at the same time using "python -m build".

Closes #215
This commit is contained in:
Alban Féron 2021-12-31 18:05:43 +01:00
parent c24ee94a44
commit ec92dec9ab
No known key found for this signature in database
GPG Key ID: 8CE0313646D16165
4 changed files with 34 additions and 6 deletions

View File

@ -1,4 +1,13 @@
import supysonic
import os.path
# Simulate import of the "supysonic" package
supy_module_path = os.path.join(
os.path.dirname(__file__), "..", "supysonic", "__init__.py"
)
with open(supy_module_path, "rt", encoding="utf-8") as f:
supysonic = type("", (), {})()
exec(f.read(), supysonic.__dict__)
# -- Project information -----------------------------------------------------
@ -99,6 +108,6 @@ man_pages = [
"supysonic-server",
"Python implementation of the Subsonic server API",
[author],
1
)
1,
),
]

View File

@ -1,3 +1,3 @@
[build-system]
requires = ["setuptools>=51.0.0", "wheel"]
requires = ["setuptools>=51.0.0", "wheel", "sphinx"]
build-backend = "setuptools.build_meta"

View File

@ -71,3 +71,6 @@ console_scripts =
supysonic-cli = supysonic.cli:main
supysonic-daemon = supysonic.daemon:main
supysonic-server = supysonic.server:main
[options.data_files]
share/man/man1 = man/*.1

View File

@ -2,11 +2,27 @@
# Supysonic is a Python implementation of the Subsonic server API.
#
# Copyright (C) 2013-2021 Alban 'spl0k' Féron
# 2017 Óscar García Amor
#
# Distributed under terms of the GNU AGPLv3 license.
import os.path
from distutils import dir_util
from setuptools import setup
from setuptools.command.sdist import sdist as _sdist
class sdist(_sdist):
def make_release_tree(self, base_dir, files):
super().make_release_tree(base_dir, files)
man_dir = os.path.join(base_dir, "man")
doctrees_dir = os.path.join(man_dir, ".doctrees")
self.spawn(["sphinx-build", "-q", "-b", "man", "docs", man_dir])
dir_util.remove_tree(doctrees_dir)
if __name__ == "__main__":
setup()
setup(
cmdclass={"sdist": sdist},
)