Skip to content

pysetup3 run bdist_wininst fails #57360

Closed

Description

@vsajip
BPO 13151
Nosy @vsajip, @tarekziade, @merwok

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/merwok'
closed_at = <Date 2014-03-13.03:27:40.223>
created_at = <Date 2011-10-11.11:12:17.754>
labels = ['library']
title = 'pysetup3 run bdist_wininst fails'
updated_at = <Date 2014-03-13.03:27:40.222>
user = 'https://github.com/vsajip'

bugs.python.org fields:

activity = <Date 2014-03-13.03:27:40.222>
actor = 'eric.araujo'
assignee = 'eric.araujo'
closed = True
closed_date = <Date 2014-03-13.03:27:40.223>
closer = 'eric.araujo'
components = ['Library (Lib)', 'Distutils2']
creation = <Date 2011-10-11.11:12:17.754>
creator = 'vinay.sajip'
dependencies = []
files = []
hgrepos = []
issue_num = 13151
keywords = []
message_count = 8.0
messages = ['145339', '145406', '145439', '145461', '145473', '145543', '145678', '145679']
nosy_count = 4.0
nosy_names = ['vinay.sajip', 'tarek', 'eric.araujo', 'alexis']
pr_nums = []
priority = 'normal'
resolution = 'out of date'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue13151'
versions = ['Python 3.3']

Activity

  1. vsajip commented on Oct 11, 2011

    @vsajip
    MemberAuthor

    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.

  2. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Oct 11, 2011
  3. merwok commented on Oct 12, 2011

    @merwok
    Member

    On line 118, replacing 'install' with 'install_dist' should fix it.

  4. vsajip commented on Oct 12, 2011

    @vsajip
    MemberAuthor

    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>
        sys.exit(main())
      File "/usr/local/lib/python3.3/packaging/run.py", line 653, in main
        return dispatcher()
      File "/usr/local/lib/python3.3/packaging/run.py", line 642, in __call__
        return func(self, self.args)
      File "/usr/local/lib/python3.3/packaging/run.py", line 91, in wrapper
        return f(*args, **kwargs)
      File "/usr/local/lib/python3.3/packaging/run.py", line 288, in _run
        dist.run_command(cmd, dispatcher.command_options[cmd])
      File "/usr/local/lib/python3.3/packaging/dist.py", line 709, in run_command
        cmd_obj.run()
      File "/usr/local/lib/python3.3/packaging/command/bdist_wininst.py", line 175, in run
        self.create_exe(arcname, fullname, self.bitmap)
      File "/usr/local/lib/python3.3/packaging/command/bdist_wininst.py", line 243, in create_exe
        cfgdata = self.get_inidata()
      File "/usr/local/lib/python3.3/packaging/command/bdist_wininst.py", 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']
        else:
            info = metadata.get('description', '')
        info += '\n'
  5. merwok commented on Oct 13, 2011

    @merwok
    Member

    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.

  6. vsajip commented on Oct 13, 2011

    @vsajip
    MemberAuthor

    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):

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

    which is at least better than what we have now.

  7. merwok commented on Oct 14, 2011

    @merwok
    Member

    I’ll apply your hack and fix the other issues.

  8. assigned and unassigned on Oct 14, 2011
  9. merwok commented on Oct 17, 2011

    @merwok
    Member

    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.)

  10. merwok commented on Oct 17, 2011

    @merwok
    Member

    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.

  11. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

stdlibStandard Library Python modules in the Lib/ directory

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions