[ python-Bugs-959576 ] Can't build Python on POSIX w/o $HOME

SourceForge.net noreply at sourceforge.net
Mon Jan 2 23:15:05 CET 2006


Bugs item #959576, was opened at 2004-05-24 19:16
Message generated for change (Comment added) made by birkenfeld
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=959576&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Build
Group: Python 2.4
Status: Open
Resolution: Fixed
Priority: 5
Submitted By: Barry A. Warsaw (bwarsaw)
Assigned to: Nobody/Anonymous (nobody)
Summary: Can't build Python on POSIX w/o $HOME

Initial Comment:
If you're building Python on os.name == 'posix' but
when there is no $HOME defined in your environment, you
cannot build Python.  This is because in the bowels of
distutils, you end up in check_environ(), which has
these lines:

    if os.name == 'posix' and not
os.environ.has_key('HOME'):
        import pwd
        os.environ['HOME'] = pwd.getpwuid(os.getuid())[5]

However, in a from-scratch build, the pwd module isn't
built by the time you get here.  I found this when
using SCons to build Python, since by default the
enclosing environment isn't passed to subprocesses.

I can work around this in my builds but Python's
setup.py should probably synthesize a $HOME if one
doesn't exist.  (Or maybe someone has a better idea for
a workaround).

----------------------------------------------------------------------

>Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2006-01-02 23:15

Message:
Logged In: YES 
user_id=1188172

Okay, so I think I'll leave the fix in for the time being.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2006-01-02 23:11

Message:
Logged In: YES 
user_id=21627

There isn't a specific maintainer for distutils; it's nearly
unmaintained.

----------------------------------------------------------------------

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2006-01-02 23:09

Message:
Logged In: YES 
user_id=1188172

Guido said:
"""
Hm. Methinks that the distutils code should have been patched to
survive the possibility of "import pwd" failing (or
pwd.getpwuid()
failing!) rather than hiding the problem by forcing pwd to
be built.
The latter seems a much less robust solution.
"""

Who is responsible for distutils?

----------------------------------------------------------------------

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-12-27 18:37

Message:
Logged In: YES 
user_id=1188172

I made the suggested change in revision 41834/41835.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2005-10-02 10:57

Message:
Logged In: YES 
user_id=21627

Making pwd builtin is fine with me. Make sure you move the
line to the other builtin modules, and add a comment telling
why it is need (i.e. when HOME isn't set).

----------------------------------------------------------------------

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-09-29 22:04

Message:
Logged In: YES 
user_id=1188172

Well, pwd will be built-in then, if that's a problem.

Assigning to loewis to look over it.

----------------------------------------------------------------------

Comment By: John Hein (jhein-sf)
Date: 2005-09-29 21:28

Message:
Logged In: YES 
user_id=59465

Let me revise that last comment.  There are some build
differences when this is done.

Uncommenting pwd in Setup.dist allows python to build, but
the 'pwd' extension (and pwd.so) does not get built.

And pwdmodule.o is ar'd into libpython2.4.a (& linked into
libpython2.4.so)


----------------------------------------------------------------------

Comment By: John Hein (jhein-sf)
Date: 2005-09-29 21:14

Message:
Logged In: YES 
user_id=59465

I had this problem, too.
The fix proposed by birkenfeld on 9/22 works for me.


----------------------------------------------------------------------

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-09-22 09:19

Message:
Logged In: YES 
user_id=1188172

Seems that the pwdmodule entry in Modules/Setup.dist must be
uncommented.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=959576&group_id=5470


More information about the Python-bugs-list mailing list