Skip to content

do not use setup.py to build wheel

Jonathan Lambrechts requested to merge python_wheel_without_setup_py into master

Do not use setup.py to build python wheels (i.e. packages) and create METADATA file even if the python module is installed via make; make install (i.e without wheel) so that pip can identify it.

This branch create directly the wheel files to upload on pypi without using the "setuptools" package. Calling setuptools from the command line to build wheels is being deprecated but no clear alternative has emerged yet. In the end, using setuptools was a complicate way of doing a simple task : collecting the files that are already built and create a zip archive with it + adding a METADATA and a RECORD file (a list of installed files + sha256 sum). In this branch:

  • the METADATA file is generated using cmake (which allows to install it even when gmsh.py is installed with make install (see issue #2061 (closed))
  • the RECORD file generation and the zipping are done with a simple python script utils/pypi/sdk2wheel.py (Those steps could probably be done with CMake but I'm not sure it's worth the effort).

This does not completely fix issue #2061 (closed) because of the different package names. The problem is that the python libraries depending on gmsh.py declare their dependence on the "gmsh" package and not "gmsh-dev" or "gmsh-nox-dev" so even if pip recognize the presence of "gmsh-dev" after a "make install" thanks to the new METADATA file, it will still try to install the "gmsh" package. I think we should consider using "gmsh" as the name of all the packages and put "-nox" and "-dev" in the version only (dev is already in the version as ".dev1").

Another minor shortcoming is that when installing with "make install", the METADATA file is installed but not the "RECORD" file so pip can see the gmsh is installed but it cannot remove it: "pip uninstall gmsh-dev" will do nothing and return an error (which may be the behavior we want given that gmsh has not been installed with pip).

Merge request reports