• Kirill Smelkov's avatar
    setup: Fix hooking of git_lsfiles in PEP517 mode · bd1fb19e
    Kirill Smelkov authored
    In PEP517 mode setup.py is sourced - not executed - and the build fails
    with ImportError like this:
    
        Preparing wheel metadata ... error
        ERROR: Command errored out with exit status 1:
         command: /home/kirr/src/wendelin/venv/z-dev/bin/python2 /home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp2F3aEs
             cwd: /home/kirr/src/wendelin/wendelin.core
        Complete output (53 lines):
        running dist_info
        creating /tmp/pip-modern-metadata-sPiqUt/wendelin.core.egg-info
        writing requirements to /tmp/pip-modern-metadata-sPiqUt/wendelin.core.egg-info/requires.txt
        writing /tmp/pip-modern-metadata-sPiqUt/wendelin.core.egg-info/PKG-INFO
        writing top-level names to /tmp/pip-modern-metadata-sPiqUt/wendelin.core.egg-info/top_level.txt
        writing dependency_links to /tmp/pip-modern-metadata-sPiqUt/wendelin.core.egg-info/dependency_links.txt
        writing entry points to /tmp/pip-modern-metadata-sPiqUt/wendelin.core.egg-info/entry_points.txt
        writing manifest file '/tmp/pip-modern-metadata-sPiqUt/wendelin.core.egg-info/SOURCES.txt'
        package init file '__init__.py' not found (or not a regular file)
        Traceback (most recent call last):
          File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 257, in <module>
            main()
          File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 240, in main
            json_out['return_val'] = hook(**hook_input['kwargs'])
          File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 110, in prepare_metadata_for_build_wheel
            return hook(metadata_directory, config_settings)
          File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/setuptools/build_meta.py", line 155, in prepare_metadata_for_build_wheel
            self.run_setup()
          File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/setuptools/build_meta.py", line 234, in run_setup
            self).run_setup(setup_script=setup_script)
          File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/setuptools/build_meta.py", line 141, in run_setup
            exec(compile(code, __file__, 'exec'), locals())
          File "setup.py", line 374, in <module>
            """.splitlines()]
          File "/home/kirr/src/tools/go/pygolang/golang/pyx/build.py", line 118, in setup
            setuptools_dso.setup(**kw)
          File "/home/kirr/src/tools/py/pypa/setuptools_dso/src/setuptools_dso/__init__.py", line 37, in setup
            _setup(**kws)
          File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/setuptools/__init__.py", line 145, in setup
            return distutils.core.setup(**attrs)
          File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
            dist.run_commands()
          File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
            self.run_command(cmd)
          File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
            cmd_obj.run()
          File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/setuptools/command/dist_info.py", line 31, in run
            egg_info.run()
          File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 296, in run
            self.find_sources()
          File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 303, in find_sources
            mm.run()
          File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 534, in run
            self.add_defaults()
          File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 574, in add_defaults
            rcfiles = list(walk_revctrl())
          File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/setuptools/command/sdist.py", line 20, in walk_revctrl
            for item in ep.load()(dirname):
          File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2434, in load
            return self.resolve()
          File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2444, in resolve
            raise ImportError(str(exc))
        ImportError: 'module' object has no attribute 'git_lsfiles'
    
    See comments added to register_as_entrypoint for explanation of what
    happens.
    
    Wendelin.core will soon switch to PEP517 mode (by adding pyproject.toml)
    to build-require Cython, Pygolang and friends.
    bd1fb19e
setup.py 10.8 KB