Question about creating rpms using distutiils

Hi, For a python project at work I would like to start using distuils to build the rpms that currently are being built using gnu make+a custom script. The only problem is that by default the bdist_rpm also packages the '.py' files along with the compiled ".pyc's". For various management related reasons, distribution of the source code is not an option. Could someone please explain (with possibly and example) how to build a pure-pyc-only binary rpm ?? Regards Steve

On Mon, Nov 01, 2004 at 08:56:09PM +0530, Steve wrote:
Hi, For a python project at work I would like to start using distuils to build the rpms that currently are being built using gnu make+a custom script. The only problem is that by default the bdist_rpm also packages the '.py' files along with the compiled ".pyc's". For various management related reasons, distribution of the source code is not an option. Could someone please explain (with possibly and example) how to build a pure-pyc-only binary rpm ??
Before you jump through too many hoops, are you aware of how trivial it is to restore the source from a .pyc file? http://www.crazy-compilers.com/decompyle/ mwa -- Mark W. Alexander slash@dotnetslash.net The contents of this message authored by Mark W. Alexander are released under the Creative Commons Attribution-NonCommercial license. Copyright of quoted materials, if any, are retained by the original author(s). http://creativecommons.org/licenses/by-nc/2.0/

On Monday 01 November 2004 23:26, Steve wrote:
Could someone please explain (with possibly and example) how to build a pure-pyc-only binary rpm ??
Hack this in a wrapper script or something: In %install, after setup.py install --record=INSTALLED_FILES: sed 's/.*\.py$//' < INSTALLED_FILES >BINARY_FILES grep ".py$" INSTALLED_FILES >nukeit.tmp for f in `cat nukeit.tmp`; do rm -f $f done Then change %files: %files -f BINARY_FILES But, then again, distributing pyc is distributing the code too! (The bytecode) have fun, -- -jeff

Thanks Jeff, Mark for your replies. I guess I'll hack something up pon my own, like Jeff suggested. BTW, Yes I am aware that distributing the pyc's are like distributing the source code ...but well, try and explain that to my PHB <sigh> dammit jim, I'm a coder, not a suit. :o) Regards Steve On Tue, 2 Nov 2004 16:43:29 +0800, Jeff Pitman <symbiont@berlios.de> wrote:
On Monday 01 November 2004 23:26, Steve wrote:
Could someone please explain (with possibly and example) how to build a pure-pyc-only binary rpm ??
Hack this in a wrapper script or something:
In %install, after setup.py install --record=INSTALLED_FILES:
sed 's/.*\.py$//' < INSTALLED_FILES >BINARY_FILES
grep ".py$" INSTALLED_FILES >nukeit.tmp for f in `cat nukeit.tmp`; do rm -f $f done
Then change %files:
%files -f BINARY_FILES
But, then again, distributing pyc is distributing the code too! (The bytecode)
have fun, -- -jeff _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org http://mail.python.org/mailman/listinfo/distutils-sig

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, On Thu, Nov 04, 2004 at 04:24:27PM +0530, Steve wrote:
BTW, Yes I am aware that distributing the pyc's are like distributing the source code ...but well, try and explain that to my PHB <sigh>
The simplest solution to this problem is a code obfuscation tool, which is indeed quite effective and easy to use when the tool is not very buggy ;) Pyobfuscate seems to be such a tool, though I have not tested it. Python already has a zip file importer (look for zipimport.c in the Python source). So another solution is to write a custom module importer in C (which is somewhat harder to decompile) that can read encrypted modules. Regards, Bastian PS: there was also a thread on comp.lang.python about this: http://coding.derkeiler.com/Archive/Python/comp.lang.python/2003-10/3659.htm... - -- ,''`. Bastian Kleineidam . calvin (at) debian.org : :' : `. `' GnuPG Schlüssel http://kampfwurst.net/gpgkey.txt `- -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) iD8DBQFBihXTeBwlBDLsbz4RAj/9AJ9gMS9s+l+Zy+ydflBz5DDEIQSGagCfRYVa xmr1tQ09VMgFHMINMsTCG3U= =PHMU -----END PGP SIGNATURE-----
participants (4)
-
Bastian Kleineidam
-
Jeff Pitman
-
Mark W. Alexander
-
Steve