[Pythonmac-SIG] Question about py2app packages and includes options

Michael McCracken michael.mccracken at gmail.com
Wed Jul 18 00:49:09 CEST 2012


On Tue, Jul 17, 2012 at 5:25 PM, Chris Barker <chris.barker at noaa.gov> wrote:
> On Tue, Jul 17, 2012 at 11:03 AM, Michael McCracken
>
>> My question is: why does 'packages' copy the package recursively, but
>> not into the .zip,
>
> because there are packages that don't work right if zipped -- so this
> gets around that.

That makes sense - but as you mention, it seems like there's some
missing functionality.

>> while 'includes' only gets single modules?
>
> I suspect it's because there should be a way to include a particular
> module without the whole package. Essentially:
>
> "includes" adds a module to list, just as thought there were an
> "import module name" line in the code -- it is used to cover dynamic
> imports that won't be caught by walking the code.
>
> "packages" makes na compete copy of the package, and puts it outside
> the zip bundle -- this is fro including packages that have auxiliary
> files, etc, and/or can't be zipped for other reasons.
>
> It's a big ugly, but I've managed to put packages into the zip with
> something like this:
>
> includes = ["package",
>                 "package.subpackage"
>                 "package.subpackage.module1"
>                 "package.subpackage.module2"
> ]
>
> for some reason (is it a bug? -- or has it been fixed?) doing:
>
> includes = [ "package.subpackage.module"]
>
> puts module in the root, so it's there but can't be imported the same way.

I don't have time to test, but I think that's been fixed.
However, it's no fun if you have a lot of subpackages to add that way.

For what it's worth, the approach I'm now taking is to create the full
packages for each helper app, then just directly add the missing files
in site-packages.zip and lib-dynload from the helper into the main
app.
Using ZipFile, it's not too bad.

I looked at the source for how py2app uses modulegraph, to see if I
could just generate the dependencies for the sub apps and pass them as
the 'includes' for the main app, but that seemed involved enough that
I ended up doing the above.

-mike

> HTH,
>
> - Chris
>
>
>
> --
>
> Christopher Barker, Ph.D.
> Oceanographer
>
> Emergency Response Division
> NOAA/NOS/OR&R            (206) 526-6959   voice
> 7600 Sand Point Way NE   (206) 526-6329   fax
> Seattle, WA  98115       (206) 526-6317   main reception
>
> Chris.Barker at noaa.gov
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


More information about the Pythonmac-SIG mailing list