[Distutils] [ANN] setuptools post install script for bdist_wininst
pje at telecommunity.com
Sun Sep 12 20:22:07 CEST 2010
At 02:36 PM 9/12/2010 +0200, Manlio Perillo wrote:
>-----BEGIN PGP SIGNED MESSAGE-----
>Il 11/09/2010 23:22, P.J. Eby ha scritto:
> > 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.
>Good to know, thanks.
>But how can I create such a egg?
In the same way that you'd create a distutils-based package that
installs shared libraries next to Python extensions. (i.e., not easily.)
>And if this is possible, what do you think is the reasons why packages
>like pyqt do not release such eggs?
Because major C extensions (e.g. wx, numpy, pywin32) tend to have
special build requirements for their libraries that aren't handled
well by the distutils, or the build process predated the distutils,
or the build process wasn't originally designed to be used with
Python, etc. etc.
>It should not be hard to track installed dependencies, as an example
>using the --record option of easy_install, and then registering all
>installed files (and directories) with `file_created` and
>The only problem is that created directories are not reported in the
>record, but if files are always listed ordered, it should not be a problem.
That's not the only problem: if you install A, then B, and both
depend on C, then if you uninstall A you will break B. You would
have to also track shared use of dependencies.
This situation is a big mess, and I haven't needed it for myself or
any client as yet, so I've avoided the whole subject.
>Some other related questions:
>* Do you think you can change ez_setup.py so that the code used to
> check if setuptools must be installed is available as a separate
Grab the bit that looks like this:
# it's not installed
except pkg_resources.VersionConflict, e:
# older version is installed
# it's not installed
# it's installed
Season to taste. ;-)
> For normal package dependencies (and assuming setuptools is
> available) I can just use working_set.__contains__(dist)
No, you need to use require() or resolve() or some other API that:
1. Checks versions, and
2. Handles recursive dependencies
>* Is it safe to call `ez_setup.use_setuptools` setting `to_dir`
> parameter to `sysconfig.get_python_lib()`?
It's safe for setuptools, but whether it's safe in the context of a
bdist_wininst I'm not sure.
> By default the setuptools egg is copied to the same directory where
> the bdist_wininst file is, and this is not safe since the user may
> delete these files.
You could also fix that by calling easy_install(['--always-copy',
'setuptools']), in the case where you've had to install setuptools.
>* Is it possible to get the ID of the main window of the bdist_wininst
> I need it because MessageBox function requires the ID of the parent
> It is possible to use the Desktop as parent, but this may cause
> problems (message box displayed in the wrong position, with incorrect
> focus, or who know)
>* Is it possible to modify bdist_wininst (in a future release) so that,
> when executing the post install script, the name of the project being
> installed is passed in argv?
> This change does not break existing code.
I don't know the answers to these questions.
More information about the Distutils-SIG