[Python-Dev] PEP 376 - Open questions

Tarek Ziadé ziade.tarek at gmail.com
Tue Jul 7 09:50:50 CEST 2009


2009/7/7 Paul Moore <p.f.moore at gmail.com>:
> 2009/7/6 Nick Coghlan <ncoghlan at gmail.com>:
>> I'd add one more question to the list: is allowing backslash separated
>> names in the RECORD file actually a good idea, or would it be better to
>> always use forward slashes?
>
> They do always use forward slashes.
>
>> For the other questions, I don't have anything much to add to PJE's
>> comments, except that the "all relative" paths idea won't work due to
>> the Windows drive letter issue (i.e. if an installer puts files in
>> C:\Program Files, there is no guarantee that a relative path between
>> site-packages and Program Files even exists if Python is installed on a
>> different drive).
>
> The big question, though, is can an installer actually *do* that in
> practical terms?
>
> - There are *no* guaranteed absolute locations on Windows, so any such
> oddly-located file would require user interaction to work. Certainly
> bdist_wininst and bdist_msi don't do that.
> - My experiments indicate that bdist_{wininst,msi} are broken with
> respect to absolute paths anyway: they do a --root install to a
> temporary directory (and the absolute paths don't end up in there) and
> then package up that temporary directory.

yes that's unfortunately the case for all windows-based installation.
wether it's a bdist call to the install command, to create a binary package,
wether it's an installation.

c:\something or d:\something will be installed in sys.prefix\something.

I will add an issue for distutils for this, probably ending up raising
an exception when we hit this case, because I don't see how these
paths can work.

Unless we define a "drive that contains the python installation" maybe, or
the "Program Files" directory

would that  make sense from a win32 point of view ?


>
> I still want to see a real life example that demonstrates that there
> is a genuine issue here. We're spending a lot of energy and complexity
> trying to design a solution to a problem that actually doesn't appear
> to exist in practice...
>
> (To be honest, I'd be fairly confident in saying that absolute paths
> can be ignored on Windows, subject to some corner cases that I haven't
> thought through yet. My worry is that I don't know what Unix and Mac
> users might do, so I can't just wish away the issue because it can't
> arise on Windows. Can a Unix/Mac user offer a real-world example on
> their own system?)
>

I know some people are writing to /etc to add their configuration file
on the system,

So a real-world example under linux would be:

setup(..., data_files=[('/etc', ['myconf.cfg'])], ...)


That is basically how the examples are shown at:

http://docs.python.org/distutils/setupscript.html#installing-additional-files

But this is already os-specific, and exists because distutils doesn't
have a way (yet)
to express systems locations independantly from their physical location,
like what the RPM system does with %VARIABLES.

So another way to handle this maybe, like I have added with $PREFIX
and $EXEC_PREFIX
would be to nominate a list of variables that every python environment
has (querying
modules like sys) and let the developers use them as root locations
for some files.

- sys.prefix
- sys.exec_prefix
- some elements returned by distutils.sysconfig.get_config_vars()
(distutils.sysconfig queries the python Makefile amongst others)
- ...

Semi-related: distutils.sysconfig should be removed from distutils,
and be a standalone module in the sdtlib for example.

Regards
Tarek


More information about the Python-Dev mailing list