[Distutils] [ANN] setuptools post install script for bdist_wininst
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. Following the suggestion to use a post installation script in order to install dependencies for a package installed using bdist_wininst, I wrote this reusable script: http://paste.pocoo.org/show/260644/ In order to use it, the script must be declared as a script in the setup.py file. In order to ensure setuptools is installed, the same should be do with the ez_setup bootstrap script. The ez_post_install script will do: 1) Get the installed project name by parsing the bdist_wininst file name 2) Make sure setuptools is installed (if ez_setup is available) 3) Install all dependencies of the installed package, using easy_install 4) Optionally add shortcuts of all gui scripts in the Start Menu\Programs\project name special folder 5) Optionally add shortcuts of all gui scripts in the Desktop Problems Since the post install script may take some time downloading and installing packages, the UI of the Windows installer is frozen, without giving user any feedback. This is a problem with the installer, since stdout and stderr are fully buffered. TODO In case a dependency have extension code that must compiled, in 99% of the cases the post install script will fail, since the compiler or some library is not available. This should not happen; the post install script should, instead, check if in the package download_url there is a bdist_wininst executable, download it and execute it. Suggestions are welcome. Manlio Perillo -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkyLlWAACgkQscQJ24LbaURBJwCgkU87bIiGGt2uj3qBcxZ1NIS6 07AAn2mXk9kQvtjgEXtWb3uwiQT69mwZ =l8M2 -END PGP SIGNATURE- ___ Distutils-SIG maillist - Distutils-SIG@python.org http://mail.python.org/mailman/listinfo/distutils-sig
Re: [Distutils] [ANN] setuptools post install script for bdist_wininst
At 04:42 PM 9/11/2010 +0200, Manlio Perillo wrote: This is a problem with the installer, since stdout and stderr are fully buffered. You probably need to pop up some sort of dialog and direct stdout/stderr there. Alternately, you could run easy_install in a separate process as a console script. TODO In case a dependency have extension code that must compiled, in 99% of the cases the post install script will fail, since the compiler or some library is not available. This should not happen; the post install script should, instead, check if in the package download_url there is a bdist_wininst executable, download it and execute it. easy_install already does this, sort of: it downloads bdist_wininst executables and converts them into eggs, then installs the eggs. Suggestions are welcome. In general, I'm not sure that this sort of thing is wise to do in a bdist_wininst postinstall without some kind of user prompting, since: 1. A primary reason people have for using bdist_wininst installers is uninstall support, and this approach will leave dependencies behind. 2. Another big reason people have for using these installers instead of easy_install is that they don't want things being downloaded from the net, because e.g. they have no access or are behind a proxy, so this is just going to annoy them. I would strongly recommend having some sort of dialog that simply tells the user what dependencies are missing, and then asks if they would like to have them installed automatically. (So the user can then say no if they need uninstallability or have limited network access.) ___ Distutils-SIG maillist - Distutils-SIG@python.org http://mail.python.org/mailman/listinfo/distutils-sig
Re: [Distutils] [ANN] setuptools post install script for bdist_wininst
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Il 11/09/2010 20:10, P.J. Eby ha scritto: At 04:42 PM 9/11/2010 +0200, Manlio Perillo wrote: This is a problem with the installer, since stdout and stderr are fully buffered. You probably need to pop up some sort of dialog and direct stdout/stderr there. Not easy, but I will give it a try. Alternately, you could run easy_install in a separate process as a console script. TODO In case a dependency have extension code that must compiled, in 99% of the cases the post install script will fail, since the compiler or some library is not available. This should not happen; the post install script should, instead, check if in the package download_url there is a bdist_wininst executable, download it and execute it. easy_install already does this, sort of: it downloads bdist_wininst executables and converts them into eggs, then installs the eggs. Sorry, I was referring to all in one installers, that is, installers that also install external shared libraries. As an example: http://www.riverbankcomputing.com/static/Downloads/PyQt4/PyQt-Py2.6-gpl-4.7.6-1.exe The PyQt4 installer put external DLLs (and some executables like designer.exe) in C:\Python26\Lib\site-packages\PyQt4\bin Is it possible to put required DLLs inside an egg? For PyQt4 there seems to be only the all in one installers and source distributions. I'm also having some issues with PyQt4 and easy_install. Suggestions are welcome. In general, I'm not sure that this sort of thing is wise to do in a bdist_wininst postinstall without some kind of user prompting, since: 1. A primary reason people have for using bdist_wininst installers is uninstall support, and this approach will leave dependencies behind. As far as I know, all dependencies are correctly handled. Shortcuts are correctly removed by the uninstall. 2. Another big reason people have for using these installers instead of easy_install is that they don't want things being downloaded from the net, because e.g. they have no access or are behind a proxy, so this is just going to annoy them. For me the main reason is the problem users have at using the command prompt and setting environment variables. easy_install is perfectly fine, IMHO, it only needs an usable GUI for Windows. I recently discovered that ActivePython have PyPM. I will do some tests. I would strongly recommend having some sort of dialog that simply tells the user what dependencies are missing, and then asks if they would like to have them installed automatically. (So the user can then say no if they need uninstallability or have limited network access.) Thanks for the suggestion. By the way, I tried to install pywin32, but I got: C:\easy_install pywin32 Searching for pywin32 Reading http://pypi.python.org/simple/pywin32/ Reading http://sf.net/projects/pywin32 Reading http://sourceforge.net/project/showfiles.php?group_id=78018 Best match: pywin32 214 Downloading http://sourceforge.net/projects/pywin32/files/pywin32/Build%20214/py win32-214.win32-py2.6.exe/download Processing download error: Couldn't find a setup script in c:\docume~1\manlio\impost~1\temp\easy_install-ni9nay\download It is also strange that path components are also reported using short names... Thanks Manlio -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkyL3SgACgkQscQJ24LbaUQEqgCglYphT5RQU1XBRN0dXuedqamx LgsAoIgsKfZsKzeygpvwP79uWVxmkSHX =B/Zu -END PGP SIGNATURE- ___ Distutils-SIG maillist - Distutils-SIG@python.org http://mail.python.org/mailman/listinfo/distutils-sig
Re: [Distutils] [ANN] setuptools post install script for bdist_wininst
At 09:48 PM 9/11/2010 +0200, Manlio Perillo wrote: Is it possible to put required DLLs inside an egg? Yes, but they have to be adjacent to any Python extensions (.pyd's) that use them. 1. A primary reason people have for using bdist_wininst installers is uninstall support, and this approach will leave dependencies behind. As far as I know, all dependencies are correctly handled. Shortcuts are correctly removed by the uninstall. But the dependencies installed by easy_install will not get corresponding uninstall entries in the Windows control panel, and so will not be uninstalled when the user uninstalls the main application or library. By the way, I tried to install pywin32, but I got: AFAIK, pywin32 is not easy_install-able due to some post-install incompatibilities. ___ Distutils-SIG maillist - Distutils-SIG@python.org http://mail.python.org/mailman/listinfo/distutils-sig