[Python-es] Post-install en setup.py con Wheel

Nekmo nintux en gmail.com
Dom Jun 5 21:54:47 EDT 2016


Buenas a todos.

Tengo un paquete que requiere de pasos adicionales para su instalación
en el sistema, ya que no es una biblioteca sino una aplicación. Entre
otras cosas hace:
- Instalar servicios (init, systemd).
- Actualizar los archivos de configuración, si se necesitase.
- Crear enlaces simbólicos.
- Crear un usuario del sistema si no existiese
- Dar los permisos correctos a los directorios correspondientes.

Todo esto funciona muy bien a día de hoy, y me permite tener un
paquete instalable en cualquier distribución de forma fácil y
amigable. Además, si el paquete es instalado en modo usuario, estos
pasos se saltan mostrando una advertencia al usuario.

El problema llega con Wheel: mis usuarios se quejan porque reciben un
mensaje de error de Wheel (el cual no uso) durante la instalación,
aunque el programa se instale perfectamente.

https://github.com/Nekmo/simple-monitor-alert/issues/24


---------------------
  Checking .pth file support in build/bdist.linux-x86_64/wheel/
  /usr/bin/python -E -c pass
  TEST FAILED: build/bdist.linux-x86_64/wheel/ does NOT support .pth files
  error: bad install directory or PYTHONPATH

  You are attempting to install a package to a directory that is not
  on PYTHONPATH and which Python does not read ".pth" files from.  The
  installation directory you specified (via --install-dir, --prefix, or
  the distutils default setting) was:

      build/bdist.linux-x86_64/wheel/

  and your PYTHONPATH environment variable currently contains:

      ''

  Here are some of your options for correcting the problem:

  * You can choose a different installation directory, i.e., one that is
    on PYTHONPATH or supports .pth files

  * You can add the installation directory to the PYTHONPATH environment
    variable.  (It must then also be on PYTHONPATH whenever you run
    Python and want to use the package(s) you are installing.)

  * You can set up the installation directory to support ".pth" files by
    using one of the approaches described here:


https://pythonhosted.org/setuptools/easy_install.html#custom-installation-locations

  Please make the appropriate changes for your system and try again.
--------------------------

El problema es que, Wheel se promociona como una solución que
justamente impide ejecutar comandos durante la instalación
(¡bieen...!) y no sé si conseguiré solventar mi problema usando Wheel.
Tal vez lo que necesite es ocultar este mensaje de error.


Más información sobre la lista de distribución Python-es