Commit ad6305c0 authored by Kirill Smelkov's avatar Kirill Smelkov

Fix build_dso on clean checkout

Similarly to build_ext we need ccan/config.h to be present for dso to
build. It was not the case and so pip install wendelin.core was failing:

    $ pip install wendelin.core-2.0a2.tar.gz
    Processing ./wendelin.core-2.0a2.tar.gz
      Installing build dependencies ... done
      Getting requirements to build wheel ... done
        Preparing wheel metadata ... done
    Collecting ZODB>=4
    Building wheels for collected packages: wendelin.core
      Building wheel for wendelin.core (PEP 517) ... error
      ERROR: Command errored out with exit status 1:
      running build_dso
      Building DSOs
      building 'wendelin.bigfile.libvirtmem' DSO as build/lib.linux-x86_64-2.7/wendelin/bigfile/
      creating build/temp.linux-x86_64-2.7
      creating build/temp.linux-x86_64-2.7/bigfile
      creating build/temp.linux-x86_64-2.7/lib
      x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -ffile-prefix-map=/build/python2.7-vgIf7a/python2.7-2.7.18=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -D_GNU_SOURCE -I/tmp/pip-build-env-lfVr7E/overlay/lib/python2.7/site-packages -I. -I./include -I./3rdparty/ccan -I./3rdparty/include -Ibuild/lib.linux-x86_64-2.7/. -c bigfile/pagefault.c -o build/temp.linux-x86_64-2.7/bigfile/pagefault.o -fno-strict-aliasing -std=gnu99 -fplan9-extensions -Wno-declaration-after-statement -Wno-error=declaration-after-statement
      In file included from ./include/wendelin/list.h:11,
                       from ./include/wendelin/bigfile/virtmem.h:50,
                       from bigfile/pagefault.c:29:
      ./3rdparty/ccan/ccan/array_size/array_size.h:4:10: fatal error: config.h: Нет такого файла или каталога
          4 | #include "config.h"
            |          ^~~~~~~~~~
      compilation terminated.
      error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
      ERROR: Failed building wheel for wendelin.core
    Failed to build wendelin.core
    ERROR: Could not build wheels for wendelin.core which use PEP 517 and cannot be installed directly

-> Fix it by making build_dso also first come through `make all`.

NOTE we cannot fix it in exactly the same way as for build_ext: if we split
build_dso into build_dso and ll_build_dso, `make all` will still go to infinite
recursion: build_dso -> ll_build_dso -> build_dso (not ll_build_dso, this is controlled by setuptools_dso) -> oops.
parent 5e5ad598
......@@ -18,7 +18,7 @@
# See COPYING file for full licensing terms.
# See for rationale and options.
from import setup, DSO as _DSO, Extension as _PyGoExt, build_ext as _build_ext
from setuptools_dso import Extension
from setuptools_dso import Extension, build_dso as _build_dso
from setuptools import Command, find_packages
from setuptools.command.build_py import build_py as _build_py
from pkg_resources import working_set, EntryPoint
......@@ -157,7 +157,7 @@ def runmake(target):
if pypath is not None:
err = os.system('make %s PYTHON="%s" PYTHONPATH="%s"' % \
err = os.system('make %s PYTHON="%s" PYTHONPATH="%s" INMAKE=1' % \
(target, sys.executable, ':'.join(pypathv)))
if err:
raise DistutilsExecError('Failed to execute `make %s`' % target)
......@@ -176,6 +176,15 @@ def viamake(target, help_text):
return run_viamake
# build_dso that
# - builds via Makefile (and thus pre-builds ccan) XXX hacky
class build_dso(_build_dso):
def run(self):
if 'INMAKE' not in os.environ:
# build_ext that
# - builds via Makefile (and thus pre-builds ccan) XXX hacky
......@@ -290,7 +299,7 @@ libwcfs_h = [
name = 'wendelin.core',
version = '2.0.alpha2',
version = '2.0.alpha2.post1',
description = 'Out-of-core NumPy arrays',
long_description = '%s\n----\n\n%s' % (
readfile('README.rst'), readfile('CHANGELOG.rst')),
......@@ -384,7 +393,8 @@ setup(
'test': ['pytest', 'scipy'],
cmdclass = {'build_ext': build_ext,
cmdclass = {'build_dso': build_dso,
'build_ext': build_ext,
'll_build_ext': _build_ext, # original build_ext for Makefile
'build_py': build_py,
'test': viamake('test', 'run tests'),
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment