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: AttributeError in distutils2.pypi.wrapper
Type: behavior Stage: resolved
Components: Distutils2 Versions: Python 3.3, 3rd party
process
Status: closed Resolution: out of date
Dependencies: 14263 Superseder:
Assigned To: alexis Nosy List: alexis, eric.araujo, paul.moore, t2y, tarek
Priority: normal Keywords: easy, patch

Created on 2012-02-13 15:32 by paul.moore, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (6)
msg153278 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2012-02-13 15:32
I created a bdist_wininst installer for distutils2 and installed it into my Python 2.7.2 installation. This is on Wondows, 32-bit. I then tried to do a simple install to test it was working.

>python -m distutils2.run install stemming
Checking the installation location...
Getting information about 'stemming'...
extensions in requires.txt are not supported (used by u'Genshi' 0.6)
u'pywin32': u'214' is not a valid version (field 'Version')
extensions in requires.txt are not supported (used by u'sqlpython' 1.7.2)
Traceback (most recent call last):
  File "D:\Apps\Python27\lib\runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "D:\Apps\Python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "D:\Apps\Python27\lib\site-packages\distutils2\run.py", line 664, in <module>
    sys.exit(main())
  File "D:\Apps\Python27\lib\site-packages\distutils2\run.py", line 651, in main
    return dispatcher()
  File "D:\Apps\Python27\lib\site-packages\distutils2\run.py", line 639, in __call__
    return func(self, self.args)
  File "D:\Apps\Python27\lib\site-packages\distutils2\run.py", line 91, in wrapper
    return f(*args, **kwargs)
  File "D:\Apps\Python27\lib\site-packages\distutils2\run.py", line 167, in _install
    return not install(target)
  File "D:\Apps\Python27\lib\site-packages\distutils2\install.py", line 514, in install
    info = get_infos(project)
  File "D:\Apps\Python27\lib\site-packages\distutils2\install.py", line 338, in get_infos
    release = index.get_release(requirements)
  File "D:\Apps\Python27\lib\site-packages\distutils2\pypi\wrapper.py", line 28, in decorator
    if f != func.im_self and hasattr(f, func.f_name):
AttributeError: 'function' object has no attribute 'f_name'

The initial errors look like complaints about existing packages I have installed by other means (setuptools or bdist_wininst). The final one looks like a bug in distutils2, though.
msg153343 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-02-14 15:48
> The initial errors look like complaints about existing packages I have installed by other means
They’re logging messages, not errors.  They appear because distutils2 scans sys.path for egg-info and egg files/dirs and reports invalid versions (per PEP 386).  Can you report a bug about them?  We do want a warning or an error when someone puts an invalid version in their setup.cfg, but when we’re scanning installed distributions it’s useless to warn.

> The final one looks like a bug in distutils2
I can reproduce it on Debian.  A test should not be hard to add, adding the “easy” keyword.
msg153365 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2012-02-14 19:31
On 14 February 2012 15:48, Éric Araujo <report@bugs.python.org> wrote:
>
> Éric Araujo <merwok@netwok.org> added the comment:
>
>> The initial errors look like complaints about existing packages I have installed by other means
> They’re logging messages, not errors.  They appear because distutils2 scans sys.path for egg-info and egg files/dirs and reports invalid versions
> (per PEP 386).  Can you report a bug about them?  We do want a warning or an error when someone puts an invalid version in their setup.cfg,
> but when we’re scanning installed distributions it’s useless to warn.

To what? The individual packages? Maybe, but I'm not sure how useful
that would be. For example, pywin32 has been using 3-digit versions
like this forever, and I don't see them changing just on the basis of
this (but I may be wrong). PyPI seems to handle pywin32's version
fine...

I'd rather say that it's a bug in distutils2 that it complains about
perfectly valid distributions. I'd be OK with a "verify" flag/action
that checked existing installed distributions, but I see no reason for
any message (informational, warning, or whatever) when you're just
asking for a new distribution to be installed.
msg155495 - (view) Author: Tetsuya Morimoto (t2y) * Date: 2012-03-12 22:07
I can reproduce it on Mac OS X.

I made a patch which checks the "func_name" attribute of function before it refers. It works for me. However, I wonder if a function has both "func.im_self" and "func.func_name"? Tell me the background because I'm newbie for distutils2.
msg155497 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2012-03-12 22:10
see Bug 14263 also
msg155550 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-03-13 01:15
[Paul]
> To what? The individual packages?
No, I meant distutils2 bugs.  I will open them when I get a minute.  You’re right that projects using metadata 1.0 or 1.1 don’t have to use a version conforming to PEP 386, and that packaging should warn when using the create and install actions and the check command, not when iterating over installed distributions.

[Tetsuya Morimoto]
> I made a patch which checks the "func_name" attribute of function before it refers. It
> works for me. However, I wonder if a function has both "func.im_self" and
> "func.func_name"? Tell me the background because I'm newbie for distutils2.
It’s not really a distutils2 detail but a general Python thing: functions and methods have these func_name (or __name__ in Python 3) attributes, and the somewhat complicated code in distutils2.pypi uses them to do its thing.  Alexis intends to clean up that code a bit and we’ll also need more tests.  If you’re new to distutils2, I think this bug is not easy or fun enough and you would have more luck working on another one.
History
Date User Action Args
2022-04-11 14:57:26adminsetgithub: 58210
2014-03-12 10:40:45eric.araujosetstatus: open -> closed
resolution: out of date
stage: test needed -> resolved
2012-03-13 01:20:53t2ysetfiles: - distutils2_pypi_wrapper.patch
2012-03-13 01:15:58eric.araujosetassignee: eric.araujo -> alexis
messages: + msg155550
title: distutils2 fails to install a package from PyPI on Python 2.7.2 -> AttributeError in distutils2.pypi.wrapper
2012-03-12 22:10:46tareksetdependencies: + switch_index_if_fails fails on py2
messages: + msg155497
2012-03-12 22:07:56t2ysetfiles: + distutils2_pypi_wrapper.patch

nosy: + t2y
messages: + msg155495

keywords: + patch
2012-02-14 19:31:17paul.mooresetmessages: + msg153365
2012-02-14 15:48:31eric.araujosetversions: + 3rd party, Python 3.3, - Python 2.7
messages: + msg153343

assignee: tarek -> eric.araujo
keywords: + easy
stage: test needed
2012-02-13 15:32:07paul.moorecreate