Skip to content

Commit

Permalink
Merge branch 'build-in-a-temp-directory'
Browse files Browse the repository at this point in the history
  • Loading branch information
brentvollebregt committed Dec 15, 2018
2 parents d11a86a + 6b056be commit cc698b0
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions auto_py_to_exe/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from tkinter.filedialog import askopenfilename, askdirectory, askopenfilenames
except ImportError:
from tkFileDialog import askopenfilename, askdirectory, askopenfilenames
import atexit
import argparse
import os
import platform
Expand Down Expand Up @@ -104,7 +105,17 @@ def write(self, message):
eel.init(web_path)

# Use the same temporary directory to speed up consecutive builds
temporary_directory = tempfile.TemporaryDirectory()
temporary_directory = tempfile.mkdtemp()


def cleanup():
try:
shutil.rmtree(temporary_directory)
except:
pass


atexit.register(cleanup)


@eel.expose
Expand Down Expand Up @@ -184,11 +195,11 @@ def convert_pre_check(file_path, one_file, output_folder):
def convert(command, output, recursion_limit):
""" Package the executable passing the arguments the user requested """
# Notify the user of the workspace and setup building to it
eel.addOutput("Building in the current instances temporary directory at {}\n".format(temporary_directory.name))
eel.addOutput("Building in the current instances temporary directory at {}\n".format(temporary_directory))
eel.addOutput("To get a new temporary directory, restart this application\n")
dist_path = os.path.join(temporary_directory.name, 'application')
build_path = os.path.join(temporary_directory.name, 'build')
extra_args = ['--distpath', dist_path] + ['--workpath', build_path] + ['--specpath', temporary_directory.name]
dist_path = os.path.join(temporary_directory, 'application')
build_path = os.path.join(temporary_directory, 'build')
extra_args = ['--distpath', dist_path] + ['--workpath', build_path] + ['--specpath', temporary_directory]

# If the Recursion Limit is enabled, set it
if recursion_limit:
Expand Down

0 comments on commit cc698b0

Please sign in to comment.