setup.py 3.3 KB
Newer Older
1
#!/usr/bin/env python3
2

3 4 5
try:
    from setuptools import setup, Extension
except ImportError:
6 7 8
    print('\nSetuptools was not found. Install setuptools for python 3.\n')
    import sys
    sys.exit(1)
9

mathieui's avatar
mathieui committed
10
import os
louiz’'s avatar
louiz’ committed
11

mathieui's avatar
mathieui committed
12
module_poopt = Extension('poezio.poopt',
mathieui's avatar
mathieui committed
13
                    extra_compile_args=['-Wno-declaration-after-statement'],
mathieui's avatar
mathieui committed
14
                    sources = ['src/pooptmodule.c'])
louiz’'s avatar
louiz’ committed
15

16 17 18 19 20 21 22 23

current_dir = os.path.dirname(__file__)

# 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'))

24 25 26 27 28
# identify the git version
git_dir = os.path.join(current_dir, '.git')
if os.path.exists(git_dir):
    try:
        import subprocess
29
        result = subprocess.Popen(['git', '--git-dir', git_dir, 'describe'],
mathieui's avatar
mathieui committed
30
                                  stdout=subprocess.PIPE,
31
                                  stderr=subprocess.DEVNULL)
32 33 34 35 36 37 38 39
        result.wait()
        data = result.stdout.read().decode('utf-8', errors='ignore')
        version = '.dev' + data.split('-')[1]
    except:
        version = '.dev1'
else:
    version = '.dev1'

mathieui's avatar
mathieui committed
40
setup(name="poezio",
41
       version="0.9" + version,
mathieui's avatar
mathieui committed
42 43
       description="A console XMPP client",
       long_description=
44 45 46
       "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"
47
       "Documentation is available at http://doc.poez.io/.",
48

louiz’'s avatar
louiz’ committed
49
       ext_modules = [module_poopt],
50
       url = 'http://poez.io/',
mathieui's avatar
mathieui committed
51
       license = 'zlib',
52
       download_url = 'https://dev.louiz.org/projects/poezio/files',
mathieui's avatar
mathieui committed
53

louiz’'s avatar
louiz’ committed
54 55
       author = 'Florent Le Coz',
       author_email = 'louiz@louiz.org',
mathieui's avatar
mathieui committed
56 57 58 59

       maintainer = 'Mathieu Pasquet',
       maintainer_email = 'mathieui@mathieui.net',

mathieui's avatar
mathieui committed
60
       classifiers = ['Development Status :: 2 - Pre-Alpha',
61
                       'Topic :: Communications :: Chat',
mathieui's avatar
mathieui committed
62 63 64 65 66
                       'Environment :: Console :: Curses',
                       'Intended Audience :: End Users/Desktop',
                       'License :: OSI Approved :: zlib/libpng License',
                       'Natural Language :: English',
                       'Operating System :: Unix',
67
                       'Programming Language :: Python :: 3'
mathieui's avatar
mathieui committed
68
                    ],
69
       keywords = ['jabber', 'xmpp', 'client', 'chat', 'im', 'console'],
70 71
       packages = ['poezio', 'poezio.core', 'poezio.tabs', 'poezio.windows',
                   'poezio_plugins', 'poezio_plugins.gpg', 'poezio_themes'],
72
       package_dir = {'poezio': 'src', 'poezio_plugins': 'plugins', 'poezio_themes': 'data/themes'},
73
       package_data = {'poezio': ['default_config.cfg']},
74 75
       scripts = ['scripts/poezio_gpg_export'],
       entry_points={ 'console_scripts': [ 'poezio = poezio:main' ] },
76
       data_files = [('share/man/man1/', ['data/poezio.1'])],
77

mathieui's avatar
mathieui committed
78 79
       install_requires = ['slixmpp',
                           'aiodns'],
80 81
       extras_require = {'OTR plugin': 'python-potr>=1.0',
                         'Screen autoaway plugin': 'pyinotify==0.9.4'}
mathieui's avatar
mathieui committed
82
)
83 84 85 86 87

# 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'))