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.

Title: pysetup3 run bdist_wininst fails
Type: Stage: resolved
Components: Distutils2, Library (Lib) Versions: Python 3.3
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: alexis, eric.araujo, tarek, vinay.sajip
Priority: normal Keywords:

Created on 2011-10-11 11:12 by vinay.sajip, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (8)
msg145339 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2011-10-11 11:12
When you run

pysetup3 run bdist_wininst

in a project directory with a valid setup.cfg, it fails with

error: Invalid command install

after the build, build_py and build_scripts steps.

For info, pysetup3 run bdist_dumb runs without error.
msg145406 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-12 16:15
On line 118, replacing 'install' with 'install_dist' should fix it.
msg145439 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2011-10-12 22:17
> On line 118, replacing 'install' with 'install_dist' should fix it.

Sadly, it just defers the problem:

vinay@eta-natty:~/projects/dory$ pysetup3 run bdist_wininst
running bdist_wininst
running build
running build_py
running build_scripts
installing to build/bdist.linux-i686/wininst
running install_lib
creating build/bdist.linux-i686
creating build/bdist.linux-i686/wininst
creating build/bdist.linux-i686/wininst/PURELIB
creating build/bdist.linux-i686/wininst/PURELIB/apackage
running install_scripts
creating build/bdist.linux-i686/wininst/SCRIPTS
changing mode of build/bdist.linux-i686/wininst/SCRIPTS/dory to 755
running install_distinfo
creating build/bdist.linux-i686/wininst/PURELIB/dory-0.1.dist-info
creating build/bdist.linux-i686/wininst/PURELIB/dory-0.1.dist-info/METADATA
creating build/bdist.linux-i686/wininst/PURELIB/dory-0.1.dist-info/INSTALLER
creating build/bdist.linux-i686/wininst/PURELIB/dory-0.1.dist-info/REQUESTED
creating build/bdist.linux-i686/wininst/PURELIB/dory-0.1.dist-info/RECORD
Traceback (most recent call last):
  File "/usr/local/bin/pysetup3", line 4, in <module>
  File "/usr/local/lib/python3.3/packaging/", line 653, in main
    return dispatcher()
  File "/usr/local/lib/python3.3/packaging/", line 642, in __call__
    return func(self, self.args)
  File "/usr/local/lib/python3.3/packaging/", line 91, in wrapper
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.3/packaging/", line 288, in _run
    dist.run_command(cmd, dispatcher.command_options[cmd])
  File "/usr/local/lib/python3.3/packaging/", line 709, in run_command
  File "/usr/local/lib/python3.3/packaging/command/", line 175, in run
    self.create_exe(arcname, fullname, self.bitmap)
  File "/usr/local/lib/python3.3/packaging/command/", line 243, in create_exe
    cfgdata = self.get_inidata()
  File "/usr/local/lib/python3.3/packaging/command/", line 202, in get_inidata
    info = (metadata.long_description or '') + '\n'
AttributeError: 'Metadata' object has no attribute 'long_description'

It appears that there is some confusion as to whether to use attribute or item access. The failing code above needs to be replaced with something like

    if 'long_description' in metadata:
        info = metadata['long_description']
        info = metadata.get('description', '')
    info += '\n'
msg145461 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-13 15:45
Metadata now only uses item access, and the names have changed: long_description is description, url is home_page, former description is summary, etc. (more in PEP 345).  I don’t have Windows yet, so either we wait or we iterate I make a patch - you report failures - I make a patch etc.
msg145473 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2011-10-13 17:25
> I don’t have Windows yet, so either we wait or we iterate I make a patch - you report failures - I make a patch etc.

Actually I'm finding these failures on Ubuntu :-)

Although there are MBCS encoding issues which will also need to be fixed before you can build a pure-Python .exe installer on Linux (which is possible with distutils, so should work in packaging too), these failures occur before you get to that point. That last part can be fixed on Linux by doing (in bdist_wininst.create_exe):

    cfgdata = cfgdata.encode("mbcs")
except LookupError:
    cfgdata = cfgdata.encode("latin-1")

which is at least better than what we have now.
msg145543 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-14 16:04
I’ll apply your hack and fix the other issues.
msg145678 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-17 12:29
I’ve patched most of bdist_wininst and started to work on a few tests which work under 2.7 and fail under 3.2 without the fixes so that I can assume I’ve not broken anything.

However, the mapping API of the Metadata class is quite unfriendly.  For example, if I try to replace metadata.long_description with metadata['description'], no exception will be raised if the metadata does not contain a description, it will return 'UNKNOWN'.  Code quickly becomes ugly.  I will open another report to ask Tarek to allow me to revamp the mapping API of Metadata so that code can be easier to write and read.

(I’m also removing the dependency on another bug that’s not really a blocker.)
msg145679 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-17 12:31
To clarify: the part about the tests applies to distutils.  3.x fixes will then be ported to packaging.  Starting with successful tests in distutils 2.7 makes me feel more confident about editing distutils 3.x and packaging 3.3.
Date User Action Args
2022-04-11 14:57:22adminsetgithub: 57360
2014-03-13 03:27:40eric.araujosetstatus: open -> closed
resolution: out of date
stage: resolved
2014-03-13 03:26:21eric.araujosetdependencies: - bdist_wininst depends on MBCS codec, unavailable on non-Windows
2011-10-17 12:31:48eric.araujosetmessages: + msg145679
2011-10-17 12:29:54eric.araujosetdependencies: - Rename install_dist to install
messages: + msg145678
2011-10-15 15:36:13vinay.sajiplinkissue13182 superseder
2011-10-14 16:04:07eric.araujosetassignee: tarek -> eric.araujo
messages: + msg145543
2011-10-14 16:03:24eric.araujosetdependencies: + bdist_wininst depends on MBCS codec, unavailable on non-Windows
2011-10-13 17:25:37vinay.sajipsetmessages: + msg145473
2011-10-13 15:45:56eric.araujosetmessages: + msg145461
2011-10-12 22:17:31vinay.sajipsetmessages: + msg145439
2011-10-12 16:20:15eric.araujosetdependencies: + Rename install_dist to install
2011-10-12 16:15:50eric.araujosetmessages: + msg145406
2011-10-11 11:12:17vinay.sajipcreate