Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bdist_wininst installer with install script raises exception #48886

Closed
theller opened this issue Dec 11, 2008 · 8 comments
Closed

bdist_wininst installer with install script raises exception #48886

theller opened this issue Dec 11, 2008 · 8 comments
Assignees
Labels
stdlib Python modules in the Lib dir

Comments

@theller
Copy link

theller commented Dec 11, 2008

BPO 4636
Nosy @mhammond, @theller, @vstinner, @tarekziade, @merwok
Files
  • wininst-compat.patch: Run bdist_wininst install scripts in 2/3 compatibile environment
  • wininst-compat-2.7.patch: (2.7) Run bdist_wininst install scripts in 2/3 compatibile environment
  • wininst-10.0-compat.exe: default/3.3 rebuilt wininst stub
  • wininst-9.0-compat-2.7.exe: 2.7 rebuilt wininst stub
  • 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 2021-01-11.12:52:11.552>
    created_at = <Date 2008-12-11.21:16:07.175>
    labels = ['library']
    title = 'bdist_wininst installer with install script raises exception'
    updated_at = <Date 2021-01-11.12:52:11.551>
    user = 'https://github.com/theller'

    bugs.python.org fields:

    activity = <Date 2021-01-11.12:52:11.551>
    actor = 'vstinner'
    assignee = 'eric.araujo'
    closed = True
    closed_date = <Date 2021-01-11.12:52:11.552>
    closer = 'vstinner'
    components = ['Distutils']
    creation = <Date 2008-12-11.21:16:07.175>
    creator = 'theller'
    dependencies = []
    files = ['31714', '31715', '31716', '31717']
    hgrepos = []
    issue_num = 4636
    keywords = ['patch']
    message_count = 8.0
    messages = ['77631', '112431', '153681', '190439', '197436', '197442', '197818', '384826']
    nosy_count = 7.0
    nosy_names = ['mhammond', 'theller', 'vstinner', 'tarek', 'eric.araujo', 'Matt.Wilkie', 'dbn']
    pr_nums = []
    priority = 'normal'
    resolution = 'wont fix'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue4636'
    versions = []

    @theller
    Copy link
    Author

    theller commented Dec 11, 2008

    Running a bdist_wininst installer that contains a install script, with
    python 3, raises an exception. This is displayed in the gui:
    ImportError: No module named __builtin__
    *** run_installscript: internal error 0xFFFFFFFF ***

    This is probably because the bdist_wininst installer stubs (in the
    Lib/distutils/command subdirectory) have not been recompiled after
    changing the sources.

    @theller theller added the stdlib Python modules in the Lib dir label Dec 11, 2008
    @tarekziade tarekziade mannequin self-assigned this Feb 6, 2009
    @merwok
    Copy link
    Member

    merwok commented Aug 2, 2010

    Can you still reproduce in 3.1 and 3.2?

    @merwok
    Copy link
    Member

    merwok commented Feb 19, 2012

    The crash message is the same as the one in bpo-4918; it looks like bdist_wininst need better error reporting.

    @merwok merwok assigned merwok and unassigned tarekziade Feb 19, 2012
    @MattWilkie
    Copy link
    Mannequin

    MattWilkie mannequin commented Jun 1, 2013

    I confirm this is happening with 3.2.4 from an installer generated in 2.7.4 (64bit Win7, 32bit python): https://pypi.python.org/pypi/leo/4.11.devel-build-5802

    @dbn
    Copy link
    Mannequin

    dbn mannequin commented Sep 10, 2013

    It turns out this is pretty easy to fix by just changing the stub to import builtins or __builtin__ depending on the python install version. Attached are patches that fix this for both the default and 2.7 branches.

    My test case is a pure python module with an install script. I've rebuilt the wininst stub for both default (3.3) with VS2010 Express and 2.7 with VS2008 Express. I then built installers and ran them in both directions: installer created with python-2.7 and installed into python-3.3, and an installer created with python-3.3 and installed into python-2.7. Both worked fine with no warnings.

    I've attached the stubs I built in case they're helpful. wininst-10.0-compat.exe is the 32 bit stub for default/3.3. wininst-9.0-compat-2.7.exe is the 32 bit stub for 2.7.

    @merwok
    Copy link
    Member

    merwok commented Sep 10, 2013

    I think the exe files are specific to one Python version, so the version check would not be necessary. I may be wrong though, as I’m not a windows dev or user, so I’m adding Mark to this issue.

    @dbn
    Copy link
    Mannequin

    dbn mannequin commented Sep 15, 2013

    Right, that's what makes this difficult. If the stub exe of the target python was used, then it wouldn't need to care about compatibility. However, what you're running is the stub of the build python. So, when I distribute a bdist_wininst exe, it's running the stub from my python on the user's machine. That introduces a few compatibility issues.

    1. The exe needs the same CRT version installed on the target that it was built with. It would fail to run immediately in this case. This does make having the built python be newer than the target python a little difficult.

    2. The exe loads the python dll on the target machine. This requires the python dll to have enough compatibility for the usage of the python API in the exe of the build version.

    3. After loading the python dll, python code is run in the target python. This is the problem I'm trying to solve here. The python code is embedded in the exe of the installer, so the compatibility with the target python has to be considered at build time.

    The situation you're describing where the wininst of the target is run could maybe be made to work, but it would be a larger project.

    @vstinner
    Copy link
    Member

    The distutils bdist_wininst command has been removed in Python 3.10: see bpo-42802.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants