-
Notifications
You must be signed in to change notification settings - Fork 24
/
setup.py
executable file
·115 lines (98 loc) · 3.49 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#
# pylibssh2 - python bindings for libssh2 library
#
# Copyright (C) 2010 Wallix Inc.
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation; either version 2.1 of the License, or (at your
# option) any later version.
#
# This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
"""
Installation script for the libssh2 module
"""
from distutils.core import setup
from distutils.core import Command
from distutils.core import Extension
from distutils.util import get_platform
from platform import python_version
import os, sys, glob
sys.path.append('tests')
sys.path.append("build/lib.%s-%s" % (get_platform(), python_version()[:3]))
sys.path.append('libssh2')
import version as info
version = info.__version__
url = info.__url__
author = info.__author__
author_email = info.__authoremail__
long_description = '''Python binding for libssh2 library'''
classifiers = """Development Status :: 4 - Beta
License :: OSI Approved :: BSD License
Operating System :: POSIX
Programming Language :: C
Programming Language :: Python
Topic :: Security
Topic :: Software Development :: Libraries""".split('\n')
libssh2_src = glob.glob('src/*.c')
libssh2_dep = glob.glob('src/*.h')
libssh2_incdir = None
libssh2_libdir = None
if 'bsd' in sys.platform[:-1] or 'bsd' in os.uname()[0].lower():
libssh2_incdir = ['/usr/local/include/']
libssh2_libdir = ['/usr/local/lib/']
if 'darwin' in sys.platform:
libssh2_incdir = ['/opt/local/include/']
libssh2_libdir = ['/opt/local/lib/']
libssh2_lib = ['ssh2']
libssh2_compile_args = ['-ggdb']
class Libssh2TestCommand(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
import unittest
from test_session import SessionTest
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(SessionTest))
runner = unittest.TextTestRunner()
runner.run(suite)
module = Extension('_libssh2',
define_macros = [
('MAJOR_VERSION', version[0]),
('MINOR_VERSION', version[2]),
('PATCH_VERSION', version[4])
],
sources = libssh2_src,
depends = libssh2_dep,
include_dirs = libssh2_incdir,
library_dirs = libssh2_libdir,
libraries = libssh2_lib,
extra_compile_args = libssh2_compile_args)
setup(name='pylibssh2',
version=version,
packages = ['libssh2'],
package_dir = {
'libssh2' : 'libssh2'
},
description = long_description,
author=author,
author_email=author_email,
url=url,
download_url='%s/download/pylibssh2-%s.tar.gz' % (url, version),
ext_modules = [module],
license = 'LGPL',
platforms = ['Linux', 'BSD'],
long_description = long_description,
classifiers=classifiers,
cmdclass= {'test' : Libssh2TestCommand})