Ejemplo n.º 1
0
        public static Executable BuildExeX64(IPythonScript script, bool windowed = false, string additionalPyInstallerArguments = "")
        {
            // Requires Windows,
            // Requires a 64-bit install of python

            throw new NotImplementedException();
        }
Ejemplo n.º 2
0
 public void Execute(IPythonScript script)
 {
     try
     {
         script.Run(_pythonPath);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Ejemplo n.º 3
0
        public static Executable BuildExeX86(IPythonScript script, bool windowed = false, string additionalPyInstallerArguments = "")
        {
            // TODO: Verify that we are running on Windows and that 32-bit python is available (PyInstaller output is dependent on the OS & Architecture)

            using (new TemporaryContext())
            {
                var scriptText = script.Text;
                scriptText += "\r\n#" + Utils.RandomString(10); // non-functional change that will result in the compiled exe having a varying hash
                File.WriteAllText("input.py", scriptText);
                try
                {
                    Process.Start("pyinstaller", "--onefile " + (windowed ? " --windowed " : "") + additionalPyInstallerArguments + " input.py").WaitForExit();
                }
                catch (System.ComponentModel.Win32Exception e)
                {
                    throw new MissingDependencyException("PyInstaller");
                }
                var exeBytes = File.ReadAllBytes(Path.Join("dist", "input.exe"));
                return(new Executable(exeBytes));
            }
        }