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 install_script not run on uninstall #56409

Closed
mhammond opened this issue May 28, 2011 · 6 comments
Closed

bdist_wininst install_script not run on uninstall #56409

mhammond opened this issue May 28, 2011 · 6 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@mhammond
Copy link
Contributor

BPO 12200
Nosy @loewis, @mhammond, @vstinner, @tarekziade, @merwok
Files
  • setup.py: Sample setup script
  • hello.py: A stub for the script being installed
  • hello-install.py: the install script
  • issue12200.patch: Proposed fix for 3.2
  • 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/mhammond'
    closed_at = <Date 2021-01-11.12:52:38.638>
    created_at = <Date 2011-05-28.02:08:46.821>
    labels = ['type-bug', 'library']
    title = 'bdist_wininst install_script not run on uninstall'
    updated_at = <Date 2021-01-11.12:52:38.637>
    user = 'https://github.com/mhammond'

    bugs.python.org fields:

    activity = <Date 2021-01-11.12:52:38.637>
    actor = 'vstinner'
    assignee = 'mhammond'
    closed = True
    closed_date = <Date 2021-01-11.12:52:38.638>
    closer = 'vstinner'
    components = ['Distutils']
    creation = <Date 2011-05-28.02:08:46.821>
    creator = 'mhammond'
    dependencies = []
    files = ['22160', '22161', '22162', '22205']
    hgrepos = []
    issue_num = 12200
    keywords = ['patch']
    message_count = 6.0
    messages = ['137105', '137448', '137463', '137467', '137535', '384830']
    nosy_count = 5.0
    nosy_names = ['loewis', 'mhammond', 'vstinner', 'tarek', 'eric.araujo']
    pr_nums = []
    priority = 'normal'
    resolution = 'wont fix'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue12200'
    versions = ['Python 2.7', 'Python 3.2', 'Python 3.3']

    @mhammond
    Copy link
    Contributor Author

    Probably in all versions, but certainly in 2.7.

    If you create an installer with bdist_wininst and specify an install_script, that script is not run on uninstallation.

    See attached test case: setup.py specifies an install_script which just appends argv to %TEMP%/uninstall-test.txt.

    • Create the installer with "python setup.py bdist_wininst"
    • Execute the installer (ie, "dist\hello-0.1.win32.exe")
    • Check %TEMP%/uninstall-test.txt - it should have 1 line:
      ['o:\\src\\python-2.6\\Scripts\\hello-install.py', '-install']
    • Uninstall the package.
    • Check %TEMP%/uninstall-test.txt - it *should* have a new line reflecting the uninstall. Instead it is unchanged.

    To get more info:

    • Reinstall the package.
    • Manually uninstall using the cmdline (with adjusted paths)
      C:\> "c:\python26\Removehello.exe" -u "c:\python26\hello-wininst.log" > %TEMP%\delme.out 2>&1

    Check the contents of %TEMP%\delme.out - you will see:
    *** Could not load Python ****** Could not run installation script ***

    Digging into the source code of install.c - the problem is that although the Python DLL name is parsed from the log file, this isn't reflected in the global variables python_dir or pythondll - so they remain empty strings and attempting to load the empty string as Python causes the error messages.

    @mhammond mhammond added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels May 28, 2011
    @mhammond mhammond assigned mhammond and unassigned tarekziade May 31, 2011
    @merwok
    Copy link
    Member

    merwok commented Jun 1, 2011

    I cannot review the patch (I don’t know C), but I will trust you. Could you add a test to prevent regressions?

    @mhammond
    Copy link
    Contributor Author

    mhammond commented Jun 1, 2011

    Adding tests would be fairly painful - there is no test infrastructure in place for generating and running installers at all, and worse, the changes are likely to not work correctly when run from a Python "build" tree when the built DLL is not installed into System32 (the patch basically assumes an "installed" dir structure rather than a "built" one.)

    @mhammond
    Copy link
    Contributor Author

    mhammond commented Jun 1, 2011

    (OTOH though, I could tweak the patch to work in a built tree - it would mean appending "PCBuild" to the dir and retrying the DLL load if the other options fail...)

    @merwok
    Copy link
    Member

    merwok commented Jun 3, 2011

    If it’s not too much hassle for you and if it doesn’t improve maintenance costs, we’d feel safer with a test.

    Martin, could you review this patch?

    @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 type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants