~alencool/elloquence/ello-trunk

2.1.28 by Alen Bou-Haidar
setup script fixes
1
#!/usr/bin/env python
2
3
from distutils.core import setup
4
import os
5
6
import pymsn
7
8
9
# Metadata
10
NAME = "pymsn"
11
VERSION = pymsn.__version__
12
DESCRIPTION = "Python msn client library"
13
AUTHOR = "Ali Sabil"
14
AUTHOR_EMAIL = "ali.sabil@gmail.com"
15
URL = pymsn.__url__
16
LICENSE = pymsn.__license__
17
18
# Compile the list of packages available, because distutils doesn't have
19
# an easy way to do this.
20
def path_split(path, result=None):
21
    """
22
    Split a pathname into components (the opposite of os.path.join) in a
23
    platform-neutral way.
24
    """
25
    if result is None:
26
        result = []
27
    head, tail = os.path.split(path)
28
    if head == '':
29
        return [tail] + result
30
    if head == path:
31
        return result
32
    return path_split(head, [tail] + result)
33
34
packages, data_files = [], []
35
root_dir = os.path.dirname(__file__)
36
pieces = path_split(root_dir)
37
if pieces[-1] == '':
38
    len_root_dir = len(pieces) - 1
39
else:
40
    len_root_dir = len(pieces)
41
42
pymsn_dir = os.path.join(root_dir, 'pymsn')
43
for dirpath, dirnames, filenames in os.walk(pymsn_dir):
44
    # Ignore dirnames that start with '.'
45
    for i, dirname in enumerate(dirnames):
46
        if dirname.startswith('.'):
47
            del dirnames[i]
48
    if '__init__.py' in filenames:
49
        packages.append('.'.join(path_split(dirpath)[len_root_dir:]))
50
    elif filenames:
51
        data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
52
53
# Setup
54
setup(name=NAME,
55
      version=VERSION,
56
      description=DESCRIPTION,
57
      author=AUTHOR,
58
      author_email=AUTHOR_EMAIL,
59
      url=URL,
60
      license=LICENSE,
61
      platforms=["any"],
62
      packages=packages,
63
      classifiers=[
64
          'Development Status :: 3 - Alpha',
65
          'Environment :: Console',
66
          'Intended Audience :: Developers',
67
          'Intended Audience :: Telecommunications Industry',
68
          'License :: OSI Approved :: GNU General Public License (GPL)',
69
          'Operating System :: POSIX',
70
          'Operating System :: MacOS :: MacOS X',
71
          'Operating System :: Microsoft :: Windows',
72
          'Programming Language :: Python',
73
          'Topic :: Communications :: Chat',
74
          'Topic :: Communications :: Telephony',
75
          'Topic :: Internet',
76
          'Topic :: Software Development :: Libraries :: Python Modules'
77
          ])