The ps3 theme compiler available here was written in Python and turned into a Windows executable using "py2exe". If you take p3tcompiler.exe and extract 1705167 bytes starting at offset 2165248 then you get a zip file containing the compiled Python 2.5 code (.pyo).
I haven't managed to get it to run on Linux, because of some character set nonsense, but it should be doable. My python2.5 also seems to have some trouble finding modules named .pyo, but deals with .pyc, so I tested with something like:
for i in $(find . -name '*.pyo'); do ln -sf $(basename $i) ${i%%pyo}pyc ; done
python2.5 ./p3tcompiler.pyc sample/01/sample.xml
There are online services that will decompile Python 2.5 .pyo for money, but I think free tools only go up to 2.3.
Sure, the first step would be to decompile the pyo and figure out how it works. I don't know enough about python bytecode to extend "decompyler" to work with 2.5..
Ive replicated your steps(partly independant). I also found out that the program packs all the files at the end, so i managed to inject a file of my own after the conversion to gim. I analysed it with a hex editor and found out that the beginning part(the strange pattern) the changes are minor. I think files are recognizable with 78 DA DD hex codes. For example in the example theme icon.gim is at offset 243Co, so a comparison can be made. I found out that the file got bigger, this is kind of strange since the complete record of gim's is bigger than the p3t file.(i probably made a mistake but the rest of the resulting p3t file is identical to the standard one)So there must be some kind of compression, but i couldnt find out which one, winrar doesnt recognize the resulting file. Maybe some kind of custom compression? But then it might be possible this is also used in pkg files or other ps3 related files so it would really help is somebody figured out how to decompile the pyo files that are found in the p3tcompiler.exe.