3

I'm a fan of Ruby but I don't oppose Python. ( I have 2+ years of Ruby experience and maybe 2 months of Python ).

Anyway, I need to create a service for both the Mac and Windows (and Linux, actually) that takes certain files from different directories and sends them to S3. I could use .NET on Windows but I don't want to use Objective-C and I would love to keep my code-base the same on all platforms.

So after digging around a little, it looks like I should be able to compile either Ruby or Python to byte-code and distribute an interpreter to run the code.

But, am I wrong in assuming that Python has better support for compiling code? As in .pyc byte code?

Also, I would prefer the end user not be able to read my source code but I'm not going to the end of the world to try and stop them.

Thanks!

cbmeeks
  • 11,248
  • 22
  • 85
  • 136
  • 2
    Possible dup of http://stackoverflow.com/questions/940149/distributing-ruby-python-desktop-apps; essentially py2exe and OCRA perform equivalent tasks. – SimonJ Jan 03 '12 at 02:21
  • I'm not sure this is a duplicate. The linked question is about distributing a ruby/python GUI application without requiring the user to have ruby/python pre-installed. This question is about whether you can distribute ruby/python byte-code without having to distribute the source code. – Ben Jan 03 '12 at 04:41
  • Extra tip: do study how mercurial (and tortoisehg) are packaged in Windows and Linux. They are both in python. And Toroisehg uses PyQT to drive a GUI. – Jesvin Jose Jan 03 '12 at 09:19
  • In addition to tools like OCRA, I believe JRuby also allows you to compile to bytecode. – KChaloux Apr 26 '12 at 17:17

2 Answers2

3

You can indeed distribute Python bytecode (.pyc files) to avoid distributing your Python source code.

According to this answer, some Ruby implementations also support compiling to bytecode.

So it sounds like, depending on which Ruby implementation you pick, you may find very little difference between using Python and Ruby.

Keep in mind that bytecode isn't hard to disassemble, so a motivated user would still be able to find out quite a bit about your program's internals. Using an obfuscator can make it harder (but still not impossible) to reverse engineer your bytecode. This is discussed more in this Python question and this Ruby question.

Community
  • 1
  • 1
Josh Kelley
  • 56,064
  • 19
  • 146
  • 246
0

Use whatever language you know well, I know python and use that to develop windows desktop applications and end user can't distinguish it with say a C# or C++ app

Anurag Uniyal
  • 85,954
  • 40
  • 175
  • 219