LSL-PyOptimizer icon indicating copy to clipboard operation
LSL-PyOptimizer copied to clipboard

Setup pre-compiled binaries for different platforms [Enhancement]

Open jfmherokiller opened this issue 6 years ago • 3 comments

I was wondering if you had any plans for say pre-made binaries that the user could just download and run?

I locally setup a setup a working singlefile py2exe setup.py (using 32bit 2.7 python) and I edited main.py to correctly support the difference in the zip below. LSL-PyOptimizer.zip

the specifics of the change to main.py are here

def main(argv):
    """Main executable."""
+    import os
+
+    if hasattr(sys,"frozen") and sys.frozen in ("windows_exe", "console_exe"):
+       lslopt.lslcommon.DataPath=(os.path.dirname(os.path.abspath(sys.executable)) + os.sep)
+   else:
    # If it's good to append the basename to it, it's good to append the
    # auxiliary files' names to it, which should be located where this file is.
        lslopt.lslcommon.DataPath = __file__[:-len(os.path.basename(__file__))]

jfmherokiller avatar Nov 05 '19 16:11 jfmherokiller

Thanks for the patch. I don't plan to offer executables; the only supported execution format is downloading and running the interpreter. However, I don't mind including a patch that makes it easier for third parties to create executables, as long as it's well understood that I don't endorse them and I explicitly refuse any responsibility about them.

Note that os is already imported, so you don't need to re-import it

Please let me know what license terms you want to apply to your contribution, or if you accept placing these changes under the same GPL3 license terms as the rest of the code, as well as under what name you want to be credited. A pull request is preferred, but I can deal with the above patch otherwise.

Edit: Do I understand it right that setup.py does not need to import py2exe or os?

Sei-Lisa avatar Nov 05 '19 17:11 Sei-Lisa

I accept the same license as the project. yes if you want to build a single exe file you need to import py2exe atleast for my method. I chose the py2exe route because I don't know how to setup setup.py for a normal command line utility using setup tools or such. my real end goal was to make a setup.py that you could just do python2 setup.py install and have a working command line utility.

jfmherokiller avatar Nov 08 '19 14:11 jfmherokiller

Also side note I might try to see if I can make basic continuous integration setup just in case in the future if self contained binaries are desired we will have a system in place. ( This is for possibly vscode extensions or extensions for other editors who wish to use this project as either a optimizer or just a simple linter (eg being able to check if the code is syntaticly valid before releasing it)

jfmherokiller avatar Nov 08 '19 14:11 jfmherokiller