Uh oh!
There was an error while loading. Please reload this page.
forked from ParallelSSH/ssh2-python
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
Latest commit
160 lines (141 loc) · 5.37 KB
/
Copy pathsetup.py
File metadata and controls
160 lines (141 loc) · 5.37 KB
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# This file is part of ssh2-python.
# Copyright (C) 2017-2025 Panos Kittenis.
# Copyright (C) 2017-2025 ssh2-python Contributors.
#
# 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, version 2.1.
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
importos
importplatform
fromglobimportglob
importsys
fromsetuptoolsimportsetup, find_packages
importversioneer
from_setup_libssh2importbuild_ssh2
cpython=platform.python_implementation() =='CPython'
try:
fromCython.Distutils.extensionimportExtension
fromCython.Distutilsimportbuild_ext
exceptImportError:
fromsetuptoolsimportExtension
USING_CYTHON=False
else:
USING_CYTHON=True
ON_WINDOWS=platform.system() =='Windows'
SYSTEM_LIBSSH2=bool(os.environ.get('SYSTEM_LIBSSH2', 0)) orON_WINDOWS
# Only build libssh2 if SYSTEM_LIBSSH2 is not set and running a build
ifnotSYSTEM_LIBSSH2and (len(sys.argv) >=2andnot (
'--help'insys.argv[1:] or
sys.argv[1] in (
'--help-commands', 'egg_info', '--version', 'clean',
'sdist', '--long-description')) and
__name__=='__main__'):
build_ssh2()
ext='pyx'ifUSING_CYTHONelse'c'
sources=glob('ssh2/*.%s'% (ext,))
_arch=platform.architecture()[0][0:2]
_libs= ['ssh2'] ifnotON_WINDOWSelse [
'Ws2_32', 'libssh2', 'user32',
'libcrypto%sMD'%_arch, 'libssl%sMD'%_arch,
'zlibstatic',
]
# _comp_args = ["-ggdb"]
_fwd_default=0
_comp_args= ["-O2"] ifnotON_WINDOWSelseNone
cython_directives= {'embedsignature': True,
'boundscheck': False,
'optimize.use_switch': True,
'wraparound': False,
'language_level': 3,
}
cython_args= {
'cython_directives': cython_directives,
'cython_compile_time_env': {},
}
ifUSING_CYTHON:
sys.stdout.write("Cython arguments: %s%s"% (cython_args, os.linesep))
runtime_library_dirs= ["$ORIGIN/."] ifnotSYSTEM_LIBSSH2elseNone
_lib_dir=os.path.abspath("./build_dir/src") ifnotSYSTEM_LIBSSH2else"/usr/local/lib"
include_dirs= ["libssh2/include"] ifON_WINDOWSornotSYSTEM_LIBSSH2else [
"/usr/local/include",
"/opt/local/include",
]
extensions= [
Extension(sources[i].split('.')[0].replace(os.path.sep, '.'),
sources=[sources[i]],
include_dirs=include_dirs,
libraries=_libs,
library_dirs=[_lib_dir],
runtime_library_dirs=runtime_library_dirs,
extra_compile_args=_comp_args,
**cython_args,
)
foriinrange(len(sources))]
forextinextensions:
ifext.name=='ssh2.utils':
ext.sources.append('ssh2/ext/find_eol.c')
package_data= {'ssh2': ['*.pxd', 'libssh2.so*']}
ifON_WINDOWS:
package_data['ssh2'].extend([
'libcrypto*.dll', 'libssl*.dll',
'msvc*.dll', 'vcruntime*.dll',
])
cmdclass=versioneer.get_cmdclass()
ifUSING_CYTHON:
cmdclass['build_ext'] =build_ext
setup(
name='ssh2-python',
version=versioneer.get_version(),
cmdclass=cmdclass,
url='https://github.com/ParallelSSH/ssh2-python',
license='LGPL-2.1-only',
license_files=['LICENSE', 'COPYING'],
author='Panos Kittenis',
author_email='danst@tutanota.com',
description='Bindings for libssh2 C library',
long_description=open('README.rst').read(),
packages=find_packages(
'.', exclude=('embedded_server', 'embedded_server.*',
'tests', 'tests.*',
'*.tests', '*.tests.*')),
zip_safe=False,
include_package_data=False,
platforms='any',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'Programming Language :: C',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: 3.14',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: System :: Shells',
'Topic :: System :: Networking',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
'Operating System :: POSIX',
'Operating System :: POSIX :: Linux',
'Operating System :: POSIX :: BSD',
'Operating System :: Microsoft :: Windows',
'Operating System :: MacOS :: MacOS X',
],
ext_modules=extensions,
package_data=package_data,
)