[Python-bugs-list] [Bug #110642] freeze with "-s service" and "-m" (PR#315)

noreply@sourceforge.net noreply@sourceforge.net
Sun, 13 Aug 2000 23:44:02 -0700


Bug #110642, was updated on 2000-Jul-31 14:09
Here is a current snapshot of the bug.

Project: Python
Category: demos and tools
Status: Open
Resolution: None
Bug Group: Feature Request
Priority: 5
Summary: freeze with "-s service" and "-m" (PR#315)

Details: Jitterbug-Id: 315
Submitted-By: tdickenson@geminidataloggers.com
Date: Fri,  5 May 2000 05:50:37 -0400 (EDT)
Version: 1.5.2
OS: Windows


There is a problem with combining two different options to freeze. Those options
are:

1. "-s service" indicating that the frozen program is a windows service. one
effect of this is that the myscript.py file on the freeze command line should be
available for import, not as __main__

2. "-m" indicating that extra modules are to be included in the freeze.

The relevant block of code is at line 335...
    # Add the main script as either __main__, or the actual module name.
    if python_entry_is_main:
        mf.run_script(scriptfile)
    else:
        if modargs:
            mf.import_hook(scriptfile)
        else:
            mf.load_file(scriptfile)

For a service, the outer 'else' block is entered.

If -m is not specified then the inner 'else' block is entered. mf.load_file
assumes its parameter is a filename (to be imported from), an everything is
happy.

If -m is specified then the inner 'if' block is entered. mf.import_hook assumes
its parameter is a module to imported. This fails because "myscript.py" is not a
module name, and can not be imported.

I think this block of code was naively copy/pasted from the block above it
(where it correctly implements the -m option), and never tested with the -m
option.

This block (starting line 335) should be replaced with

    # Add the main script as either __main__, or the actual module name.
    if python_entry_is_main:
        mf.run_script(scriptfile)
    else:
        mf.load_file(scriptfile)

I have tested this patch on windows, freezing service and non-service scripts,
both with and without -m





====================================================================
Audit trail:
Mon May 22 17:28:43 2000	guido	changed notes
Mon May 22 17:28:43 2000	guido	moved from incoming to open

Follow-Ups:

Date: 2000-Jul-31 14:10
By: none

Comment:
From: "Mark Hammond" <mhammond@skippinet.com.au>
Subject: RE: [Python-bugs-list] freeze with "-s service" and "-m" (PR#315)
Date: Fri, 5 May 2000 23:19:14 +1000

> I think this block of code was naively copy/pasted from the
> block above it

Quite likely!

> This block (starting line 335) should be replaced with

...

If you submit a patch to this effect (to the patches address), I would be
happy to bless it (and given that the service code is mine, I guess that
would be all that is needed...)

Thanks,

Mark.



-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=110642&group_id=5470