This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: setup.py imports pwd before it's built if HOME not set
Type: Stage:
Components: Build Versions: Python 2.4
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, sfiedler
Priority: normal Keywords:

Created on 2003-02-28 02:55 by sfiedler, last changed 2022-04-10 16:07 by admin. This issue is now closed.

Messages (3)
msg14892 - (view) Author: Stephan A. Terre (sfiedler) Date: 2003-02-28 02:55
The function check_environ in Lib/distutils/util.py
imports the 'pwd' module if the HOME environment
variable is not set and os.name is 'posix' (as it is on
at least Linux, Solaris, and Tru64 Unix). In the
context of building Python, this happens before the pwd
module has been built. The error is reproduced below.

I can work around this easily. However, since the error
message was somewhat oblique, it was confusing to
diagnose. Perhaps there's some way to improve the
diagnostic if the underlying problem cannot be fixed.

case $MAKEFLAGS in  *-s*) CC='cc' LDSHARED='ld -shared
-expect_unresolved "*"' OPT='-DNDEBUG -O -Olimit 1500'
./python -E ./setup.py -q build;;  *) CC='cc'
LDSHARED='ld -shared -expect_unresolved "*"'
OPT='-DNDEBUG -O -Olimit 1500' ./python -E ./setup.py
build;;  esac
Traceback (most recent call last):
  File "./setup.py", line 795, in ?
    main()
  File "./setup.py", line 790, in main
    scripts = ['Tools/scripts/pydoc']
  File
"/usr/var/tmp/sat/xmpy/system/support/build/Python-2.Lib/distutils/core.py",
line 110, in setup
    dist.parse_config_files()
  File
"/usr/var/tmp/sat/xmpy/system/support/build/Python-2.Lib/distutils/dist.py",
line 310, in parse_config_files
    filenames = self.find_config_files()
  File
"/usr/var/tmp/sat/xmpy/system/support/build/Python-2.Lib/distutils/dist.py",
line 272, in find_config_files
    check_environ()
  File
"/usr/var/tmp/sat/xmpy/system/support/build/Python-2.Lib/distutils/util.py",
line 150, in check_environ
    import pwd
ImportError: No module named pwd
msg14893 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-09-17 17:15
Logged In: YES 
user_id=1188172

Still present in current CVS.
msg14894 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-09-22 06:41
Logged In: YES 
user_id=1188172

Duplicate of #959576.
History
Date User Action Args
2022-04-10 16:07:14adminsetgithub: 38069
2003-02-28 02:55:40sfiedlercreate