Phillip J. Eby wrote:
> At 09:42 PM 9/13/2005 -0700, Robert Kern wrote:
> 
>>Phillip J. Eby wrote:
>>
>>>At 06:43 PM 9/13/2005 -0700, Robert Kern wrote:
>>>
>>>
>>>>My request is that if --prefix is provided, then the value of
>>>>--site-dirs be calculated from it.
>>>
>>>I'd suggest using PYTHONHOME instead, since that will actually make Python
>>>run from that directory.
>>
>>That's not what these users need, however. Python is installed to /usr
>>and the standard library and all of the third-party packages that are
>>part of Debian's packaging system go under /usr/lib/python2.x/ .
>>Third-party packages that are compiled by the user go under
>>/usr/local/lib/python2.x/site-packages/ . The way everybody accomplishes
>>this is by setting --prefix=/usr/local for distutils.
> 
> Well, as long as it ends up on sys.path *and* processes .pth files, it 
> should be fine. 

Not for installing setuptools itself with ez_setup.py . It doesn't
recognize /usr/local/... as a site-dir so it doesn't install the .pth
files. It assumes that it must be a multi-version install.

> Question: are these /usr/local/* versions on sys.path 
> *before* the /usr versions?  Or after?

After. Does it matter? /usr/local/* doesn't contain the stdlib; it
doesn't override anything.

>>>However, my main concern is not making these path
>>>calculations any more screwy than they already have to be, as they are
>>>already quite complex.  So, if you can suggest a patch to implement your
>>>desired behavior that doesn't break anything else and doesn't make my head
>>>explode upon reviewing it, I'll be happy to check it in.  :)
>>
>>The path part isn't hard. If --prefix or --home is provided, the install
>>command will calculate the path for you and place it in
>>install.install_lib . The hard part seems to be figuring out whether the
>>user explicitly provided --prefix or --install-lib or neither.
> 
> I'll take your word for it.  :)  Again, I'll be happy to look at a patch, 
> but I don't have the bandwidth to figure out this particular setup.

I've attached my original attempt. As I mentioned it doesn't actually
differentiate between the cases where --prefix is provided and
--install-dir is.

> One possible hack: assume that any directory on sys.path whose basename is 
> "site-packages" is a valid --site-dir.  The worst that can do is fail.  :)

That's probably a decent rule.

-- 
Robert Kern
[EMAIL PROTECTED]

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter
Index: setuptools/command/easy_install.py
===================================================================
RCS file: 
/cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/easy_install.py,v
retrieving revision 1.28
diff -u -r1.28 easy_install.py
--- setuptools/command/easy_install.py  3 Sep 2005 04:50:05 -0000       1.28
+++ setuptools/command/easy_install.py  14 Sep 2005 06:17:28 -0000
@@ -141,6 +141,10 @@
         self.set_undefined_options('install', ('record', 'record'))
         normpath = map(normalize_path, sys.path)
         self.all_site_dirs = get_site_dirs()
+        install_cmd = self.distribution.get_command_obj('install')
+        if install_cmd.prefix is not None:
+            self.all_site_dirs.append(normalize_path(install_cmd.install_lib))
+
         if self.site_dirs is not None:
             site_dirs = [
                 os.path.expanduser(s.strip()) for s in 
self.site_dirs.split(',')
_______________________________________________
Distutils-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to