Commit fe877974 authored by carlosperate's avatar carlosperate

Update windows build script to be more verbose.

Also update pack script to not filter compiler python code, which is needed for the windows build.
parent 665ccf54
......@@ -32,48 +32,51 @@ try:
except ImportError:
raise SystemExit("You need to have cefpython3, and py2exe installed!")
# set up directories
project_root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
# Enable the ArdublocklyServer package access the sys path for py2exe to find
sys.path.append(project_root_dir)
exec_folder_name = "arduexec"
script_tag = "[Ardublockly build] "
script_tab = " "
# set up directories
project_root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
executable_dir = os.path.join(project_root_dir, exec_folder_name)
def get_install_folder():
""" Install directory will be folder a folder on project root directory. """
return os.path.join(project_root_dir, exec_folder_name)
def remove_install_dir():
""" Removes the installation folder. """
install_folder = get_install_folder()
if os.path.exists(install_folder):
shutil.rmtree(install_folder)
# Enable the ArdublocklyServer package access the sys path for py2exe to find
sys.path.append(project_root_dir)
def remove_build_dir():
""" Removes the build folder. """
build_folder = os.path.join(os.getcwd(), "build")
if os.path.exists(build_folder):
shutil.rmtree(build_folder)
def remove_directory(dir_to_remove):
""" Removes the a given directory. """
if os.path.exists(dir_to_remove):
print(script_tab + "Removing directory %s" % dir_to_remove)
shutil.rmtree(dir_to_remove)
else:
print(script_tab + "Directory %s was not found." % dir_to_remove)
def get_data_files():
""" Collects the required redistributable dlls and CEF files. """
cef_path = os.path.dirname(cefpython.__file__)
data_files = [
("", ["%s/icudt.dll" % cef_path,
"%s/d3dcompiler_43.dll" % cef_path,
"%s/devtools_resources.pak" % cef_path,
"%s/ffmpegsumo.dll" % cef_path,
("", [
# CEF core library
"%s/libcef.dll" % cef_path,
"%s/cefpython_py27.pyd" % cef_path,
"%s/subprocess.exe" % cef_path,
# ICU data for unicode support
"%s/icudt.dll" % cef_path,
# Angle and Direct3D support
"%s/d3dcompiler_43.dll" % cef_path, # Win XP
"%s/d3dcompiler_46.dll" % cef_path, # Vista and larger
"%s/libEGL.dll" % cef_path,
"%s/libGLESv2.dll" % cef_path,
"%s/subprocess.exe" % cef_path]),
# FFmpeg audio and video support for HTML5 audio and video
"%s/ffmpegsumo.dll" % cef_path,
# WebKit image and inspector resources
"%s/devtools_resources.pak" % cef_path,
"%s/cef.pak" % cef_path]),
# Localized resources
("locales", glob(r"%s/locales/*.*" % cef_path)),
# Microsoft compiler redistributable dlls
("Microsoft.VC90.CRT", glob(r"msvcm90\*.*"))]
return data_files
......@@ -89,7 +92,7 @@ def get_options():
# Py2exe options: http://www.py2exe.org/index.cgi/ListOfOptions
py2exe_options = {
"py2exe": {"dist_dir": get_install_folder(),
"py2exe": {"dist_dir": executable_dir,
"compressed": False,
"bundle_files": 3,
"skip_archive": True,
......@@ -124,12 +127,12 @@ def create_run_batch_file():
Ardublockly application.
"""
batch_text = "@echo off\n" + \
"start %s\start_cef.exe %s" % \
(get_install_folder(), project_root_dir)
"start %s\start_cef.exe \"%%cd%%\"" % exec_folder_name
try:
batch_file = open(("%s/ardublockly_run.bat" % project_root_dir), 'w')
batch_file.write(batch_text)
batch_file.close()
print(script_tab + "Batch file created in %s" % project_root_dir)
except Exception as e:
print("%s\n" % e + script_tab +
"Batch file to run Ardublockly could not be created !")
......@@ -139,19 +142,19 @@ if __name__ == "__main__":
print(script_tag + "Building Ardublockly for Windows.")
print(script_tag + "Removing old build directory.")
remove_build_dir()
remove_directory(os.path.join(os.getcwd(), "build"))
print(script_tag + "Removing old executable directory.")
remove_install_dir()
remove_directory(executable_dir)
print(script_tag + "Building Ardublockly for Linux.")
print(script_tag + "Building Ardublockly using py2exe.")
if len(sys.argv) <= 1:
build_exe(['py2exe'])
else:
build_exe()
print(script_tag + "Removing recent build directory.")
remove_build_dir()
remove_directory(os.path.join(os.getcwd(), "build"))
print(script_tag + "Creating a batch file to launch Ardublockly.")
create_run_batch_file()
......@@ -64,7 +64,7 @@ def copy_ardublockly_folder():
The copy operation ignores a list of directories.
:return: Boolean indicating the success state of the operation.
"""
ignore_pat = ("*.pyc", ".git*", "TestTemp_*", ".svn", "package", ".travis*",
ignore_pat = (".git*", "TestTemp_*", ".svn", "package", ".travis*",
"python-cefpython3*")
if not os.path.exists(copied_project_dir):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment