• Kirill Smelkov's avatar
    pyx.build: Fix tests with recent setuptools · 304464e0
    Kirill Smelkov authored
    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.
    304464e0
cmdclass_custom.py 1.55 KB