Re: [Pythonmac-SIG] Ownership of installed Python on Mac

2011-08-09 Thread Nicholas Riley
On Tue, Aug 09, 2011 at 11:35:11PM +0100, Michael Foord wrote:
> On 9 August 2011 22:42, Ned Deily  wrote:
> Hmm... for 3.2 and 2.7 I was using Activestate installers not Python.org
> ones - so perhaps it's their bug (in which case sorry for the noise).

Nope - this is from a new Mac mini that shipped with Lion and has not
had any non-system Pythons installed:

bookworm% ls -ld /Library/Python/*/site-packages 
drwxr-xr-x  4 root  wheel  136 Jun 25 08:05 /Library/Python/2.3/site-packages
drwxr-xr-x  3 root  wheel  102 Jul  2 17:08 /Library/Python/2.5/site-packages
drwxr-xr-x  3 root  wheel  102 Jul  2 17:08 /Library/Python/2.6/site-packages
drwxr-xr-x  3 root  wheel  102 Jul  2 17:08 /Library/Python/2.7/site-packages

I'd say if any of the python.org or ActiveState Python installers mess
with these directories' ownership or permissions, they're doing
something wrong.  While the contents of these directories is up to the
user, their permissions are part of the OS install.

>   Many folders in the System domain that were previously owned by
>   the admingroup are now owned by the wheel group.

This isn't quite right (the "System domain" means /System); it's the
part a bit later that says "All subdirectories within /Library now
have mode 755 (writable only by root) permissions instead of mode 775
(writable by the admin group) except... [a bunch of directories that
do not include Python]".

Anyway, the workaround is simple enough - and yeah, still pretty
necessary to install pip/virtualenv themselves.

--
Nicholas Riley 
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] Ownership of installed Python on Mac

2011-08-09 Thread Ned Deily
In article ,
 Ned Deily  wrote:

> In article ,
>  Ned Deily  wrote:
> 
> > In article 
> > ,
> >  Michael Foord  wrote:
> > > I don't believe that is actually the case in Lion due to the changes 
> > > pointed
> > > out by Nicholas.
> > Odd!  So far, this works for me on Lion with the current python.org 
> > installer (3.2.1 at least).  Perhaps you can be more specific about 
> > exactly how to reproduce what has changed for you.
> 
> Ah, a thought!  I have been testing with a vanilla Lion system with a 
> freshly-installed python.org Pythons.  In that case, the permissions of 
> the files in /Library/Frameworks/Python.framework are being set as 
> specified by the python.org installer.  Perhaps you are using a 
> python.org Python that was on a system upgraded from Snow Leopard?  In 
> that case, the Apple upgrade process may have mucked with the 
> permissions of the existing files.  Reinstalling using the python.org 
> installers would likely take care of that.  But it is something we 
> should document and or consider changing.

Yes, reinstalling Python using the python.org installer fixes it because 
the installer's post-install script simply does a chgrp -R admin and 
chgrp -R g+w to the version it installed.  That should be 
non-destructive, i.e. existing packages installed in site-packages 
should not disturbed so, if a user is not comfortable with the command 
line, reinstalling with a python.org installer after an upgrade to Lion 
is viable.  Also, because the permissions are set this way rather than 
explicitly in an installer bom, the Disk Utility.app (or diskutil) 
Repair Permissions function doesn't help for this.

On my high-priority list of things to do is to update the "Using Python 
on a Macintosh" section of the "Python Setup and Usage" standard doc as 
well as http://www.python.org/download/mac/ both of which are very 
out-of-date.  There is the new http://www.python.org/download/mac/tcltk/ 
which I have been keeping up-to-date.  Somewhere in there or in the wiki 
should be a section on upgrading which could include things like this.

-- 
 Ned Deily,
 n...@acm.org

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] Ownership of installed Python on Mac

2011-08-09 Thread Michael Foord
On 9 August 2011 22:42, Ned Deily  wrote:

> In article ,
>  Ned Deily  wrote:
>
> > In article
> > ,
> >  Michael Foord  wrote:
> > > I don't believe that is actually the case in Lion due to the changes
> > > pointed
> > > out by Nicholas.
> > Odd!  So far, this works for me on Lion with the current python.org
> > installer (3.2.1 at least).  Perhaps you can be more specific about
> > exactly how to reproduce what has changed for you.
>
> Ah, a thought!  I have been testing with a vanilla Lion system with a
> freshly-installed python.org Pythons.  In that case, the permissions of
> the files in /Library/Frameworks/Python.framework are being set as
> specified by the python.org installer.  Perhaps you are using a
> python.org Python that was on a system upgraded from Snow Leopard?  In
> that case, the Apple upgrade process may have mucked with the
> permissions of the existing files.  Reinstalling using the python.org
> installers would likely take care of that.  But it is something we
> should document and or consider changing.
>



Hmm... for 3.2 and 2.7 I was using Activestate installers not Python.org
ones - so perhaps it's their bug (in which case sorry for the noise).

Michael


>
> --
>  Ned Deily,
>  n...@acm.org
>
> ___
> Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
>



-- 

http://www.voidspace.org.uk/

May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] Ownership of installed Python on Mac

2011-08-09 Thread Ned Deily
In article ,
 Ned Deily  wrote:

> In article 
> ,
>  Michael Foord  wrote:
> > I don't believe that is actually the case in Lion due to the changes 
> > pointed
> > out by Nicholas.
> Odd!  So far, this works for me on Lion with the current python.org 
> installer (3.2.1 at least).  Perhaps you can be more specific about 
> exactly how to reproduce what has changed for you.

Ah, a thought!  I have been testing with a vanilla Lion system with a 
freshly-installed python.org Pythons.  In that case, the permissions of 
the files in /Library/Frameworks/Python.framework are being set as 
specified by the python.org installer.  Perhaps you are using a 
python.org Python that was on a system upgraded from Snow Leopard?  In 
that case, the Apple upgrade process may have mucked with the 
permissions of the existing files.  Reinstalling using the python.org 
installers would likely take care of that.  But it is something we 
should document and or consider changing.

-- 
 Ned Deily,
 n...@acm.org

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] Ownership of installed Python on Mac

2011-08-09 Thread Ned Deily
In article 
,
 Michael Foord  wrote:

> On 9 August 2011 20:42, Ned Deily  wrote:
> 
> > In article
> > ,
> >  Michael Foord  wrote:
> > > I've installed Python on OS X Lion on two computers - one with Lion
> > > preinstalled and one upgraded from Snow Leopard. I used both Python.org
> > and
> > > Activestate installers.
> > >
> > > In all cases (I'm pretty sure) the installation required elevation and
> > the
> > > installed Python was 'owned' by root - meaning any changes (e.g.
> > > installation into site-packages) must be sudo'd.
> > >
> > > This is a change from previous versions of OS X. Is this known, and is it
> > an
> > > issue? (I chown'd everything back to me to get round it.)
> >
> > I can't speak to the ActiveState installer but for the python.org
> > installers installation has always required a username with
> > administrator privilege.  That hasn't changed in Lion.  And, even though
> > owned by root, when logged in via an admin username, you should be able
> > to install packages to its default location (using python setup.py or
> > easy_install or pip) without sudo.
> 
> 
> I don't believe that is actually the case in Lion due to the changes pointed
> out by Nicholas.

Odd!  So far, this works for me on Lion with the current python.org 
installer (3.2.1 at least).  Perhaps you can be more specific about 
exactly how to reproduce what has changed for you.

-- 
 Ned Deily,
 n...@acm.org

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] Ownership of installed Python on Mac

2011-08-09 Thread Michael Foord
On 9 August 2011 20:42, Ned Deily  wrote:

> In article
> ,
>  Michael Foord  wrote:
> > I've installed Python on OS X Lion on two computers - one with Lion
> > preinstalled and one upgraded from Snow Leopard. I used both Python.org
> and
> > Activestate installers.
> >
> > In all cases (I'm pretty sure) the installation required elevation and
> the
> > installed Python was 'owned' by root - meaning any changes (e.g.
> > installation into site-packages) must be sudo'd.
> >
> > This is a change from previous versions of OS X. Is this known, and is it
> an
> > issue? (I chown'd everything back to me to get round it.)
>
> I can't speak to the ActiveState installer but for the python.org
> installers installation has always required a username with
> administrator privilege.  That hasn't changed in Lion.  And, even though
> owned by root, when logged in via an admin username, you should be able
> to install packages to its default location (using python setup.py or
> easy_install or pip) without sudo.


I don't believe that is actually the case in Lion due to the changes pointed
out by Nicholas.

All the best,

Michael



>  The default site-packages directory
> for python.org installations is:
>
> cd /Library/Frameworks/Python.framework/Versions/x.y/
> ls ./lib/pythonx.y/site-packages
> ls ./bin   # for scripts
>
> If you are using easy_install, make sure you aren't using the
> Apple-supplied easy_installs in /usr/bin which are for the system
> Pythons (2.7, 2.6, and 2.5 in OS X 10.7).  They will, by default,
> attempt to install into /Library/Python/2.y and /usr/local/bin for
> scripts and that *does* need sudo.
>
> --
>  Ned Deily,
>  n...@acm.org
>
> ___
> Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
>



-- 

http://www.voidspace.org.uk/

May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] Ownership of installed Python on Mac

2011-08-09 Thread Michael Foord
On 9 August 2011 20:00, Nicholas Riley  wrote:

> On Tue, Aug 09, 2011 at 06:21:17PM +0100, Michael Foord wrote:
> > In all cases (I'm pretty sure) the installation required elevation and
> the
> > installed Python was 'owned' by root - meaning any changes (e.g.
> > installation into site-packages) must be sudo'd.
> >
> > This is a change from previous versions of OS X. Is this known, and is it
> an
> > issue? (I chown'd everything back to me to get round it.)
>
> Yes, it's an intentional decision, made for security reasons:
>
>
> http://developer.apple.com/library/mac/releasenotes/MacOSX/WhatsNewInOSX/Articles/MacOSX10_7.html#//apple_ref/doc/uid/TP40010355-SW16
>
>
Right, I believe this is the specific change:


   -

   Many folders in the System domain that were previously owned by the
admingroup are now owned by the
   wheel group.


Nothing we can do about it then I guess. Thanks.





> The only inconsistent part is that /Library/Java is still
> admin-writable; /Library/Java/Extensions contains jars which end up on
> the classpath of all Java applications, so not allowing the equivalent
> thing for Python seems a bit strange.  This might just be linked to
> the removal of Java as part of the base system, though.
>
> You could only install Python packages as an admin user (without sudo)
> if they didn't try to create any scripts, which ended up in
> /usr/local/bin which isn't admin-writable even on Snow Leopard.
>
> Now I just install everything in a virtualenv and am generally
> happier.
>

Well yes, but that means you probably need pip and virtualenv as a minimum.
It was installing these that I noticed the difference.


Michael



>
> --
> Nicholas Riley 
>



-- 

http://www.voidspace.org.uk/

May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] Ownership of installed Python on Mac

2011-08-09 Thread Ned Deily
In article ,
 Ned Deily  wrote:

> In article 
> ,
>  Michael Foord  wrote:
> > I've installed Python on OS X Lion on two computers - one with Lion
> > preinstalled and one upgraded from Snow Leopard. I used both Python.org and
> > Activestate installers.
> > 
> > In all cases (I'm pretty sure) the installation required elevation and the
> > installed Python was 'owned' by root - meaning any changes (e.g.
> > installation into site-packages) must be sudo'd.
> > 
> > This is a change from previous versions of OS X. Is this known, and is it an
> > issue? (I chown'd everything back to me to get round it.)
> 
> I can't speak to the ActiveState installer but for the python.org 
> installers installation has always required a username with 
> administrator privilege.  That hasn't changed in Lion.  And, even though 
> owned by root, when logged in via an admin username, you should be able 
> to install packages to its default location (using python setup.py or 
> easy_install or pip) without sudo.  The default site-packages directory 
> for python.org installations is:
> 
> cd /Library/Frameworks/Python.framework/Versions/x.y/
> ls ./lib/pythonx.y/site-packages
> ls ./bin   # for scripts
> 
> If you are using easy_install, make sure you aren't using the 
> Apple-supplied easy_installs in /usr/bin which are for the system 
> Pythons (2.7, 2.6, and 2.5 in OS X 10.7).  They will, by default, 
> attempt to install into /Library/Python/2.y and /usr/local/bin for 
> scripts and that *does* need sudo.

Just to clarify:  to install Python itself using a python.org installer 
requires entering an admin user name and password using the standard OS 
X GUI installer or "sudo installer" if using the command line OS X 
installer.  But if you are running under a user with admin priv you 
shouldn't need to use sudo to install Distutils-based packages (via 
setup.py, easy_install, etc) with the python.org installed Pythons.  As 
far as I know, there is no difference in this behavior between Lion, 
Snow Leopard, or Leopard.

-- 
 Ned Deily,
 n...@acm.org

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] Ownership of installed Python on Mac

2011-08-09 Thread Ned Deily
In article 
,
 Michael Foord  wrote:
> I've installed Python on OS X Lion on two computers - one with Lion
> preinstalled and one upgraded from Snow Leopard. I used both Python.org and
> Activestate installers.
> 
> In all cases (I'm pretty sure) the installation required elevation and the
> installed Python was 'owned' by root - meaning any changes (e.g.
> installation into site-packages) must be sudo'd.
> 
> This is a change from previous versions of OS X. Is this known, and is it an
> issue? (I chown'd everything back to me to get round it.)

I can't speak to the ActiveState installer but for the python.org 
installers installation has always required a username with 
administrator privilege.  That hasn't changed in Lion.  And, even though 
owned by root, when logged in via an admin username, you should be able 
to install packages to its default location (using python setup.py or 
easy_install or pip) without sudo.  The default site-packages directory 
for python.org installations is:

cd /Library/Frameworks/Python.framework/Versions/x.y/
ls ./lib/pythonx.y/site-packages
ls ./bin   # for scripts

If you are using easy_install, make sure you aren't using the 
Apple-supplied easy_installs in /usr/bin which are for the system 
Pythons (2.7, 2.6, and 2.5 in OS X 10.7).  They will, by default, 
attempt to install into /Library/Python/2.y and /usr/local/bin for 
scripts and that *does* need sudo.

-- 
 Ned Deily,
 n...@acm.org

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] Ownership of installed Python on Mac

2011-08-09 Thread Nicholas Riley
On Tue, Aug 09, 2011 at 06:21:17PM +0100, Michael Foord wrote:
> In all cases (I'm pretty sure) the installation required elevation and the
> installed Python was 'owned' by root - meaning any changes (e.g.
> installation into site-packages) must be sudo'd.
> 
> This is a change from previous versions of OS X. Is this known, and is it an
> issue? (I chown'd everything back to me to get round it.)

Yes, it's an intentional decision, made for security reasons:

http://developer.apple.com/library/mac/releasenotes/MacOSX/WhatsNewInOSX/Articles/MacOSX10_7.html#//apple_ref/doc/uid/TP40010355-SW16

The only inconsistent part is that /Library/Java is still
admin-writable; /Library/Java/Extensions contains jars which end up on
the classpath of all Java applications, so not allowing the equivalent
thing for Python seems a bit strange.  This might just be linked to
the removal of Java as part of the base system, though.

You could only install Python packages as an admin user (without sudo)
if they didn't try to create any scripts, which ended up in
/usr/local/bin which isn't admin-writable even on Snow Leopard.

Now I just install everything in a virtualenv and am generally
happier.

-- 
Nicholas Riley 
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] Ownership of installed Python on Mac

2011-08-09 Thread Kevin Walzer

On 8/9/11 1:21 PM, Michael Foord wrote:

This is a change from previous versions of OS X. Is this known, and is
it an issue? (I chown'd everything back to me to get round it.)


I don't believe it is a change. /Library and /System/Library are owned 
by the system, not you.


--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


[Pythonmac-SIG] Ownership of installed Python on Mac

2011-08-09 Thread Michael Foord
Hey folks,

I've installed Python on OS X Lion on two computers - one with Lion
preinstalled and one upgraded from Snow Leopard. I used both Python.org and
Activestate installers.

In all cases (I'm pretty sure) the installation required elevation and the
installed Python was 'owned' by root - meaning any changes (e.g.
installation into site-packages) must be sudo'd.

This is a change from previous versions of OS X. Is this known, and is it an
issue? (I chown'd everything back to me to get round it.)

All the best,

Michael

-- 

http://www.voidspace.org.uk/

May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG