|
4 | 4 | import os |
5 | 5 | import sys |
6 | 6 | from glob import glob |
| 7 | +from multiprocessing import cpu_count |
7 | 8 |
|
8 | 9 | # import versioneer |
9 | 10 | from setuptools import setup, find_packages, Extension |
|
17 | 18 | else: |
18 | 19 | USING_CYTHON = True |
19 | 20 |
|
20 | | -names = 'ssh2/*' |
21 | 21 | ext = 'pyx' if USING_CYTHON else 'c' |
22 | 22 | sources = ['ssh2/*.%s' % (ext,)] |
23 | | - |
| 23 | +_libs = ['ssh2'] |
| 24 | +_comp_args = ["-ggdb"] # , "-O3"] |
24 | 25 |
|
25 | 26 | if USING_CYTHON: |
26 | 27 | extensions = [ |
27 | 28 | Extension('ssh2/*', |
28 | 29 | sources=sources, |
29 | | - libraries=['ssh2'], |
30 | | - # extra_compile_args=["-O3"], |
31 | | - extra_compile_args=["-ggdb"], |
| 30 | + libraries=_libs, |
| 31 | + extra_compile_args=_comp_args, |
32 | 32 | # For conditional compilation |
33 | 33 | # pyrex_compile_time_env |
34 | 34 | ) |
35 | | - # for ext in extensions |
36 | 35 | ] |
37 | 36 | extensions = cythonize( |
38 | 37 | extensions, |
39 | 38 | compiler_directives={'embedsignature': True, |
40 | 39 | 'optimize.use_switch': True, |
41 | | - # 'boundscheck': False, |
| 40 | + 'boundscheck': False, |
42 | 41 | 'wraparound': False, |
43 | | - }) |
| 42 | + }, |
| 43 | + nthreads=cpu_count()) |
44 | 44 | else: |
45 | 45 | sources = glob(sources[0]) |
46 | | - # names = [ for s in sources] |
47 | 46 | extensions = [ |
48 | 47 | Extension(sources[i].split('.')[0].replace('/', '.'), |
49 | 48 | sources=[sources[i]], |
50 | | - libraries=['ssh2'], |
51 | | - # extra_compile_args=["-O3"], |
52 | | - extra_compile_args=["-ggdb"], |
| 49 | + libraries=_libs, |
| 50 | + extra_compile_args=_comp_args, |
53 | 51 | # For conditional compilation |
54 | 52 | # pyrex_compile_time_env |
55 | 53 | ) |
|
0 commit comments