Commit 304464e0 authored by Kirill Smelkov's avatar Kirill Smelkov

pyx.build: Fix tests with recent setuptools

With setuptools 65 running test_pyx_build_cmdclass is failing because besides
cmdclass_custom.py it sees nearby golang_pyx_user/ and golang_dso_user/ with
top-project setups and rejects it:

    ---- 8< ----
    golang/pyx/build_test.py::test_pyx_build_cmdclass error: Multiple top-level packages discovered in a flat-layout: ['golang_pyx_user', 'golang_dso_user'].

    To avoid accidental inclusion of unwanted files or directories,
    setuptools will not proceed with this build.

    If you are trying to create a single distribution with multiple packages
    on purpose, you should not rely on automatic discovery.
    Instead, consider the following options:

    1. set up custom discovery (`find` directive with `include` or `exclude`)
    2. use a `src-layout`
    3. explicitly set `py_modules` or `packages` with a list of names

    To find more information, look for "package discovery" on setuptools docs.
    FAILED

    ================================ FAILURES =================================
    _________________________ test_pyx_build_cmdclass _________________________

        def test_pyx_build_cmdclass():
    >       _ = pyout(["cmdclass_custom.py", "build_ext"], cwd=testprog)

    golang/pyx/build_test.py:60:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    golang/golang_test.py:1742: in pyout
        return pyrun(argv, stdin=stdin, stdout=stdout, stderr=stderr, **kw)
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    argv = ['cmdclass_custom.py', 'build_ext'], stdin = None, stdout = b'', stderr = None
    kw = {'cwd': '/home/kirr/src/tools/go/pygolang-master/golang/pyx/testprog'}, retcode = 1

        def pyrun(argv, stdin=None, stdout=None, stderr=None, **kw):
            retcode, stdout, stderr = _pyrun(argv, stdin=stdin, stdout=stdout, stderr=stderr, **kw)
            if retcode:
    >           raise RuntimeError(' '.join(argv) + '\n' + (stderr and str(stderr) or '(failed)'))
    E           RuntimeError: cmdclass_custom.py build_ext
    E           (failed)

    golang/golang_test.py:1736: RuntimeError
    ---- 8< ----

-> Work it around by defining py_modules explicitly as suggested in
https://stackoverflow.com/a/72547402/9456786.
parent 39dde7eb
# Copyright (C) 2019 Nexedi SA and Contributors. # Copyright (C) 2019-2022 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com> # Kirill Smelkov <kirr@nexedi.com>
# #
# This program is free software: you can Use, Study, Modify and Redistribute # This program is free software: you can Use, Study, Modify and Redistribute
# it under the terms of the GNU General Public License version 3, or (at your # it under the terms of the GNU General Public License version 3, or (at your
...@@ -29,4 +29,9 @@ class mybuild_ext(build_ext): ...@@ -29,4 +29,9 @@ class mybuild_ext(build_ext):
setup( setup(
cmdclass = {'build_ext': mybuild_ext}, cmdclass = {'build_ext': mybuild_ext},
# avoid setuptools thinking nearby golang_pyx_user/ golang_dso_user/ also
# relate to hereby setup and rejecting the build.
# https://stackoverflow.com/questions/72294299/multiple-top-level-packages-discovered-in-a-flat-layout
py_modules = [],
) )
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment