Re: [Pythonmac-SIG] Question about py2app packages and includes options
On Tue, Jul 17, 2012 at 3:49 PM, Michael McCracken wrote: > That makes sense - but as you mention, it seems like there's some > missing functionality. I think so, yes, but it can get the job done. > However, it's no fun if you have a lot of subpackages to add that way. nope -- but for the most part they are picked up by regular imports, anyway. You only need to do this if there are some dynamic importing in your code -- and in that case, it's likely you'll want the whole package anyway. -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.bar...@noaa.gov ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Question about py2app packages and includes options
On Wed, Jul 18, 2012 at 11:14 AM, Chris Barker wrote: > On Tue, Jul 17, 2012 at 3:49 PM, Michael McCracken > wrote: > >> That makes sense - but as you mention, it seems like there's some >> missing functionality. > > I think so, yes, but it can get the job done. > >> However, it's no fun if you have a lot of subpackages to add that way. > > nope -- but for the most part they are picked up by regular imports, > anyway. You only need to do this if there are some dynamic importing > in your code -- and in that case, it's likely you'll want the whole > package anyway. In my (probably unusual) situation, it's not dynamic imports: I have these helper apps that I'm including in the main app bundle. I wanted to have their Frameworks and lib directories just be symlinks to the top level, which then had to have the sum of all the modules. The modules the sub-apps use are picked up and put in the zip just fine when they're built separately, but I need to put those modules in the toplevel .zip. I was looking for a nice way to do that from the options, but that's the specific thing that's missing. That said, the code to just directly merge the zips and lib-dynload directories was pretty straightforward and seems to be working well. If anyone else ever has a similar need, I'd be happy to share it. -mike > > -- > > 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.bar...@noaa.gov ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Question about py2app packages and includes options
On 18 Jul, 2012, at 0:25, Chris Barker wrote: > > > 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 think this is fixed yet, I've added an item to the py2app tracker for this: https://bitbucket.org/ronaldoussoren/py2app/issue/52 Ronald smime.p7s Description: S/MIME cryptographic signature ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Question about py2app packages and includes options
On Tue, Jul 17, 2012 at 5:25 PM, Chris Barker 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.bar...@noaa.gov > ___ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Question about py2app packages and includes options
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. > 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. 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.bar...@noaa.gov ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
[Pythonmac-SIG] Question about py2app packages and includes options
I am trying to package a main .app with helper apps in Main.app/Resources/Helper.app, and I want to have a single Resources/lib directory and a single Frameworks/ directory to cut down on space. So I'm tweaking the main app's includes and packages options to get all the dependencies in one place, and relying on the automatic logic won't work. My question is: why does 'packages' copy the package recursively, but not into the .zip, while 'includes' only gets single modules? I was expecting packages to put the whole package in the .zip, and I didn't find any explanation in the docs. This is a minor point, since it works fine with 'packages' doing what it does, it'd just be nice to get them into the zip. Thanks, -mike ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG