diff --git a/docs/conf.py b/docs/conf.py index 1446adb..2b0e4aa 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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, + ), ] diff --git a/pyproject.toml b/pyproject.toml index 3607e0f..396b209 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["setuptools>=51.0.0", "wheel"] +requires = ["setuptools>=51.0.0", "wheel", "sphinx"] build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg index 430be0d..254b218 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 diff --git a/setup.py b/setup.py index e51e2d7..190e0ba 100644 --- a/setup.py +++ b/setup.py @@ -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}, + )