-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: improvements to pythran-config for build system integration #2270
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -308,10 +308,7 @@ def run(): | |
Dump on stdout the config flags required to compile pythran-generated code. | ||
''' | ||
import argparse | ||
import distutils.ccompiler | ||
import distutils.sysconfig | ||
import pythran | ||
import numpy | ||
|
||
parser = argparse.ArgumentParser( | ||
prog='pythran-config', | ||
|
@@ -323,7 +320,24 @@ def run(): | |
help='print default compiler') | ||
|
||
parser.add_argument('--cflags', action='store_true', | ||
help='print compilation flags') | ||
help='print compilation flags to compile extension ' | ||
'modules directly') | ||
|
||
# The with-BLAS variant could be added if there's user demand. Unclear | ||
# if there are packages that need this, and also integrate with a build | ||
# system for Python and NumPy flags. SciPy and scikit-image need the | ||
# no-BLAS variant. | ||
parser.add_argument('--cflags-pythran-only', action='store_true', | ||
help='print compilation flags for usage by a build ' | ||
'system (doesn\'t include Python, NumPy or BLAS ' | ||
'flags).' | ||
) | ||
|
||
parser.add_argument('--include-dir', action='store_true', | ||
help=( | ||
'print Pythran include directory ' | ||
'(matches `pythran.get_include()`).') | ||
) | ||
|
||
parser.add_argument('--libs', action='store_true', | ||
help='print linker flags') | ||
|
@@ -344,6 +358,26 @@ def run(): | |
|
||
args = parser.parse_args(sys.argv[1:]) | ||
|
||
# This should not rely on distutils/setuptools, or anything else not in the | ||
# stdlib. Please don't add imports higher up. | ||
if args.cflags_pythran_only: | ||
if args.cflags: | ||
print("Error: --cflags and --cflags-pythran-only are mutually " | ||
"exclusive, please use only one.") | ||
|
||
compile_flags = [ | ||
"-D__PYTHRAN__=3", | ||
"-DENABLE_PYTHON_MODULE", | ||
"-DPYTHRAN_BLAS_NONE", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand that this blas flag is the one you need for scipy, but it should really depend on current config. You mentioned
In the gommit message but I think that's fine, it should just be also forwaded to extension = There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay thanks, I'll see if I can figure out how to introduce this now then. |
||
] | ||
print(" ".join(compile_flags), f"-I{get_include()}") | ||
return None | ||
|
||
|
||
import distutils.ccompiler | ||
import distutils.sysconfig | ||
import numpy | ||
|
||
args.python = not args.no_python | ||
|
||
output = [] | ||
|
@@ -411,6 +445,9 @@ def fmt_define(define): | |
if args.libs: | ||
output.extend(ldflags) | ||
|
||
if args.include_dir: | ||
output.append(get_include()) | ||
|
||
if output: | ||
print(' '.join(output)) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed
__PYTHRAN__
in 075cefc