Just posting this in case someone else might bump into it down the road:
Since we use the entry point hack
<http://www.pyinstaller.org/wiki/Recipe/SetuptoolsEntryPoint>, I decided to
extend it a bit and add code that will create a dummy file with explicit
imports:
def Entrypoint(dist, group, name, distributions,
scripts=None, pathex=None, hiddenimports=None,
hookspath=None, excludes=None, runtime_hooks=None):
import pkg_resources
def get_toplevel(dist):
distribution = pkg_resources.get_distribution(dist)
return list(distribution.get_metadata('top_level.txt').split())
packages = []
for distribution in distributions:
packages += get_toplevel(distribution)
scripts = scripts or []
pathex = pathex or []
# get the entry point
ep = pkg_resources.get_entry_info(dist, group, name)
# insert path of the egg at the verify front of the search path
pathex = [ep.dist.location] + pathex
# script name must not be a valid module name to avoid name clashes on
import
script_path = os.path.join(WORKPATH, name + '-script.py')
print "creating script for entry point", dist, group, name
with open(script_path, 'w') as fh:
fh.write("import {0}\n".format(ep.module_name))
fh.write("{0}.{1}()\n".format(ep.module_name, '.'.join(ep.attrs)))
for package in packages:
fh.write("import {0}\n".format(package))
return Analysis([script_path] + scripts, pathex, hiddenimports, hookspath,
excludes, runtime_hooks)
On Tuesday, November 4, 2014 5:49:00 PM UTC+2, Steve Barnes wrote:
>
> On 04/11/14 12:13, Michael Sverdlik wrote:
> > Thanks Steve,
> > I've checked it and indeed this works. I'm not sure I'll solve my
> > problem this way (other devs won't be thrilled about it), but good to
> > know.
> The other "hack" or "work around" that I have used on occasion is to
> have a variation of the __import__ class that, when run from source,
> i.e. not Frozen, produces a file that "just" imports the relevant
> modules and twist the exe builders tail into also building this, for
> shared libraries this will ensure that all the libraries that I need are
> included in the share, then don't ship the "dummy" executable, or of
> course have it simply display a message. One sneaky is to have a dummy
> program that is generated and has as it's main method a display package
> information function.
>
> That way the other developers don't need to know about the manual task
> of adding if False statements and my build process can run a command to
> (re-)generate the dummy file.
>
> Gadget/Steve
>
>
--
You received this message because you are subscribed to the Google Groups
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyinstaller.
For more options, visit https://groups.google.com/d/optout.