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

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

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

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

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

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

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