2014-03-20 23:54:46 +00:00
|
|
|
#!/usr/bin/env python3
|
2014-10-27 18:16:32 +00:00
|
|
|
|
2014-03-22 12:33:21 +00:00
|
|
|
try:
|
|
|
|
from setuptools import setup, Extension
|
|
|
|
except ImportError:
|
2015-02-07 21:09:05 +00:00
|
|
|
print('\nSetuptools was not found. Install setuptools for python 3.\n')
|
|
|
|
import sys
|
|
|
|
sys.exit(1)
|
2014-03-22 12:33:21 +00:00
|
|
|
|
2015-02-10 16:40:53 +00:00
|
|
|
from os.path import basename, dirname, exists, join
|
|
|
|
from os import link, walk, unlink
|
2011-09-09 16:46:42 +00:00
|
|
|
|
2015-02-10 16:40:53 +00:00
|
|
|
current_dir = dirname(__file__)
|
2011-09-09 16:46:42 +00:00
|
|
|
|
2015-02-10 16:40:53 +00:00
|
|
|
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 ''
|
2013-05-29 13:32:25 +00:00
|
|
|
|
2015-02-10 16:40:53 +00:00
|
|
|
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'],
|
2016-03-31 17:54:41 +00:00
|
|
|
sources=['poezio/pooptmodule.c'])
|
2013-05-29 13:32:25 +00:00
|
|
|
|
|
|
|
# Create a link to the config file (for packaging purposes)
|
2016-03-31 17:54:41 +00:00
|
|
|
if not exists(join(current_dir, 'poezio', 'default_config.cfg')):
|
2015-02-10 16:40:53 +00:00
|
|
|
link(join(current_dir, 'data', 'default_config.cfg'),
|
2016-03-31 17:54:41 +00:00
|
|
|
join(current_dir, 'poezio', 'default_config.cfg'))
|
2013-05-29 13:32:25 +00:00
|
|
|
|
2015-01-20 23:29:08 +00:00
|
|
|
# identify the git version
|
2015-02-10 16:40:53 +00:00
|
|
|
git_dir = join(current_dir, '.git')
|
|
|
|
if exists(git_dir):
|
2015-01-20 23:29:08 +00:00
|
|
|
try:
|
|
|
|
import subprocess
|
2015-01-21 13:18:19 +00:00
|
|
|
result = subprocess.Popen(['git', '--git-dir', git_dir, 'describe'],
|
2015-01-21 13:47:10 +00:00
|
|
|
stdout=subprocess.PIPE,
|
2015-01-21 13:18:19 +00:00
|
|
|
stderr=subprocess.DEVNULL)
|
2015-01-20 23:29:08 +00:00
|
|
|
result.wait()
|
|
|
|
data = result.stdout.read().decode('utf-8', errors='ignore')
|
|
|
|
version = '.dev' + data.split('-')[1]
|
|
|
|
except:
|
|
|
|
version = '.dev1'
|
|
|
|
else:
|
|
|
|
version = '.dev1'
|
|
|
|
|
2015-02-10 16:40:53 +00:00
|
|
|
with open('README.rst', encoding='utf-8') as readme_fd:
|
|
|
|
LONG_DESCRIPTION = readme_fd.read()
|
2013-05-26 18:07:12 +00:00
|
|
|
|
2015-02-10 16:40:53 +00:00
|
|
|
setup(name="poezio",
|
2017-01-30 23:22:19 +00:00
|
|
|
version="1.0" + version,
|
2015-02-10 16:40:53 +00:00
|
|
|
description="A console XMPP client",
|
|
|
|
long_description=LONG_DESCRIPTION,
|
|
|
|
ext_modules=[module_poopt],
|
2016-03-09 17:03:02 +00:00
|
|
|
url='https://poez.io/',
|
2015-02-10 16:40:53 +00:00
|
|
|
license='zlib',
|
|
|
|
download_url='https://dev.louiz.org/projects/poezio/files',
|
2013-05-26 18:07:12 +00:00
|
|
|
|
2015-02-10 16:40:53 +00:00
|
|
|
author='Florent Le Coz',
|
|
|
|
author_email='louiz@louiz.org',
|
2013-05-26 18:07:12 +00:00
|
|
|
|
2015-02-10 16:40:53 +00:00
|
|
|
maintainer='Mathieu Pasquet',
|
|
|
|
maintainer_email='mathieui@mathieui.net',
|
2014-03-20 23:54:46 +00:00
|
|
|
|
2016-08-31 02:17:17 +00:00
|
|
|
classifiers=['Development Status :: 5 - Production/Stable',
|
2015-02-10 16:40:53 +00:00
|
|
|
'Topic :: Communications :: Chat',
|
|
|
|
'Environment :: Console :: Curses',
|
|
|
|
'Intended Audience :: End Users/Desktop',
|
|
|
|
'License :: OSI Approved :: zlib/libpng License',
|
|
|
|
'Natural Language :: English',
|
|
|
|
'Operating System :: Unix',
|
2017-02-13 18:03:12 +00:00
|
|
|
'Programming Language :: Python :: 3.6',
|
2016-08-31 02:17:17 +00:00
|
|
|
'Programming Language :: Python :: 3.5',
|
2015-02-10 16:40:53 +00:00
|
|
|
'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'],
|
2016-03-31 17:54:41 +00:00
|
|
|
package_dir={'poezio': 'poezio',
|
2015-02-10 16:40:53 +00:00
|
|
|
'poezio_plugins': 'plugins',
|
|
|
|
'poezio_themes': 'data/themes'},
|
|
|
|
package_data={'poezio': ['default_config.cfg']},
|
2016-08-24 21:20:57 +00:00
|
|
|
scripts=['scripts/poezio_gpg_export', 'scripts/poezio_logs'],
|
2016-07-02 23:59:05 +00:00
|
|
|
entry_points={'console_scripts': ['poezio = poezio.__main__:run']},
|
2016-10-28 15:24:39 +00:00
|
|
|
data_files=([('share/man/man1/', ['data/poezio.1',
|
|
|
|
'data/poezio_gpg_export.1',
|
|
|
|
'data/poezio_logs.1']),
|
2015-02-10 16:40:53 +00:00
|
|
|
('share/poezio/', ['README.rst', 'COPYING', 'CHANGELOG'])]
|
2015-02-10 20:18:09 +00:00
|
|
|
+ find_doc('share/doc/poezio/source', 'source')
|
|
|
|
+ find_doc('share/doc/poezio/html', 'build/html')),
|
2017-01-30 23:17:32 +00:00
|
|
|
install_requires=['slixmpp>=1.2.4', 'aiodns'],
|
2015-02-10 16:40:53 +00:00
|
|
|
extras_require={'OTR plugin': 'python-potr>=1.0',
|
|
|
|
'Screen autoaway plugin': 'pyinotify==0.9.4'})
|
2013-05-29 13:32:25 +00:00
|
|
|
|
|
|
|
# Remove the link afterwards
|
2016-03-31 17:54:41 +00:00
|
|
|
if (exists(join(current_dir, 'poezio', 'default_config.cfg')) and
|
2015-02-26 22:40:18 +00:00
|
|
|
exists(join(current_dir, 'data', 'default_config.cfg'))):
|
|
|
|
|
2016-03-31 17:54:41 +00:00
|
|
|
unlink(join(current_dir, 'poezio', 'default_config.cfg'))
|
2013-05-29 13:32:25 +00:00
|
|
|
|