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

3 4 5
try:
    from setuptools import setup, Extension
except ImportError:
6 7 8 9 10
    print('Setuptools was not found.\n'
          'This script will use distutils instead, which will NOT'
          ' be able to install a `poezio` executable.\nIf you are '
          'using it to build a package or install poezio, please '
          'install setuptools.\n\nYou will also see a few warnings.\n')
11 12
    from distutils.core import setup, Extension

mathieui's avatar
mathieui committed
13
import os
louiz’'s avatar
louiz’ committed
14

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

19 20 21 22 23 24 25 26

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

27 28 29 30 31
# identify the git version
git_dir = os.path.join(current_dir, '.git')
if os.path.exists(git_dir):
    try:
        import subprocess
32
        result = subprocess.Popen(['git', '--git-dir', git_dir, 'describe'],
mathieui's avatar
mathieui committed
33
                                  stdout=subprocess.PIPE,
34
                                  stderr=subprocess.DEVNULL)
35 36 37 38 39 40 41 42
        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
43
setup(name="poezio",
44
       version="0.9" + version,
mathieui's avatar
mathieui committed
45 46
       description="A console XMPP client",
       long_description=
47 48 49
       "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"
50
       "Documentation is available at http://doc.poez.io/.",
51

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

louiz’'s avatar
louiz’ committed
57 58
       author = 'Florent Le Coz',
       author_email = 'louiz@louiz.org',
mathieui's avatar
mathieui committed
59 60 61 62

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

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

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

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