|
4 | 4 | import os |
5 | 5 | import sys |
6 | 6 | from glob import glob |
7 | | -from multiprocessing import cpu_count |
| 7 | +# from multiprocessing import cpu_count |
| 8 | +from subprocess import check_call |
8 | 9 |
|
9 | 10 | import versioneer |
10 | 11 | from setuptools import setup, find_packages |
|
20 | 21 | else: |
21 | 22 | USING_CYTHON = True |
22 | 23 |
|
| 24 | + |
| 25 | +def build_ssh(): |
| 26 | + cmd = './ci/build_ssh.sh' |
| 27 | + return check_call(cmd, env=os.environ, shell=True) |
| 28 | + |
| 29 | + |
| 30 | +# Only build libssh if running a build |
| 31 | +if (len(sys.argv) >= 2 and not ( |
| 32 | + '--help' in sys.argv[1:] or |
| 33 | + sys.argv[1] in ( |
| 34 | + '--help-commands', 'egg_info', '--version', 'clean', |
| 35 | + '--long-description')) and |
| 36 | + __name__ == '__main__'): |
| 37 | + build_ssh() |
| 38 | + |
23 | 39 | ON_WINDOWS = platform.system() == 'Windows' |
24 | 40 |
|
25 | 41 | ext = 'pyx' if USING_CYTHON else 'c' |
|
32 | 48 |
|
33 | 49 | # _comp_args = ["-ggdb"] |
34 | 50 | _comp_args = ["-O3"] if not ON_WINDOWS else None |
35 | | -cython_directives = {'embedsignature': True, |
36 | | - 'boundscheck': False, |
37 | | - 'optimize.use_switch': True, |
38 | | - 'wraparound': False, |
| 51 | +cython_directives = { |
| 52 | + 'embedsignature': True, |
| 53 | + 'boundscheck': False, |
| 54 | + 'optimize.use_switch': True, |
| 55 | + 'wraparound': False, |
39 | 56 | } |
40 | 57 | cython_args = { |
41 | 58 | 'cython_directives': cython_directives, |
|
47 | 64 | if USING_CYTHON: |
48 | 65 | sys.stdout.write("Cython arguments: %s%s" % (cython_args, os.linesep)) |
49 | 66 |
|
| 67 | + |
| 68 | +_lib_dir = os.path.abspath("./src/src") |
50 | 69 | extensions = [ |
51 | | - Extension(sources[i].split('.')[0].replace(os.path.sep, '.'), |
52 | | - sources=[sources[i]], |
53 | | - include_dirs=["libssh/include"], |
54 | | - libraries=_libs, |
55 | | - extra_compile_args=_comp_args, |
56 | | - **cython_args |
| 70 | + Extension( |
| 71 | + sources[i].split('.')[0].replace(os.path.sep, '.'), |
| 72 | + sources=[sources[i]], |
| 73 | + include_dirs=["libssh/include"], |
| 74 | + libraries=_libs, |
| 75 | + library_dirs=[_lib_dir], |
| 76 | + runtime_library_dirs=[_lib_dir], |
| 77 | + extra_compile_args=_comp_args, |
| 78 | + **cython_args |
57 | 79 | ) |
58 | 80 | for i in range(len(sources))] |
59 | 81 |
|
|
0 commit comments