1. Tarek Ziadé
  2. distribute
Issue #334 resolved

Fix for #311 breaks packages that use sys.stdout

Paul Nasrat
created an issue

Breaks eg numpy on virtualenv 1.8.3 which includes distribute 0.6.30

See https://github.com/pypa/virtualenv/issues/359 for debugging

Steps to reproduce

  • virtualenv -p python3.3 ve
  • ./ve/bin/pip install numpy
Running from numpy source directory.Traceback (most recent call last):
  File "<string>", line 17, in <module>
  File "/Users/pnasrat/Development/virtualenv/ve/build/numpy/setup.py", line 214, in <module>
    setup_package()
  File "/Users/pnasrat/Development/virtualenv/ve/build/numpy/setup.py", line 207, in setup_package
    configuration=configuration )
  File "/Users/pnasrat/Development/virtualenv/ve/build/numpy/build/py3k/numpy/distutils/core.py", line 186, in setup
    return old_setup(**new_attr)
  File "/Users/pnasrat/Library/homebrew/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/Users/pnasrat/Library/homebrew/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/dist.py", line 917, in run_commands
    self.run_command(cmd)
  File "/Users/pnasrat/Library/homebrew/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/dist.py", line 936, in run_command
    cmd_obj.run()
  File "/Users/pnasrat/Development/virtualenv/ve/build/numpy/build/py3k/numpy/distutils/command/egg_info.py", line 8, in run
    self.run_command("build_src")
  File "/Users/pnasrat/Library/homebrew/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/Users/pnasrat/Library/homebrew/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/dist.py", line 936, in run_command
    cmd_obj.run()
  File "/Users/pnasrat/Development/virtualenv/ve/build/numpy/build/py3k/numpy/distutils/command/build_src.py", line 152, in run
    self.build_sources()
  File "/Users/pnasrat/Development/virtualenv/ve/build/numpy/build/py3k/numpy/distutils/command/build_src.py", line 163, in build_sources
    self.build_library_sources(*libname_info)
  File "/Users/pnasrat/Development/virtualenv/ve/build/numpy/build/py3k/numpy/distutils/command/build_src.py", line 298, in build_library_sources
    sources = self.generate_sources(sources, (lib_name, build_info))
  File "/Users/pnasrat/Development/virtualenv/ve/build/numpy/build/py3k/numpy/distutils/command/build_src.py", line 385, in generate_sources
    source = func(extension, build_dir)
  File "numpy/core/setup.py", line 694, in get_mathlib_info
    st = config_cmd.try_link('int main(void) { return 0;}')
  File "/Users/pnasrat/Library/homebrew/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/command/config.py", line 243, in try_link
    self._check_compiler()
  File "/Users/pnasrat/Development/virtualenv/ve/build/numpy/build/py3k/numpy/distutils/command/config.py", line 75, in _check_compiler
    c_compiler=self.compiler)
  File "/Users/pnasrat/Development/virtualenv/ve/build/numpy/build/py3k/numpy/distutils/fcompiler/__init__.py", line 832, in new_fcompiler
    c_compiler=c_compiler)
  File "/Users/pnasrat/Development/virtualenv/ve/build/numpy/build/py3k/numpy/distutils/fcompiler/__init__.py", line 814, in get_default_fcompiler
    c_compiler=c_compiler)
  File "/Users/pnasrat/Development/virtualenv/ve/build/numpy/build/py3k/numpy/distutils/fcompiler/__init__.py", line 763, in _find_existing_fcompiler
    c.customize(dist)
  File "/Users/pnasrat/Development/virtualenv/ve/build/numpy/build/py3k/numpy/distutils/fcompiler/__init__.py", line 500, in customize
    get_flags('opt', oflags)
  File "/Users/pnasrat/Development/virtualenv/ve/build/numpy/build/py3k/numpy/distutils/fcompiler/__init__.py", line 491, in get_flags
    flags.extend(getattr(self.flag_vars, tag))
  File "/Users/pnasrat/Development/virtualenv/ve/build/numpy/build/py3k/numpy/distutils/environment.py", line 37, in __getattr__
    return self._get_var(name, conf_desc)
  File "/Users/pnasrat/Development/virtualenv/ve/build/numpy/build/py3k/numpy/distutils/environment.py", line 51, in _get_var
    var = self._hook_handler(name, hook)
  File "/Users/pnasrat/Development/virtualenv/ve/build/numpy/build/py3k/numpy/distutils/fcompiler/__init__.py", line 698, in _environment_hook
    return hook()
  File "/Users/pnasrat/Development/virtualenv/ve/build/numpy/build/py3k/numpy/distutils/fcompiler/gnu.py", line 348, in get_flags_opt
    return GnuFCompiler.get_flags_opt(self)
  File "/Users/pnasrat/Development/virtualenv/ve/build/numpy/build/py3k/numpy/distutils/fcompiler/gnu.py", line 195, in get_flags_opt
    v = self.get_version()
  File "/Users/pnasrat/Development/virtualenv/ve/build/numpy/build/py3k/numpy/distutils/fcompiler/__init__.py", line 430, in get_version
    version = CCompiler.get_version(self, force=force, ok_status=ok_status)
  File "/Users/pnasrat/Development/virtualenv/ve/build/numpy/build/py3k/numpy/distutils/ccompiler.py", line 26, in <lambda>
    m = lambda self, *args, **kw: func(self, *args, **kw)
  File "/Users/pnasrat/Development/virtualenv/ve/build/numpy/build/py3k/numpy/distutils/ccompiler.py", line 458, in CCompiler_get_version
    status, output = exec_command(version_cmd,use_tee=0)
  File "/Users/pnasrat/Development/virtualenv/ve/build/numpy/build/py3k/numpy/distutils/exec_command.py", line 197, in exec_command
    if _with_python and (0 or sys.__stdout__.fileno()==-1):
ValueError: underlying buffer has been detached

Comments (7)

  1. g2p

    sys.__stdout__ is documented not to change. Numpy users already have a workaround (in released versions of distribute and virtualenv) and a legit fix (in numpy git and this numpy backport, complete with travis instructions), so there is absolutely no reason to risk breaking more stuff.

    (If you're noticing complaints, they are most likely from Travis users. Those users are helped by the above travis instructions in the short term, and will be helped by team travis upgrading virtualenv in the medium term)

  2. Log in to comment