-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsetup.py
90 lines (80 loc) · 3.13 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env python
"""Installs PySWITCH using distutils
Run:
python setup.py install
to install the package from the source archive.
"""
def npFilesFor( dirname ):
"""Return all non-python-file filenames in dir"""
result = []
allResults = []
for name in os.listdir(dirname):
path = os.path.join( dirname, name )
if os.path.isfile( path) and os.path.splitext( name )[1] not in ('.py','.pyc','.pyo'):
result.append( path )
elif os.path.isdir( path ) and name.lower() !='cvs':
allResults.extend( npFilesFor(path))
if result:
allResults.append( (dirname, result))
return allResults
##############
## Following is from Pete Shinners,
## apparently it will work around the reported bug on
## some unix machines where the data files are copied
## to weird locations if the user's configuration options
## were entered during the wrong phase of the moon :) .
from distutils.command.install_data import install_data
class smart_install_data(install_data):
def run(self):
#need to change self.install_dir to the library dir
install_cmd = self.get_finalized_command('install')
self.install_dir = getattr(install_cmd, 'install_lib')
# should create the directory if it doesn't exist!!!
return install_data.run(self)
if __name__ == "__main__":
import sys,os, string
from distutils.sysconfig import *
from distutils.core import setup
dataFiles = npFilesFor('doc') + npFilesFor( 'examples') + [('.',('license.txt',))]
dataFiles = [(os.path.join('pyswitch',directory), files) for (directory,files) in dataFiles]
from sys import hexversion
if hexversion >= 0x2030000:
# work around distutils complaints under Python 2.2.x
extraArguments = {
'classifiers': [
"""License :: OSI Approved :: GNU General Public License (GPL)""",
"""Programming Language :: Python""",
"""Topic :: Software Development :: Libraries :: Python Modules""",
"""Intended Audience :: Developers""",
],
'keywords': 'freeswitch,eventsocekt,twisted,protocol,',
'long_description' : """Twisted Protocols for interaction with FreeSWITCH
Provides EventSocket protocol under Twisted,
allowing for fairly extensive customisation of FreeSWITCH operations
from a Twisted process.""",
'platforms': ['Any'],
}
else:
extraArguments = {}
setup(
name = "pyswitch",
version = '0.3',
url = "http://pyswitch.sf.net",
download_url = "https://sourceforge.net/projects/pyswitch/files/",
description = "Twisted Protocols for interaction with the FreeSWITCH",
author = "Godson Gera",
author_email = "[email protected]",
license = "GPL",
package_dir = {
'pyswitch':'.',
},
packages = [
'pyswitch',
'pyswitch.examples',
],
options = {
'sdist':{'force_manifest':1,'formats':['gztar','zip'],},
},
data_files = dataFiles,
cmdclass = {'install_data':smart_install_data},
**extraArguments)