pypa / pypa/setuptools

auto_chmod subscripts exceptions on py3

Open
#2,013 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.9k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

if ev is an OSError (as it's likely to be), you can not subscript it on py3

six.reraise(et, (ev[0], ev[1] + (" %s %s" % (func, arg))))

This was in some custom code doing a pep 517 build (from source) on pytest-black 0.3.8 on python 3.6. I am not sure exactly what was a symlink.

Traceback (most recent call last):
  File "<omit>/python3.6/shutil.py", line 488, in rmtree
    raise OSError("Cannot call rmtree on a symbolic link")
OSError: Cannot call rmtree on a symbolic link
During handling of the above exception, another exception occurred:
  File "<omit>/_pyfi_pep517_bootstrap.py", line 19, in <module>
    wheel_filename = pep517_builder.build_wheel(wheel_dir)
  File "<omit>/python3.6/site-packages/setuptools/build_meta.py", line 209, in build_wheel
    wheel_directory, config_settings)
  File "<omit>/python3.6/site-packages/setuptools/build_meta.py", line 194, in _build_with_temp_dir
    self.run_setup()
  File "<omit>/python3.6/site-packages/setuptools/build_meta.py", line 237, in run_setup
    self).run_setup(setup_script=setup_script)
  File "<omit>/python3.6/site-packages/setuptools/build_meta.py", line 142, in run_setup
    exec(compile(code, __file__, 'exec'), locals())
  File "setup.py", line 44, in <module>
    entry_points={"pytest11": ["black = pytest_black"]},
  File "<omit>/python3.6/site-packages/setuptools/__init__.py", line 144, in setup
    _install_setup_requires(attrs)
  File "<omit>/python3.6/site-packages/setuptools/__init__.py", line 139, in _install_setup_requires
    dist.fetch_build_eggs(dist.setup_requires)
  File "<omit>/python3.6/site-packages/setuptools/dist.py", line 720, in fetch_build_eggs
    replace_conflicting=True,
  File "<omit>/python3.6/site-packages/pkg_resources/__init__.py", line 782, in resolve
    replace_conflicting=replace_conflicting
  File "<omit>/python3.6/site-packages/pkg_resources/__init__.py", line 1065, in best_match
    return self.obtain(req, installer)
  File "<omit>/python3.6/site-packages/pkg_resources/__init__.py", line 1077, in obtain
    return installer(requirement)
  File "<omit>/python3.6/site-packages/setuptools/dist.py", line 787, in fetch_build_egg
    return cmd.easy_install(req)
  File "<omit>/python3.6/site-packages/setuptools/command/easy_install.py", line 679, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "<omit>/python3.6/contextlib.py", line 99, in __exit__
    self.gen.throw(type, value, traceback)
  File "<omit>/python3.6/site-packages/setuptools/command/easy_install.py", line 643, in _tmpdir
    os.path.exists(tmpdir) and rmtree(rmtree_safe(tmpdir))
  File "<omit>/python3.6/site-packages/setuptools/command/easy_install.py", line 2277, in rmtree
    return shutil.rmtree(path, ignore_errors, onerror)
  File "<omit>/python3.6/shutil.py", line 490, in rmtree
    onerror(os.path.islink, path, sys.exc_info())
  File "<omit>/python3.6/site-packages/setuptools/command/easy_install.py", line 1729, in auto_chmod
    six.reraise(et, (ev[0], ev[1] + (" %s %s" % (func, arg))))
TypeError: 'OSError' object is not subscriptable

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at setuptools/command/easy_install.py, specifically the auto_chmod entry point shown in the traceback, and compare its exception handling with Python 3 OSError behavior. Reproduce the symbolic-link cleanup failure if possible; done means the original error is reraised with the function and argument context without causing a TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.