[PyVigo] "pip install" modificando shebang... es posible?

Miguel González Álvarez migonzalvar at gmail.com
Mon Nov 14 16:08:42 CET 2016


Hola Luigi.

Sé que no es tu pregunta pero no sé si se podría resolver tu problemática
usando el `console_scripts entry point`. En Windows, setuptools crea un
archivo .exe que ejecuta el script. Te aseguras así que se ejecuta dentro
del entorno.

En
http://setuptools.readthedocs.io/en/latest/setuptools.html#automatic-script-creation
pone:

> On Windows, a set of foo.exe, bar.exe, and baz.exe launchers are created,
alongside a set of foo.py, bar.py, and baz.pyw files. The .exe wrappers
find and execute the right version of Python to run the .py or .pyw file.

Un saludo.

2016-11-14 15:49 GMT+01:00 Luigi Pirelli <luipir at gmail.com>:

> si esto si, por esto que pip hace una cosa rara (para mi) construiendo
> un .exe con un launcher
>
> https://github.com/pypa/pip/blob/master/pip/_vendor/
> distlib/scripts.py#L205
>
>
> Luigi Pirelli
>
> ************************************************************
> **************************************
> * Boundless QGIS Support/Development: lpirelli AT boundlessgeo DOT com
> * LinkedIn: https://www.linkedin.com/in/luigipirelli
> * Stackexchange: http://gis.stackexchange.com/users/19667/luigi-pirelli
> * GitHub: https://github.com/luipir
> * Mastering QGIS 2nd Edition:
> * https://www.packtpub.com/big-data-and-business-
> intelligence/mastering-qgis-second-edition
> ************************************************************
> **************************************
>
>
> 2016-11-14 15:33 GMT+01:00 Carlos Goce <carlosgoce at gmail.com>:
> > Por si te sirve de ayuda. Sólo te puedo comentar que me parece que
> Windows
> > ignora completamente los Shebang.
> >
> >
> > El 14/11/2016 3:30 p. m., "Luigi Pirelli" <luipir at gmail.com> escribió:
> >>
> >> hmmmm... con mucha probabilidad non es un problema de setup pero de
> >> pip... creo que pip llega a crear el shebang de defauult aqui
> >>
> >>
> >> https://github.com/pypa/pip/blob/master/pip/_vendor/
> distlib/scripts.py#L152
> >> Luigi Pirelli
> >>
> >>
> >> ************************************************************
> **************************************
> >> * Boundless QGIS Support/Development: lpirelli AT boundlessgeo DOT com
> >> * LinkedIn: https://www.linkedin.com/in/luigipirelli
> >> * Stackexchange: http://gis.stackexchange.com/users/19667/luigi-pirelli
> >> * GitHub: https://github.com/luipir
> >> * Mastering QGIS 2nd Edition:
> >> *
> >> https://www.packtpub.com/big-data-and-business-
> intelligence/mastering-qgis-second-edition
> >>
> >> ************************************************************
> **************************************
> >>
> >>
> >> 2016-11-14 15:06 GMT+01:00 Luigi Pirelli <luipir at gmail.com>:
> >> > Hola
> >> >
> >> > tenemos un problema de epaquetamiento de modulos python... y
> >> > especificatamente esto nos pasa en win.
> >> >
> >> > nos preparamos un installer en un build server, y en este build server
> >> > instalamos los modulos que necesitamos => los scripts instalados
> >> > tienen una stringa shebang echa asi'
> >> >
> >> > #!</path/to/python_in_build_server>
> >> >
> >> > esto es en general #!/user/bin/python o #!/user/local/bin/python
> >> >
> >> > pero a pasa la istalación en windows y usando un interprete python
> >> > (embedded) nuesto #shebang tendría que ser
> >> >
> >> > #!</path/to/python_embedded>
> >> > y esto puede cambiar en función de donde se instala el script.
> >> >
> >> > asi' que necesitariamos poner una stringa shebang que se la mas
> >> > generica posible y que sea capaz de puntar al python embedded.
> >> >
> >> > en general sería guay solucionarlo con los build options de setup.py
> >> > como en (el build server es winzozz)
> >> > pip.exe install --global-option=build
> >> > --global-option='--executable="/usr/bin/env python" ' <package name>
> >> >
> >> > pero el resultato siempre sale:
> >> >
> >> > #!python.exe
> >> >
> >> > asi' que puede ser que busca el executable y a no encontrarlo pone el
> >> > default (estoy en el codigo de distutils viendo que hace)
> >> >
> >> >
> >> > otra opción esn pyLauncher (https://www.python.org/dev/peps/pep-0397/
> )
> >> > pero bno se cuanto sea una solución adoptada en el mundo python... el
> >> > desarrollo de pyLancher es parado hace tiempo y no veo muchos que lo
> >> > utilizan (pero podría equivocarme)
> >> >
> >> > asi' venimos a la PREGUNTA
> >> >
> >> > hay una forma de pasar parametros a setup.py para que se pueda setear
> >> > la stringa shebang?
> >> >
> >> > Luigi Pirelli
> >> >
> >> >
> >> > ************************************************************
> **************************************
> >> > * Boundless QGIS Support/Development: lpirelli AT boundlessgeo DOT com
> >> > * LinkedIn: https://www.linkedin.com/in/luigipirelli
> >> > * Stackexchange: http://gis.stackexchange.com/
> users/19667/luigi-pirelli
> >> > * GitHub: https://github.com/luipir
> >> > * Mastering QGIS 2nd Edition:
> >> > *
> >> > https://www.packtpub.com/big-data-and-business-
> intelligence/mastering-qgis-second-edition
> >> >
> >> > ************************************************************
> **************************************
> >> _______________________________________________
> >> Asociación Python España: http://www.es.python.org/
> >> Python Vigo: http://www.python-vigo.es/
> >> Vigo mailing list
> >> Vigo at lists.es.python.org
> >> https://lists.es.python.org/listinfo/vigo
> >
> >
> > _______________________________________________
> > Asociación Python España: http://www.es.python.org/
> > Python Vigo: http://www.python-vigo.es/
> > Vigo mailing list
> > Vigo at lists.es.python.org
> > https://lists.es.python.org/listinfo/vigo
> _______________________________________________
> Asociación Python España: http://www.es.python.org/
> Python Vigo: http://www.python-vigo.es/
> Vigo mailing list
> Vigo at lists.es.python.org
> https://lists.es.python.org/listinfo/vigo
>



-- 
Miguel González
migonzalvar at gmail.com
PGP ID: 0C63761BEEBD05D3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.es.python.org/pipermail/vigo/attachments/20161114/773b6ba9/attachment.html>


More information about the Vigo mailing list