summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorMaxime Buquet <pep@bouah.net>2020-05-31 17:44:18 +0200
committerMaxime Buquet <pep@bouah.net>2020-05-31 17:44:18 +0200
commit7650591c6b921096ca270d626276e94479c271ab (patch)
tree9783599d31ebb87007b420bc104860aa31ca8acb /setup.py
parentfe9992e3e8377896260ce1a92e4abb96cf1e8a01 (diff)
parent887ab27920636c0248639c5f437396a4610a4a51 (diff)
downloadpoezio-7650591c6b921096ca270d626276e94479c271ab.tar.gz
poezio-7650591c6b921096ca270d626276e94479c271ab.tar.bz2
poezio-7650591c6b921096ca270d626276e94479c271ab.tar.xz
poezio-7650591c6b921096ca270d626276e94479c271ab.zip
Merge branch 'integrate-sphinx-manpages' into 'master'
Integrate sphinx manpages See merge request poezio/poezio!141
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py141
1 files changed, 90 insertions, 51 deletions
diff --git a/setup.py b/setup.py
index f54bd8d5..1e7dd8fc 100755
--- a/setup.py
+++ b/setup.py
@@ -1,15 +1,21 @@
#!/usr/bin/env python3
+import os
+import subprocess
+import sys
+from tempfile import TemporaryFile
try:
from setuptools import setup, Extension
except ImportError:
print('\nSetuptools was not found. Install setuptools for python 3.\n')
- import sys
sys.exit(1)
-import os
-import subprocess
-from tempfile import TemporaryFile
+cmdclass = {}
+try:
+ 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__)
@@ -57,8 +63,30 @@ def check_include(library_name, header):
print('%s headers not found.' % library_name)
return False
+def sphinx_man():
+ expected_sphinx_files = [
+ 'build/sphinx/man/poezio.cfg.7',
+ 'build/sphinx/man/poezio.keys.7',
+ 'build/sphinx/man/poezio.commands.7'
+ ]
+ found = []
+ for item in expected_sphinx_files:
+ if os.path.exists(item):
+ found.append(item)
+ if found:
+ return [('share/man/man7/', found)]
+ return []
+
+
+sphinx_files_found = sphinx_man()
+if not sphinx_files_found:
+ print(
+ '\nSphinx-built manpages not found. Only the '
+ 'short handwritten manpages will be installed\n'
+ )
+
+
if not check_include('python3', 'Python.h'):
- import sys
sys.exit(2)
module_poopt = Extension('poezio.poopt',
@@ -88,52 +116,63 @@ else:
with open('README.rst', encoding='utf-8') as readme_fd:
LONG_DESCRIPTION = readme_fd.read()
-setup(name="poezio",
- version="0.14" + version,
- description="A console XMPP client",
- long_description=LONG_DESCRIPTION,
- ext_modules=[module_poopt],
- url='https://poez.io/',
- license='zlib',
- download_url='https://dev.louiz.org/projects/poezio/files',
-
- author='Florent Le Coz',
- author_email='louiz@louiz.org',
-
- maintainer='Mathieu Pasquet',
- maintainer_email='mathieui@mathieui.net',
-
- classifiers=['Development Status :: 5 - Production/Stable',
- 'Topic :: Communications :: Chat',
- 'Topic :: Internet :: XMPP',
- 'Environment :: Console :: Curses',
- 'Intended Audience :: End Users/Desktop',
- 'License :: OSI Approved :: zlib/libpng License',
- 'Natural Language :: English',
- 'Operating System :: Unix',
- 'Programming Language :: Python :: 3.8',
- 'Programming Language :: Python :: 3.7',
- 'Programming Language :: Python :: 3 :: Only'],
- keywords=['jabber', 'xmpp', 'client', 'chat', 'im', 'console'],
- packages=['poezio', 'poezio.core', 'poezio.tabs', 'poezio.windows',
- 'poezio.ui', 'poezio_plugins', 'poezio_themes'],
- package_dir={'poezio': 'poezio',
- 'poezio_plugins': 'plugins',
- 'poezio_themes': 'data/themes'},
- package_data={'poezio': ['default_config.cfg']},
- scripts=['scripts/poezio_logs'],
- entry_points={'console_scripts': ['poezio = poezio.__main__:run']},
- data_files=([('share/man/man1/', ['data/poezio.1',
- 'data/poezio_logs.1']),
- ('share/poezio/', ['README.rst', 'COPYING', 'CHANGELOG']),
- ('share/applications/', ['data/io.poez.Poezio.desktop']),
- ('share/metainfo/', ['data/io.poez.Poezio.appdata.xml'])]
- + find_doc('share/doc/poezio/source', 'source')
- + find_doc('share/doc/poezio/html', 'build/html')),
- install_requires=['slixmpp>=1.5.2', 'aiodns', 'pyasn1_modules', 'pyasn1'],
- extras_require={'OTR plugin': 'python-potr>=1.0',
- 'Screen autoaway plugin': 'pyinotify==0.9.4',
- 'Avoiding cython': 'cffi'})
+setup(
+ name="poezio",
+ version="0.14" + version,
+ description="A console XMPP client",
+ long_description=LONG_DESCRIPTION,
+ ext_modules=[module_poopt],
+ url='https://poez.io/',
+ license='zlib',
+ download_url='https://dev.louiz.org/projects/poezio/files',
+
+ author='Florent Le Coz',
+ author_email='louiz@louiz.org',
+
+ maintainer='Mathieu Pasquet',
+ maintainer_email='mathieui@mathieui.net',
+
+ classifiers=['Development Status :: 5 - Production/Stable',
+ 'Topic :: Communications :: Chat',
+ 'Topic :: Internet :: XMPP',
+ 'Environment :: Console :: Curses',
+ 'Intended Audience :: End Users/Desktop',
+ 'License :: OSI Approved :: zlib/libpng License',
+ 'Natural Language :: English',
+ 'Operating System :: Unix',
+ 'Programming Language :: Python :: 3.8',
+ 'Programming Language :: Python :: 3.7',
+ 'Programming Language :: Python :: 3 :: Only'],
+ keywords=['jabber', 'xmpp', 'client', 'chat', 'im', 'console'],
+ packages=['poezio', 'poezio.core', 'poezio.tabs', 'poezio.windows',
+ 'poezio.ui', 'poezio_plugins', 'poezio_themes'],
+ package_dir={'poezio': 'poezio',
+ 'poezio_plugins': 'plugins',
+ 'poezio_themes': 'data/themes'},
+ package_data={'poezio': ['default_config.cfg']},
+ scripts=['scripts/poezio_logs'],
+ entry_points={'console_scripts': ['poezio = poezio.__main__:run']},
+ data_files=([
+ ('share/man/man1/', ['data/poezio.1', 'data/poezio_logs.1']),
+ ('share/poezio/', ['README.rst', 'COPYING', 'CHANGELOG']),
+ ('share/applications/', ['data/io.poez.Poezio.desktop']),
+ ('share/metainfo/', ['data/io.poez.Poezio.appdata.xml'])
+ ]
+ + find_doc('share/doc/poezio/source', 'source')
+ + find_doc('share/doc/poezio/html', 'build/html')
+ + sphinx_files_found
+ ),
+ install_requires=['slixmpp>=1.5.2', 'aiodns', 'pyasn1_modules', 'pyasn1'],
+ extras_require={'OTR plugin': 'python-potr>=1.0',
+ 'Screen autoaway plugin': 'pyinotify==0.9.4',
+ 'Avoiding cython': 'cffi'},
+ cmdclass=cmdclass,
+ command_options={
+ 'build_man' : {
+ 'builder': ('setup.py', 'man'),
+ }
+ },
+)
# Remove the link afterwards
if (os.path.exists(os.path.join(current_dir, 'poezio', 'default_config.cfg')) and