summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py126
1 files changed, 75 insertions, 51 deletions
diff --git a/setup.py b/setup.py
index 97ae2a53..bc9c218b 100755
--- a/setup.py
+++ b/setup.py
@@ -7,23 +7,47 @@ except ImportError:
import sys
sys.exit(1)
-import os
+from os.path import basename, dirname, exists, join
+from os import link, walk, unlink
-module_poopt = Extension('poezio.poopt',
- extra_compile_args=['-Wno-declaration-after-statement'],
- sources = ['src/pooptmodule.c'])
+current_dir = dirname(__file__)
+def get_relative_dir(folder, stopper):
+ """
+ Find the path from a directory to a pseudo-root in order to recreate
+ the filetree.
+ """
+ acc = []
+ last = basename(folder)
+ while last != stopper:
+ acc.append(last)
+ folder = dirname(folder)
+ last = basename(folder)
+ return join(*acc[::-1]) if acc else ''
-current_dir = os.path.dirname(__file__)
+def find_doc(before, path):
+ _files = []
+ stop = basename(path)
+ for root, dirs, files in walk(join(current_dir, 'doc', path)):
+ files_path = []
+ relative_root = get_relative_dir(root, stop)
+ for name in files:
+ files_path.append(join(root, name))
+ _files.append((join(before, relative_root), files_path))
+ return _files
+
+module_poopt = Extension('poezio.poopt',
+ extra_compile_args=['-Wno-declaration-after-statement'],
+ sources=['src/pooptmodule.c'])
# Create a link to the config file (for packaging purposes)
-if not os.path.exists(os.path.join(current_dir, 'src', 'default_config.cfg')):
- os.link(os.path.join(current_dir, 'data', 'default_config.cfg'),
- os.path.join(current_dir, 'src', 'default_config.cfg'))
+if not exists(join(current_dir, 'src', 'default_config.cfg')):
+ link(join(current_dir, 'data', 'default_config.cfg'),
+ join(current_dir, 'src', 'default_config.cfg'))
# identify the git version
-git_dir = os.path.join(current_dir, '.git')
-if os.path.exists(git_dir):
+git_dir = join(current_dir, '.git')
+if exists(git_dir):
try:
import subprocess
result = subprocess.Popen(['git', '--git-dir', git_dir, 'describe'],
@@ -37,51 +61,51 @@ if os.path.exists(git_dir):
else:
version = '.dev1'
-setup(name="poezio",
- version="0.9" + version,
- description="A console XMPP client",
- long_description=
- "Poezio is a Free chat client aiming to reproduce the ease of use of most "
- "IRC clients (e.g. weechat, irssi) while using the XMPP network."
- "\n"
- "Documentation is available at http://doc.poez.io/.",
-
- ext_modules = [module_poopt],
- url = 'http://poez.io/',
- license = 'zlib',
- download_url = 'https://dev.louiz.org/projects/poezio/files',
+with open('README.rst', encoding='utf-8') as readme_fd:
+ LONG_DESCRIPTION = readme_fd.read()
- author = 'Florent Le Coz',
- author_email = 'louiz@louiz.org',
+setup(name="poezio",
+ version="0.9" + version,
+ description="A console XMPP client",
+ long_description=LONG_DESCRIPTION,
+ ext_modules=[module_poopt],
+ url='http://poez.io/',
+ license='zlib',
+ download_url='https://dev.louiz.org/projects/poezio/files',
- maintainer = 'Mathieu Pasquet',
- maintainer_email = 'mathieui@mathieui.net',
+ author='Florent Le Coz',
+ author_email='louiz@louiz.org',
- classifiers = ['Development Status :: 2 - Pre-Alpha',
- 'Topic :: Communications :: Chat',
- 'Environment :: Console :: Curses',
- 'Intended Audience :: End Users/Desktop',
- 'License :: OSI Approved :: zlib/libpng License',
- 'Natural Language :: English',
- 'Operating System :: Unix',
- 'Programming Language :: Python :: 3'
- ],
- keywords = ['jabber', 'xmpp', 'client', 'chat', 'im', 'console'],
- packages = ['poezio', 'poezio.core', 'poezio.tabs', 'poezio.windows',
- 'poezio_plugins', 'poezio_plugins.gpg', 'poezio_themes'],
- package_dir = {'poezio': 'src', 'poezio_plugins': 'plugins', 'poezio_themes': 'data/themes'},
- package_data = {'poezio': ['default_config.cfg']},
- scripts = ['scripts/poezio_gpg_export'],
- entry_points={ 'console_scripts': [ 'poezio = poezio:main' ] },
- data_files = [('share/man/man1/', ['data/poezio.1'])],
+ maintainer='Mathieu Pasquet',
+ maintainer_email='mathieui@mathieui.net',
- install_requires = ['slixmpp',
- 'aiodns'],
- extras_require = {'OTR plugin': 'python-potr>=1.0',
- 'Screen autoaway plugin': 'pyinotify==0.9.4'}
-)
+ classifiers=['Development Status :: 2 - Pre-Alpha',
+ 'Topic :: Communications :: Chat',
+ 'Environment :: Console :: Curses',
+ 'Intended Audience :: End Users/Desktop',
+ 'License :: OSI Approved :: zlib/libpng License',
+ 'Natural Language :: English',
+ 'Operating System :: Unix',
+ 'Programming Language :: Python :: 3.4',
+ 'Programming Language :: Python :: 3 :: Only'],
+ keywords=['jabber', 'xmpp', 'client', 'chat', 'im', 'console'],
+ packages=['poezio', 'poezio.core', 'poezio.tabs', 'poezio.windows',
+ 'poezio_plugins', 'poezio_plugins.gpg', 'poezio_themes'],
+ package_dir={'poezio': 'src',
+ 'poezio_plugins': 'plugins',
+ 'poezio_themes': 'data/themes'},
+ package_data={'poezio': ['default_config.cfg']},
+ scripts=['scripts/poezio_gpg_export'],
+ entry_points={'console_scripts': ['poezio = poezio:main']},
+ data_files=([('share/man/man1/', ['data/poezio.1']),
+ ('share/poezio/', ['README.rst', 'COPYING', 'CHANGELOG'])]
+ + find_doc('share/doc/poezio/html', 'source')
+ + find_doc('share/doc/poezio/source', 'build/html')),
+ install_requires=['slixmpp', 'aiodns'],
+ extras_require={'OTR plugin': 'python-potr>=1.0',
+ 'Screen autoaway plugin': 'pyinotify==0.9.4'})
# Remove the link afterwards
-if os.path.exists(os.path.join(current_dir, 'src', 'default_config.cfg')):
- os.unlink(os.path.join(current_dir, 'src', 'default_config.cfg'))
+if exists(join(current_dir, 'src', 'default_config.cfg')):
+ unlink(join(current_dir, 'src', 'default_config.cfg'))