Tempel
Active Member
Cross posted from gp32x.
Dear everyone,
If you're a Python developer, you're probably aware that Distutils is the standard mechanism for distributing Python software. As long as you have a well-made setup script, you can distribute the sources, install to root or home, create an RPM, or, with the right extensions, package it just about any way else.
distPND is a Distutils extension I've created to build PND and PXML files easily. It provides two commands: gen_pxml will slap together a PXML file based on parameters in the setup script and command-line options, while bdist_pnd will assemble your project into a PND file (calling gen_pxml if it needs a PXML file).
To use it, download the sources from its github page and install like any Python package (sudo python setup.py install). After that, you can use the commands with any other Distutils-based setup script by specifying distpnd in command-packages (ie: "python setup.py --command-packages distpnd [command]", or make a setup.cfg file with "command-packages=distpnd" included under the "global" heading). To make iso- or squash-based PNDs, you'll need to have mkisofs or mksquashfs (respectively) available. Even without those, though, you can make a folder that will be read by libpnd.
So far, it works pretty well, but it's kind of hackish and somewhat limited. I'm hoping my fellow Python devs will take distPND for a ride and abuse the crap out of it. Tell me where it breaks or could behave more nicely and I'll fix it up. Or, if you're feeling generous, send along some patches. Some things to note:
As an example of how it works, I've packed up my opus; you can download the sources to see how setup.py and setup.cfg work, or you can download the resulting PND to see the results (with no Pandora, I can't actually confirm that this works, so please don't laugh at me if it fails!).
Have fun everyone! I look forward to hearing back from you.
PS: If your package includes extension modules written in a compiled language (C or Cython or whatever), they'll need to be built for the Pandora. You could just run the whole build process on the Pandora, but if you can make cross-compiling work through the build command, then it should be no additional effort to make it work with bdist_pnd. You might want to take a look at distutilscross to help with this.
PPS: You might also be interested in stdeb, a Distutils extension to build deb packages. Since debs are identical to ipks, this would allow you to build PNDs and Pandora-installable ipks from the same build script! I find that exciting.
Dear everyone,
If you're a Python developer, you're probably aware that Distutils is the standard mechanism for distributing Python software. As long as you have a well-made setup script, you can distribute the sources, install to root or home, create an RPM, or, with the right extensions, package it just about any way else.
distPND is a Distutils extension I've created to build PND and PXML files easily. It provides two commands: gen_pxml will slap together a PXML file based on parameters in the setup script and command-line options, while bdist_pnd will assemble your project into a PND file (calling gen_pxml if it needs a PXML file).
To use it, download the sources from its github page and install like any Python package (sudo python setup.py install). After that, you can use the commands with any other Distutils-based setup script by specifying distpnd in command-packages (ie: "python setup.py --command-packages distpnd [command]", or make a setup.cfg file with "command-packages=distpnd" included under the "global" heading). To make iso- or squash-based PNDs, you'll need to have mkisofs or mksquashfs (respectively) available. Even without those, though, you can make a folder that will be read by libpnd.
So far, it works pretty well, but it's kind of hackish and somewhat limited. I'm hoping my fellow Python devs will take distPND for a ride and abuse the crap out of it. Tell me where it breaks or could behave more nicely and I'll fix it up. Or, if you're feeling generous, send along some patches. Some things to note:
- Almost none of this respects the dry-run flag. It shouldn't make any system changes, but watch out for that.
- gen_pxml does not nearly expose all the functionality in a PXML. Is there an elegant way to include associations, multiple applications, and multilingual titles and descriptions? One solution might be to have PXML templates; can you concoct a good approach to doing that?
- bdist_pnd doesn't yet check that it's not overwriting existing files. Again, watch out.
- If you have an icon or info file to include, bdist_pnd expects that file will make its own way into the build_pnd folder (presumably during the "install" portion of the job). Is there a better way to handle this? I think I've solved this pretty well. If you tell bdist_pnd about your icon and info, it ensures they end up in the root of the PND and in your PXML. I've updated the Lonely Tower sources to show two different ways to do it.
As an example of how it works, I've packed up my opus; you can download the sources to see how setup.py and setup.cfg work, or you can download the resulting PND to see the results (with no Pandora, I can't actually confirm that this works, so please don't laugh at me if it fails!).
Have fun everyone! I look forward to hearing back from you.
PS: If your package includes extension modules written in a compiled language (C or Cython or whatever), they'll need to be built for the Pandora. You could just run the whole build process on the Pandora, but if you can make cross-compiling work through the build command, then it should be no additional effort to make it work with bdist_pnd. You might want to take a look at distutilscross to help with this.
PPS: You might also be interested in stdeb, a Distutils extension to build deb packages. Since debs are identical to ipks, this would allow you to build PNDs and Pandora-installable ipks from the same build script! I find that exciting.
Last edited by a moderator: