build problem without HOME

Hollis R Blanchard hollis+ at andrew.cmu.edu
Tue May 8 16:21:29 EDT 2001


Hi, I encountered the following problem building python 2.1 from
ftp://ftp.tummy.com/pub/tummy/RPMS/SRPMS/python2-2.1-4.src.rpm and I
encountered the following problem:

PYTHONPATH= ./python ./setup.py build
Traceback (most recent call last):
  File "./setup.py", line 616, in ?
    main()
  File "./setup.py", line 610, in main
    scripts = ['Tools/scripts/pydoc']
  File "/dist/ybuild/build/python2/BUILD/Python-2.1/Lib/distutils/core.py", line 110, in setup
    dist.parse_config_files()
  File "/dist/ybuild/build/python2/BUILD/Python-2.1/Lib/distutils/dist.py", line 316, in parse_config_files
    filenames = self.find_config_files()
  File "/dist/ybuild/build/python2/BUILD/Python-2.1/Lib/distutils/dist.py", line 278, in find_config_files
    check_environ()
  File "/dist/ybuild/build/python2/BUILD/Python-2.1/Lib/distutils/util.py", line 147, in check_environ
    import pwd
ImportError: No module named pwd

The problem is that HOME is unset (this is a build system that unsets almost
all variables). So the following code (from check_environ) is executed:

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

Unforunately at this stage of the build it seems that none of the modules
(including pwdmodule) have been built yet, causing he traceback.
Understandably, this code is not run often, so it's easy to see how this could
have escaped testing.

I'd suggest that If HOME isn't set, $HOME/pydistcfg or whatever shouldn't be
checked at all. Either that or build pwdmodule beforehand, but since that's
what setup.py is trying to do in the first place... Anyways, I don't know the
build system.

My workaround was to build with 'HOME= make'.

-Hollis




More information about the Python-list mailing list