RE: [Distutils] Re: [Python-Dev] PEP 250: Summary of comments
From: M.-A. Lemburg [mailto:mal@lemburg.com]
(I believe that install.py would have to be told about sys.extinstallpath too and that it should fallback to the defaults given in the install schemes if it is not set.)
Hmm, browsing this a bit more, I'm getting further confused. The cause of this is the INSTALL_SCHEMES stuff, which has a purelib/platlib distinction, which is only used on unix_prefix (all other cases use the same value for both of these). I can't see how sys.extinstallpath relates - I could use it as default for both purelib and platlib, but that somewhat defeats the point of having the two. Does this imply that sys.extinstallpath should be split into two parts (pure & plat)? I can't comment, as this is a Unix-only thing. This is getting silly. I feel that the correct approach is to go back to my original stance, of *only* changing Windows behaviour - leave the Unix and Mac camps as they are. With that in mind, sys.extinstallpath seems like an overgeneralisation, and the attached patch does everything bar handle bdist_wininst. The Windows Installer should then do the same thing - load Python, and generate os.path.join(sys.prefix, "lib", "site-packages") as the destination directory. OK, so the same thing is hard-coded in four places, but this whole area is rife with duplicated code, and fixing that issue is way outside the scope of PEP 250. For the limited purpose of making site-packages appear in sys.path, and making python setup.py install install to site-packages, the attached patch works. I've only tested it on a simple Python module, but that's all I have to hand. I can try some C modules tonight when I get home, but I see no reason why they wouldn't work as well. The patch is pretty much trivial, which (IMHO) is very much in its favour as Python 2.2a1 is already out... Unless someone comes up with a *very strong* argument as to why I should be going further than this, I would like to request that this goes into Python as it stands. If someone can supply the source of the bdist_wininst installer, I will make a corresponding change to that. I will NOT make any changes which affect Unix, or Mac platforms. I don't know the issues. If someone wants to supply a patch which does this, I'll be happy to see it go in, and I am quite comfortable with it going under the banner of PEP 250, but I will not get involved in the issues - I simply am not qualified to comment. Paul. ------------------------------------------------------ diff -u site.py.orig site.py --- site.py.orig Tue Jun 26 10:07:06 2001 +++ site.py Wed Jul 18 16:33:37 2001 @@ -143,7 +143,7 @@ elif os.sep == ':': sitedirs = [makepath(prefix, "lib", "site-packages")] else: - sitedirs = [prefix] + sitedirs = [prefix, makepath(prefix, "lib", "site-packages")] for sitedir in sitedirs: if os.path.isdir(sitedir): addsitedir(sitedir) diff -u distutils\sysconfig.py.orig distutils\sysconfig.py --- distutils\sysconfig.py.orig Thu Apr 19 10:24:24 2001 +++ distutils\sysconfig.py Wed Jul 18 16:20:20 2001 @@ -87,7 +87,7 @@ elif os.name == "nt": if standard_lib: - return os.path.join(PREFIX, "Lib") + return os.path.join(PREFIX, "Lib", "site-packages") else: return prefix diff -u distutils\command\install.py.orig distutils\command\install.py --- distutils\command\install.py.orig Thu Apr 19 10:24:24 2001 +++ distutils\command\install.py Wed Jul 18 16:29:29 2001 @@ -31,8 +31,8 @@ 'data' : '$base', }, 'nt': { - 'purelib': '$base', - 'platlib': '$base', + 'purelib': '$base/Lib/site-packages', + 'platlib': '$base/Lib/site-packages', 'headers': '$base/Include/$dist_name', 'scripts': '$base/Scripts', 'data' : '$base',
From: "Moore, Paul"
This is getting silly. I feel that the correct approach is to go back to my original stance, of *only* changing Windows behaviour - leave the Unix and Mac camps as they are.
This seems the way to go.
With that in mind, sys.extinstallpath seems like an overgeneralisation, and the attached patch does everything bar handle bdist_wininst. There is one problem in the diffs below for distutils\sysconfig: Your patch changes the result of get_python_lib() for standard_lib, while it should change the directory for site-specific modules. Correct (IMO) would be (maybe you created this in hurry):
elif os.name == "nt": if standard_lib: return os.path.join(PREFIX, "Lib") else: return os.path.join(prefix, "Lib", "site-packages")
The Windows Installer should then do the same thing - load Python, and generate os.path.join(sys.prefix, "lib", "site-packages") as the destination directory. No, it should load Python, and use the result of distutils.sysconfig.get_python_lib() as theinstallation directory. If this fails, revert to the previous behaviour.
This way would ensure the desired behaviour, without a need to introduce sys.extinstallpath. Maybe the PEP should eventually be updated if everyone agrees on this? Thomas
On Wed, 18 Jul 2001 19:50:30 +0200, "Thomas Heller"
There is one problem in the diffs below for distutils\sysconfig: Your patch changes the result of get_python_lib() for standard_lib, while it should change the directory for site-specific modules. Correct (IMO) would be (maybe you created this in hurry):
elif os.name == "nt": if standard_lib: return os.path.join(PREFIX, "Lib") else: return os.path.join(prefix, "Lib", "site-packages")
You're right. I did create this in a hurry, and I switched the logic. Thanks for catching it. Unfortunately, I'm not sure where or how this code gets exercised, so I didn't have an obvious way of testing this.
No, it should load Python, and use the result of distutils.sysconfig.get_python_lib() as the installation directory. If this fails, revert to the previous behaviour.
That's a much better idea.
This way would ensure the desired behaviour, without a need to introduce sys.extinstallpath.
Yes, I no longer see a use for sys.extinstallpath.
Maybe the PEP should eventually be updated if everyone agrees on this?
I will certainly do so. As I understand it, the final version of the PEP should serve as documentation for what actually gets implemented. Thanks, Paul.
participants (3)
-
Moore, Paul
-
Paul Moore
-
Thomas Heller