1

I'm looking for a way to make my python script truly portable and self dependent.

I'm writing application that should run both on linux and on windows (that means all dependencies are portable and contain no C/C++ code that should be compiled) and I want it to be distributed as a script (meaning pyinstaller and py2exe are no good)

The expected behavior is as follows:

  1. there is a python executable (one for windows and one for linux)

  2. there is a folder that contains my script + dependencies (already downloaded)

My question: Is there a 'best practice way' to build 1 and 2?

I'm looking a solution that is similar to java architecture and dependency management.

Martin Tournoij
  • 24,971
  • 24
  • 101
  • 136
Vitali Bichov
  • 978
  • 1
  • 11
  • 26
  • Have you tried setuptools? https://pythonhosted.org/setuptools/setuptools.html#building-and-distributing-packages-with-setuptools – Alessandro Suglia Aug 19 '14 at 08:30
  • If you just download all the included modules/packages into the folder it should work fine... There is functionality built into python to create self extracting, executable archives, but the way they work on Linux and Windows I believe are different - on Linux I think it has to run python twice to be able to link to all the extracted files, but only once on Windows. That should be taken care of for you though. Read here:http://www.pyinstaller.org/export/develop/project/doc/Manual.html I've never tried to open a pyinstaller binary made on Unix on Windows, but are you sure it doesn't work? – will Aug 19 '14 at 08:39
  • I actually did try to open it. As far as I understand pyinstaller compiles python into bytecode, you could extract it and then decompile the bytecode but that would miss the point. – Vitali Bichov Aug 19 '14 at 10:15
  • to @Alessandro Suglia: I actually looked both on setuptools and distutils. Both of them don't do what I need out of the box. I could write something proprietary but that, again, would miss the point. – Vitali Bichov Aug 19 '14 at 10:18

0 Answers0