Small fixes to build cura release for windows.

This commit is contained in:
daid 2015-05-07 16:53:35 +02:00
parent 1833e2494a
commit ab6a3041c1

View file

@ -7,6 +7,18 @@ import re
import shutil import shutil
import site import site
# work around the limitation that shutil.copytree does not allow the target directory to exist
def copytree(src, dst, symlinks=False, ignore=None):
if not os.path.exists(dst):
os.makedirs(dst)
for item in os.listdir(src):
s = os.path.join(src, item)
d = os.path.join(dst, item)
if os.path.isdir(s):
copytree(s, d, symlinks, ignore)
else:
shutil.copy2(s, d)
includes = ["sip", "ctypes", "UM", "PyQt5.QtNetwork", "PyQt5._QOpenGLFunctions_2_0", "serial", "Arcus", "google", "google.protobuf", "google.protobuf.descriptor", "xml.etree", "xml.etree.ElementTree", "src"] includes = ["sip", "ctypes", "UM", "PyQt5.QtNetwork", "PyQt5._QOpenGLFunctions_2_0", "serial", "Arcus", "google", "google.protobuf", "google.protobuf.descriptor", "xml.etree", "xml.etree.ElementTree", "src"]
# Include all the UM modules in the includes. As py2exe fails to properly find all the dependencies due to the plugin architecture. # Include all the UM modules in the includes. As py2exe fails to properly find all the dependencies due to the plugin architecture.
for dirpath, dirnames, filenames in os.walk(os.path.dirname(UM.__file__)): for dirpath, dirnames, filenames in os.walk(os.path.dirname(UM.__file__)):
@ -42,8 +54,7 @@ for path in os.listdir("plugins"):
shutil.copytree("plugins/" + path, "dist/plugins/" + path) shutil.copytree("plugins/" + path, "dist/plugins/" + path)
print("Coping resources.") print("Coping resources.")
shutil.copytree(os.path.dirname(UM.__file__) + "/../resources", "dist/resources") shutil.copytree(os.path.dirname(UM.__file__) + "/../resources", "dist/resources")
shutil.copytree("resources/qml", "dist/resources/qml") copytree("resources", "dist/resources")
shutil.copytree("resources/themes", "dist/resources/themes")
print("Coping Uranium QML.") print("Coping Uranium QML.")
shutil.copytree(os.path.dirname(UM.__file__) + "/Qt/qml/UM", "dist/qml/UM") shutil.copytree(os.path.dirname(UM.__file__) + "/Qt/qml/UM", "dist/qml/UM")
for site_package in site.getsitepackages(): for site_package in site.getsitepackages():
@ -56,4 +67,3 @@ for site_package in site.getsitepackages():
shutil.copytree(os.path.join(qt_origin_path, "qml/QtQuick.2"), "dist/qml/QtQuick.2") shutil.copytree(os.path.join(qt_origin_path, "qml/QtQuick.2"), "dist/qml/QtQuick.2")
print("Coping PyQt5 svg library from: %s" % qt_origin_path) print("Coping PyQt5 svg library from: %s" % qt_origin_path)
shutil.copy(os.path.join(qt_origin_path, "Qt5Svg.dll"), "dist/Qt5Svg.dll") shutil.copy(os.path.join(qt_origin_path, "Qt5Svg.dll"), "dist/Qt5Svg.dll")
os.rename("dist/printer.exe", "dist/Cura.exe")