|
6 | 6 | BSD license. Parts are from lxml (https://github.com/lxml/lxml)
|
7 | 7 | """
|
8 | 8 |
|
| 9 | +import argparse |
9 | 10 | from distutils.sysconfig import get_config_vars
|
10 | 11 | from distutils.version import LooseVersion
|
11 | 12 | import os
|
@@ -129,12 +130,7 @@ def build_extensions(self):
|
129 | 130 | if cython:
|
130 | 131 | self.render_templates(_pxifiles)
|
131 | 132 |
|
132 |
| - numpy_incl = pkg_resources.resource_filename("numpy", "core/include") |
133 |
| - |
134 |
| - for ext in self.extensions: |
135 |
| - if hasattr(ext, "include_dirs") and numpy_incl not in ext.include_dirs: |
136 |
| - ext.include_dirs.append(numpy_incl) |
137 |
| - _build_ext.build_extensions(self) |
| 133 | + super().build_extensions() |
138 | 134 |
|
139 | 135 |
|
140 | 136 | DESCRIPTION = "Powerful data structures for data analysis, time series, and statistics"
|
@@ -530,6 +526,19 @@ def maybe_cythonize(extensions, *args, **kwargs):
|
530 | 526 | if hasattr(ext, "include_dirs") and numpy_incl not in ext.include_dirs:
|
531 | 527 | ext.include_dirs.append(numpy_incl)
|
532 | 528 |
|
| 529 | + # reuse any parallel arguments provided for compliation to cythonize |
| 530 | + parser = argparse.ArgumentParser() |
| 531 | + parser.add_argument("-j", type=int) |
| 532 | + parser.add_argument("--parallel", type=int) |
| 533 | + parsed, _ = parser.parse_known_args() |
| 534 | + |
| 535 | + nthreads = 0 |
| 536 | + if parsed.parallel: |
| 537 | + nthreads = parsed.parallel |
| 538 | + elif parsed.j: |
| 539 | + nthreads = parsed.j |
| 540 | + |
| 541 | + kwargs["nthreads"] = nthreads |
533 | 542 | build_ext.render_templates(_pxifiles)
|
534 | 543 | return cythonize(extensions, *args, **kwargs)
|
535 | 544 |
|
@@ -686,7 +695,7 @@ def srcpath(name=None, suffix=".pyx", subdir="src"):
|
686 | 695 | "_libs.window.aggregations": {
|
687 | 696 | "pyxfile": "_libs/window/aggregations",
|
688 | 697 | "language": "c++",
|
689 |
| - "suffix": ".cpp" |
| 698 | + "suffix": ".cpp", |
690 | 699 | },
|
691 | 700 | "_libs.window.indexers": {"pyxfile": "_libs/window/indexers"},
|
692 | 701 | "_libs.writers": {"pyxfile": "_libs/writers"},
|
|
0 commit comments