Commit 601f38f5 authored by mathieui's avatar mathieui

setup: add a build_man command and integrate sphinx manpages into install

parent 1ce874b0
#!/usr/bin/env python3 #!/usr/bin/env python3
import os
import subprocess
import sys
from tempfile import TemporaryFile
try: try:
from setuptools import setup, Extension from setuptools import setup, Extension
except ImportError: except ImportError:
print('\nSetuptools was not found. Install setuptools for python 3.\n') print('\nSetuptools was not found. Install setuptools for python 3.\n')
import sys
sys.exit(1) sys.exit(1)
import os cmdclass = {}
import subprocess try:
from tempfile import TemporaryFile from sphinx.setup_command import BuildDoc
cmdclass = {'build_man': BuildDoc}
except ImportError:
print('\nSphinx not found, the build_man command will be unavailable.\n')
current_dir = os.path.dirname(__file__) current_dir = os.path.dirname(__file__)
...@@ -57,8 +63,30 @@ def check_include(library_name, header): ...@@ -57,8 +63,30 @@ def check_include(library_name, header):
print('%s headers not found.' % library_name) print('%s headers not found.' % library_name)
return False return False
def sphinx_man():
expected_sphinx_files = [
found = []
for item in expected_sphinx_files:
if os.path.exists(item):
if found:
return [('share/man/man7/', found)]
return []
sphinx_files_found = sphinx_man()
if not sphinx_files_found:
'\nSphinx-built manpages not found. Only the '
'short handwritten manpages will be installed\n'
if not check_include('python3', 'Python.h'): if not check_include('python3', 'Python.h'):
import sys
sys.exit(2) sys.exit(2)
module_poopt = Extension('poezio.poopt', module_poopt = Extension('poezio.poopt',
...@@ -124,17 +152,26 @@ setup( ...@@ -124,17 +152,26 @@ setup(
package_data={'poezio': ['default_config.cfg']}, package_data={'poezio': ['default_config.cfg']},
scripts=['scripts/poezio_logs'], scripts=['scripts/poezio_logs'],
entry_points={'console_scripts': ['poezio = poezio.__main__:run']}, entry_points={'console_scripts': ['poezio = poezio.__main__:run']},
data_files=([('share/man/man1/', ['data/poezio.1', data_files=([
'data/poezio_logs.1']), ('share/man/man1/', ['data/poezio.1', 'data/poezio_logs.1']),
('share/poezio/', ['README.rst', 'COPYING', 'CHANGELOG']), ('share/poezio/', ['README.rst', 'COPYING', 'CHANGELOG']),
('share/applications/', ['data/io.poez.Poezio.desktop']), ('share/applications/', ['data/io.poez.Poezio.desktop']),
('share/metainfo/', ['data/io.poez.Poezio.appdata.xml'])] ('share/metainfo/', ['data/io.poez.Poezio.appdata.xml'])
+ find_doc('share/doc/poezio/source', 'source') + find_doc('share/doc/poezio/source', 'source')
+ find_doc('share/doc/poezio/html', 'build/html')), + find_doc('share/doc/poezio/html', 'build/html')
+ sphinx_files_found
install_requires=['slixmpp>=1.5.2', 'aiodns', 'pyasn1_modules', 'pyasn1'], install_requires=['slixmpp>=1.5.2', 'aiodns', 'pyasn1_modules', 'pyasn1'],
extras_require={'OTR plugin': 'python-potr>=1.0', extras_require={'OTR plugin': 'python-potr>=1.0',
'Screen autoaway plugin': 'pyinotify==0.9.4', 'Screen autoaway plugin': 'pyinotify==0.9.4',
'Avoiding cython': 'cffi'} 'Avoiding cython': 'cffi'},
'build_man' : {
'builder': ('', 'man'),
) )
# Remove the link afterwards # Remove the link afterwards
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment