Skip to content
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

STY: Style fixes of meson build files #75

Merged
merged 6 commits into from
Oct 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions scipy/_lib/_uarray/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

# FIXME: /EHsc is the default already, and for hidden use gnu_symbol_visibility
# (see fft/_pocketfft)

compiler = meson.get_compiler('cpp')

if compiler.get_id() == 'msvc'
cpp_args = '/EHsc'
elif compiler.has_argument('-fvisibility=hidden')
Expand All @@ -14,10 +16,11 @@ endif

py3.extension_module('_uarray',
['_uarray_dispatch.cxx', 'vectorcall.cxx'],
cpp_args : [cpp_args, '-Wno-terminate', '-Wno-unused-function'],
dependencies : py3_dep,
install : true,
subdir : 'scipy/_lib/_uarray')
cpp_args: [cpp_args, '-Wno-terminate', '-Wno-unused-function'],
dependencies: py3_dep,
install: true,
subdir: 'scipy/_lib/_uarray'
)


python_sources = [
Expand All @@ -26,7 +29,7 @@ python_sources = [
]

py3.install_sources(
python_sources,
pure: false,
subdir: 'scipy/_lib/_uarray'
python_sources,
pure: false,
subdir: 'scipy/_lib/_uarray'
)
80 changes: 46 additions & 34 deletions scipy/_lib/meson.build
Original file line number Diff line number Diff line change
@@ -1,79 +1,91 @@
_lib_pxd = custom_target('_lib_pxd',
output : [
output: [
'__init__.py',
'_ccallback_c.pxd',
'ccallback.pxd',
'messagestream.pxd',
],
input : [
input: [
'__init__.py',
'_ccallback_c.pxd',
'ccallback.pxd',
'messagestream.pxd',
],
command : ['cp', '@INPUT@', '@OUTDIR@'],
command: ['cp', '@INPUT@', '@OUTDIR@']
)

_lib_pxd_dep = declare_dependency(sources: _lib_pxd)


py3.extension_module('_ccallback_c',
'_ccallback_c.pyx',
include_directories : 'src',
dependencies : py3_dep,
install : true,
subdir : 'scipy/_lib')
include_directories: 'src',
dependencies: py3_dep,
install: true,
subdir: 'scipy/_lib'
)

py3.extension_module('_test_ccallback',
'src/_test_ccallback.c',
include_directories : 'src',
dependencies : py3_dep,
install : true,
subdir : 'scipy/_lib')
include_directories: 'src',
dependencies: py3_dep,
install: true,
subdir: 'scipy/_lib'
)

py3.extension_module('_fpumode',
'_fpumode.c',
include_directories : 'src',
dependencies : py3_dep,
install : true,
subdir : 'scipy/_lib')
include_directories: 'src',
dependencies: py3_dep,
install: true,
subdir: 'scipy/_lib'
)

py3.extension_module('_test_deprecation_call',
'_test_deprecation_call.pyx',
include_directories : 'src',
dependencies : py3_dep,
install : true,
subdir : 'scipy/_lib')
include_directories: 'src',
dependencies: py3_dep,
install: true,
subdir: 'scipy/_lib'
)

py3.extension_module('_test_deprecation_def',
'_test_deprecation_def.pyx',
include_directories : 'src',
dependencies : py3_dep,
install : true,
subdir : 'scipy/_lib')
include_directories: 'src',
dependencies: py3_dep,
install: true,
subdir: 'scipy/_lib'
)

# May be easier as a compile flag, but use a config header file to stay
# in sync with what is done in setup.py
# TODO: the `prefix` here is recommended in
# https://mesonbuild.com/Compiler-properties.html#does-a-function-exist
# and seems needed, but why does it fail to detect it for the conda
# compiler? Does it not exist, or is it hidden elsewhere?

conf_memstream = configuration_data()

if meson.get_compiler('c').has_function('open_memstream',
prefix : '#include <stdio.h>')
prefix: '#include <stdio.h>')
conf_memstream.set('has_openmemstream', '1')
else
conf_memstream.set('has_openmemstream', '0')
endif
configure_file(input : 'src/messagestream_config.h.in',
output : 'messagestream_config.h',
configuration : conf_memstream)

configure_file(
input: 'src/messagestream_config.h.in',
output: 'messagestream_config.h',
configuration: conf_memstream
)

py3.extension_module('messagestream',
'messagestream.pyx',
include_directories : 'src',
dependencies : py3_dep,
install : true,
subdir : 'scipy/_lib')
include_directories: 'src',
dependencies: py3_dep,
install: true,
subdir: 'scipy/_lib'
)


python_sources = [
Expand All @@ -95,9 +107,9 @@ python_sources = [
]

py3.install_sources(
python_sources,
pure: false, # Will be installed next to binaries
subdir: 'scipy/_lib' # Folder relative to site-packages to install to
python_sources,
pure: false, # Will be installed next to binaries
subdir: 'scipy/_lib' # Folder relative to site-packages to install to
)

subdir('_uarray')
Expand Down
6 changes: 3 additions & 3 deletions scipy/_lib/tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ python_sources = [
]

py3.install_sources(
python_sources,
pure: false,
subdir: 'scipy/_lib/tests'
python_sources,
pure: false,
subdir: 'scipy/_lib/tests'
)
31 changes: 20 additions & 11 deletions scipy/cluster/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ _hierarchy_c = custom_target('_hierarchy_c',
_cython_tree,
#cython_blas_pxd, cython_lapack_pxd
],
command: [cython, '-3', '--fast-fail',
'@INPUT0@', '-o', '@OUTPUT@', '-I', '@BUILD_ROOT@'],
command: [
cython, '-3', '--fast-fail',
'@INPUT0@', '-o', '@OUTPUT@', '-I', '@BUILD_ROOT@'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one doesn't quite look right to me. I'd either leave it unchanged or write it as:

  command: [
    cython, '-3', '--fast-fail',
    '@INPUT0@', '-o', '@OUTPUT@', '-I', '@BUILD_ROOT@'
  ]

But that's maybe a little too verbose? Since it's a single command that was just too long to fit on a single line, and now it would take four lines.

Ah, not entirely sure, maybe your change is fine. Let me wake up and look at it again in a bit.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I prefer the 4-liner above. And maybe it fits on 3 lines now? Is this too long still?

cython, '-3', '--fast-fail',  '@INPUT0@', '-o', '@OUTPUT@', '-I', '@BUILD_ROOT@'

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4-lines lgtm

]
)

slib = py3.extension_module('_hierarchy',
_hierarchy_c,
c_args: [
Expand All @@ -35,9 +38,12 @@ _optimal_leaf_ordering_c = custom_target('_optimal_leaf_ordering',
_cython_tree,
# _cython_blas_pxd, cython_lapack_pxd
],
command: [cython, '-3', '--fast-fail',
'@INPUT0@', '-o', '@OUTPUT@', '-I', '@BUILD_ROOT@'],
command: [
cython, '-3', '--fast-fail',
'@INPUT0@', '-o', '@OUTPUT@', '-I', '@BUILD_ROOT@'
]
)

slib = py3.extension_module('_optimal_leaf_ordering',
_optimal_leaf_ordering_c,
c_args: [
Expand All @@ -57,13 +63,16 @@ _vq_c = custom_target('_vq',
_cython_tree,
# _cython_blas_pxd, cython_lapack_pxd
],
command: [cython, '-3', '--fast-fail',
'@INPUT0@', '-o', '@OUTPUT@', '-I', '@BUILD_ROOT@'],
command: [
cython, '-3', '--fast-fail',
'@INPUT0@', '-o', '@OUTPUT@', '-I', '@BUILD_ROOT@'
]
)

slib = py3.extension_module('_vq',
_vq_c,
c_args: [
'-Wno-cpp', # TODO: replace with numpy_nodepr_api
'-Wno-cpp' # TODO: replace with numpy_nodepr_api
],
include_directories: [inc_np],
dependencies: [py3_dep],
Expand All @@ -72,10 +81,10 @@ slib = py3.extension_module('_vq',
)


py3.install_sources(
['__init__.py',
'hierarchy.py',
'vq.py',
py3.install_sources([
'__init__.py',
'hierarchy.py',
'vq.py'
],
pure: false, # Will be installed next to binaries
subdir: 'scipy/cluster' # Folder relative to site-packages to install to
Expand Down
8 changes: 4 additions & 4 deletions scipy/cluster/tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ python_sources = [
'hierarchy_test_data.py',
'test_disjoint_set.py',
'test_hierarchy.py',
'test_vq.py',
'test_vq.py'
]


py3.install_sources(
python_sources,
pure: false,
subdir: 'scipy/cluster/tests'
python_sources,
pure: false,
subdir: 'scipy/cluster/tests'
)
8 changes: 4 additions & 4 deletions scipy/constants/meson.build
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
python_sources = [
'__init__.py',
'codata.py',
'constants.py',
'constants.py'
]


py3.install_sources(
python_sources,
pure: false,
subdir: 'scipy/constants'
python_sources,
pure: false,
subdir: 'scipy/constants'
)

subdir('tests')
8 changes: 4 additions & 4 deletions scipy/constants/tests/meson.build
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
python_sources = [
'__init__.py',
'test_codata.py',
'test_constants.py',
'test_constants.py'
]

py3.install_sources(
python_sources,
pure: false,
subdir: 'scipy/constants/tests'
python_sources,
pure: false,
subdir: 'scipy/constants/tests'
)
12 changes: 6 additions & 6 deletions scipy/fft/_pocketfft/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
thread_dep = dependency('threads', required : false)
thread_dep = dependency('threads', required: false)

if thread_dep.found()
pocketfft_threads = '-DPOCKETFFT_PTHREADS'
endif
Expand All @@ -15,19 +16,18 @@ py3.extension_module('pypocketfft',
)



python_sources = [
'__init__.py',
'basic.py',
'helper.py',
'realtransforms.py',
'realtransforms.py'
]


py3.install_sources(
python_sources,
pure: false,
subdir: 'scipy/fft/_pocketfft'
python_sources,
pure: false,
subdir: 'scipy/fft/_pocketfft'
)

subdir('tests')
8 changes: 4 additions & 4 deletions scipy/fft/_pocketfft/tests/meson.build
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
python_sources = [
'__init__.py',
'test_basic.py',
'test_real_transforms.py',
'test_real_transforms.py'
]

py3.install_sources(
python_sources,
pure: false,
subdir: 'scipy/fft/_pocketfft/tests'
python_sources,
pure: false,
subdir: 'scipy/fft/_pocketfft/tests'
)
8 changes: 4 additions & 4 deletions scipy/fft/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ python_sources = [
'_debug_backends.py',
'_fftlog.py',
'_helper.py',
'_realtransforms.py',
'_realtransforms.py'
]


py3.install_sources(
python_sources,
pure: false, # Will be installed next to binaries
subdir: 'scipy/fft' # Folder relative to site-packages to install to
python_sources,
pure: false, # Will be installed next to binaries
subdir: 'scipy/fft' # Folder relative to site-packages to install to
)

subdir('_pocketfft')
Expand Down
8 changes: 4 additions & 4 deletions scipy/fft/tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ python_sources = [
'test_fft_function.py',
'test_fftlog.py',
'test_multithreading.py',
'test_real_transforms.py',
'test_real_transforms.py'
]

py3.install_sources(
python_sources,
pure: false,
subdir: 'scipy/fft/tests'
python_sources,
pure: false,
subdir: 'scipy/fft/tests'
)
Loading