rustyrussell / secp256k1-py

Python FFI bindings for libsecp256k1 (maintained)
MIT License
56 stars 12 forks source link

setup.py: Fix invalid definition of bdist_wheel command #18

Open juergenhoetzel opened 3 months ago

juergenhoetzel commented 3 months ago

Don't set cmdclass["bdist_wheel"] to None if bdist_wheel is unavailable. This prevents installation error:

TypeError: 'NoneType' object is not callable

Refs #7

juergenhoetzel commented 3 months ago

Using pip 24.1.1(python 3.12), fixes this issue

→ pip install -e .
Obtaining file:///home/juergen/ghq/github.com/rustyrussell/secp256k1-py
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Installing backend dependencies ... done
  Preparing editable metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing editable metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [57 lines of output]
      2.1.1
      Using bundled libsecp256k1
      running dist_info
      creating /tmp/pip-modern-metadata-98wli3ko/secp256k1.egg-info
      writing /tmp/pip-modern-metadata-98wli3ko/secp256k1.egg-info/PKG-INFO
      writing dependency_links to /tmp/pip-modern-metadata-98wli3ko/secp256k1.egg-info/dependency_links.txt
      writing requirements to /tmp/pip-modern-metadata-98wli3ko/secp256k1.egg-info/requires.txt
      writing top-level names to /tmp/pip-modern-metadata-98wli3ko/secp256k1.egg-info/top_level.txt
      writing manifest file '/tmp/pip-modern-metadata-98wli3ko/secp256k1.egg-info/SOURCES.txt'
      reading manifest file '/tmp/pip-modern-metadata-98wli3ko/secp256k1.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      adding license file 'LICENSE'
      writing manifest file '/tmp/pip-modern-metadata-98wli3ko/secp256k1.egg-info/SOURCES.txt'
      creating '/tmp/pip-modern-metadata-98wli3ko/secp256k1-0.14.0.dist-info'
      Traceback (most recent call last):
        File "/tmp/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/tmp/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 181, in prepare_metadata_for_build_editable
          return hook(metadata_directory, config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-hynbo5az/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 463, in prepare_metadata_for_build_editable
          return self.prepare_metadata_for_build_wheel(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-hynbo5az/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 368, in prepare_metadata_for_build_wheel
          self.run_setup()
        File "/tmp/pip-build-env-hynbo5az/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 497, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-hynbo5az/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 313, in run_setup
          exec(code, locals())
        File "<string>", line 267, in <module>
        File "/tmp/pip-build-env-hynbo5az/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-hynbo5az/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 184, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-hynbo5az/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 200, in run_commands
          dist.run_commands()
        File "/tmp/pip-build-env-hynbo5az/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 970, in run_commands
          self.run_command(cmd)
        File "/tmp/pip-build-env-hynbo5az/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 974, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-hynbo5az/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 989, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-hynbo5az/overlay/lib/python3.12/site-packages/setuptools/command/dist_info.py", line 97, in run
          bdist_wheel = self.get_finalized_command('bdist_wheel')
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-hynbo5az/overlay/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 302, in get_finalized_command
          cmd_obj = self.distribution.get_command_obj(command, create)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-hynbo5az/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 863, in get_command_obj
          cmd_obj = self.command_obj[command] = klass(self)
                                                ^^^^^^^^^^^
      TypeError: 'NoneType' object is not callable
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.