diff --git a/.gitignore b/.gitignore index 2bd3ae3..6b14fc8 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ printrun.bat cura.bat object-mirror.png object.png +build/* +dist/* diff --git a/scripts/osx64/Cura.app/Contents/Resources/Cura.icns b/Cura/Cura.icns similarity index 100% rename from scripts/osx64/Cura.app/Contents/Resources/Cura.icns rename to Cura/Cura.icns diff --git a/Cura/setup.py b/Cura/setup.py deleted file mode 100644 index e077f67..0000000 --- a/Cura/setup.py +++ /dev/null @@ -1,61 +0,0 @@ -import sys, os, zipfile -try: - import cx_Freeze -except: - print "ERROR: You need cx-Freeze installed to build this package" - sys.exit(1) - -freezeVersion = map(int, cx_Freeze.version.split('.')) -if freezeVersion[0] < 4 or freezeVersion[0] == 4 and freezeVersion[1] < 2: - print "ERROR: Your cx-Freeze version is too old to use with Cura." - sys.exit(1) - -sys.path.append(os.path.abspath('cura_sf')) - -# Dependencies are automatically detected, but it might need fine tuning. -build_exe_options = { -"silent": True, -"packages": [ - 'encodings.utf_8', - "OpenGL", "OpenGL.arrays", "OpenGL.platform", "OpenGL.GLU", -], "excludes": [ - 'Tkinter', 'tcl', 'cura_sf', 'fabmetheus_utilities', 'skeinforge_application', 'numpy', -], "include_files": [ - ('images', 'images'), -], "build_exe": 'freeze_build'} - -# GUI applications require a different base on Windows (the default is for a -# console application). -base = None -if sys.platform == "win32": - base = "Win32GUI" - -cx_Freeze.setup( name = "Cura", - version = "RC5", - description = "Cura", - options = {"build_exe": build_exe_options}, - executables = [cx_Freeze.Executable("cura.py", base=base)]) - -m = cx_Freeze.ModuleFinder(excludes=["gui"]) -m.IncludeFile(os.path.abspath("cura.py")) -m.IncludeFile(os.path.abspath("cura_sf/skeinforge_application/skeinforge_plugins/profile_plugins/extrusion.py")) -m.IncludeFile(os.path.abspath("cura_sf/fabmetheus_utilities/fabmetheus_tools/interpret_plugins/stl.py")) -m.IncludeFile(os.path.abspath("cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins/export_plugins/static_plugins/gcode_small.py")) -for name in os.listdir("cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins"): - if name.endswith('.py'): - m.IncludeFile(os.path.abspath("cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins/" + name)) -m.ReportMissingModules() -cwd = os.path.abspath(".") - -z = zipfile.ZipFile("freeze_build/cura_sf.zip", "w", zipfile.ZIP_DEFLATED) -for mod in m.modules: - if mod.file != None and mod.file.startswith(cwd): - if mod.file[len(cwd)+1:] == "cura.py": - z.write(mod.file[len(cwd)+1:], "__main__.py") - else: - z.write(mod.file[len(cwd)+1:]) -z.write('cura_sf/fabmetheus_utilities/templates/layer_template.svg') -z.write('cura_sf/fabmetheus_utilities/version.txt') -z.write('__init__.py') -z.close() - diff --git a/scripts/osx64/Cura.app/Contents/Info.plist b/scripts/osx64/Cura.app/Contents/Info.plist deleted file mode 100644 index 856d01b..0000000 --- a/scripts/osx64/Cura.app/Contents/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleName - Cura - CFBundleDisplayName - Cura 12.10 - CFBundleIdentifer - daid.cura - CFBundleIconFile> - Resources/Cura.icns - CFBundleVersion - 12.10 - CFBundlePackageType - APPL - CFBundleSignature - ???? - CFBundleExecutable - Cura - - diff --git a/scripts/osx64/Cura.app/Contents/MacOS/Cura b/scripts/osx64/Cura.app/Contents/MacOS/Cura deleted file mode 100755 index e662bd4..0000000 --- a/scripts/osx64/Cura.app/Contents/MacOS/Cura +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/sh - -SCRIPTDIR=`dirname "$0"` -RESDIR=${SCRIPTDIR}/../Resources/ -PKGDIR=${SCRIPTDIR}/../Pkgs/ - -#run the path_helper to set the $PATH for accessing python -if [ -x /usr/libexec/path_helper ]; then - eval `/usr/libexec/path_helper -s` -fi - -displayMessage() -{ - /usr/bin/osascript > /dev/null <<-EOF -tell application "System Events" - activate - display dialog "$@" buttons {"Ok"} -end tell -EOF -} - -#Testing for python2.7, which we need and is not always installed on MacOS 1.6 -PY="python2.7" -$PY -c '' -if [ $? != 0 ]; then - displayMessage "Python 2.7 is missing from your system. Cura requires Python2.7.\nStarting the installer" $PATH - # Install python2.7 - hdiutil attach $PKGDIR/python-2.7.3-macosx10.6.dmg - open -W /Volumes/Python\ 2.7.3/Python.mpkg - hdiutil detach /Volumes/Python\ 2.7.3 - # Check the installation - $PY -c '' - if [ $? != 0 ]; then - displayMessage "Failed to install python2.7" - exit 1 - fi -fi - -#Next check for numpy, numpy does not always run under 64bit, so we need to check if we need to use "arch -i386" -$PY -c 'import numpy' 2> /dev/null -if [ $? != 0 ]; then - PY="arch -i386 python2.7" - $PY -c 'import numpy' - if [ $? != 0 ]; then - displayMessage "Numpy is missing from your system, this is required.\nStarting the installer" - # Install numpy - hdiutil attach $PKGDIR/numpy-1.6.2-py2.7-python.org-macosx10.3.dmg - open -W /Volumes/numpy/numpy-1.6.2-py2.7.mpkg - hdiutil detach /Volumes/numpy - #After installing numpy, we need to check if we need to use arch -386 again - PY="python2.7" - $PY -c 'import numpy' - if [ $? != 0 ]; then - PY="arch -i386 python2.7" - $PY -c 'import numpy' - if [ $? != 0 ]; then - displayMessage "Failed to install numpy." - exit 1 - fi - fi - fi -fi - -#Check for wxPython -$PY -c 'import wx' -if [ $? != 0 ]; then - displayMessage "wxPython is missing from your system. Cura requires wxPython.\nStarting the installer" - # Start wxPython installer - hdiutil attach $PKGDIR/wxPython2.9-osx-2.9.4.0-cocoa-py2.7.dmg - open -W /Volumes/wxPython2.9-osx-2.9.4.0-cocoa-py2.7/wxPython2.9-osx-cocoa-py2.7.pkg - hdiutil detach /Volumes/wxPython2.9-osx-2.9.4.0-cocoa-py2.7 - #Check if wxPython is installed correctly - $PY -c 'import wx' - if [ $? != 0 ]; then - displayMessage "Failed to properly install wxPython." - exit 1 - fi -fi - -#Check for PyOpenGL -$PY -c 'import OpenGL' -if [ $? != 0 ]; then - # Unpackage PyOpenGL - if [ ! -d "$PKGDIR/PyOpenGL-3.0.2/build/lib" ]; then - cd $PKGDIR - tar -xzf PyOpenGL-3.0.2.tar.gz - cd PyOpenGL-3.0.2 - $PY setup.py build - fi - export PYTHONPATH="$PYTHONPATH:$PKGDIR/PyOpenGL-3.0.2/build/lib" - # Test if the installation was succesful - echo $PYTHONPATH - $PY -c 'import OpenGL' - if [ $? != 0 ]; then - displayMessage "Failed to properly use PyOpenGL." - exit 1 - fi -fi - -#Check for pyserial -$PY -c 'import serial' -if [ $? != 0 ]; then - #Unpackage PySerial - if [ ! -d "$PKGDIR/pyserial-2.6/build/lib" ]; then - cd $PKGDIR - tar -xzf pyserial-2.6.tar.gz - cd pyserial-2.6 - $PY setup.py build - fi - export PYTHONPATH="$PYTHONPATH:$PKGDIR/pyserial-2.6/build/lib" - - #Test if we have pyserial now - $PY -c 'import serial' - if [ $? != 0 ]; then - displayMessage "Failed to properly use PySerial." - exit 1 - fi -fi - -#All checks passed, start Cura -$PY "${RESDIR}Cura/cura.py" & -sleep 1 - -exit 0 diff --git a/scripts/osx64/Cura.app/Contents/PkgInfo b/scripts/osx64/Cura.app/Contents/PkgInfo deleted file mode 100644 index bd04210..0000000 --- a/scripts/osx64/Cura.app/Contents/PkgInfo +++ /dev/null @@ -1 +0,0 @@ -APPL???? \ No newline at end of file diff --git a/scripts/osx64/DmgTemplateCompressed.dmg b/scripts/osx64/DmgTemplateCompressed.dmg deleted file mode 100644 index e982f21..0000000 Binary files a/scripts/osx64/DmgTemplateCompressed.dmg and /dev/null differ diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..bcd181f --- /dev/null +++ b/setup.py @@ -0,0 +1,143 @@ +# coding=utf-8 + +import sys +import os + +if sys.platform.startswith('darwin'): + from setuptools import setup + + APP = ['Cura/cura.py'] + DATA_FILES = ['Cura/images', 'Cura/LICENSE', 'Cura/stl.ico'] + PLIST = { + u'CFBundleName': u'Cura', + u'CFBundleShortVersionString': u'12.11', + u'CFBundleVersion': u'12.11', + u'CFBundleIdentifier': u'com.ultimaker.Cura', + u'LSMinimumSystemVersion': u'10.6', + u'LSApplicationCategoryType': u'public.app-category.graphics-design', + u'CFBundleDocumentTypes': [ + { + u'CFBundleTypeRole': u'Viewer', + u'LSItemContentTypes': [u'com.pleasantsoftware.uti.stl'], + u'LSHandlerRank': u'Alternate', + }, + { + u'CFBundleTypeRole': u'Viewer', + u'LSItemContentTypes': [u'org.khronos.collada.digital-asset-exchange'], + u'LSHandlerRank': u'Alternate' + }, + { + u'CFBundleTypeName': u'Stereo Lithography 3D Object', + u'CFBundleTypeExtensions': [u'stl'], + u'CFBundleTypeMIMETypes': [u'text/plain'], + u'CFBundleTypeRole': u'Viewer', + u'LSHandlerRank': u'Alternate' + }, + { + u'CFBundleTypeName': u'Wavefront 3D Object', + u'CFBundleTypeExtensions': [u'obj'], + u'CFBundleTypeMIMETypes': [u'application/obj-3d'], + u'CFBundleTypeRole': u'Viewer', + u'LSHandlerRank': u'Alternate' + }, + { + u'CFBundleTypeName': u'Digital Asset Exchange (DAE)', + u'CFBundleTypeExtensions': [u'dae'], + u'CFBundleTypeMIMETypes': [u'model/vnd.collada+xml'], + u'CFBundleTypeRole': u'Viewer', + u'LSHandlerRank': u'Alternate' + } + ], + u'UTImportedTypeDeclarations': [ + { + u'UTTypeIdentifier': u'com.pleasantsoftware.uti.stl', + u'UTTypeConformsTo': [u'public.data'], + u'UTTypeDescription': u'Stereo Lithography 3D object', + u'UTTypeReferenceURL': u'http://en.wikipedia.org/wiki/STL_(file_format)', + u'UTTypeTagSpecification:': {u'public.filename-extension': [u'stl']} + }, + { + u'UTTypeIdentifier': u'org.khronos.collada.digital-asset-exchange', + u'UTTypeConformsTo': [u'public.xml', u'public.audiovisual-content'], + u'UTTypeDescription': u'Digital Asset Exchange (DAE)', + u'UTTypeTagSpecification': {u'public.filename-extension': [u'dae']} + } + ] + } + OPTIONS = { + 'argv_emulation': True, + 'iconfile': 'Cura/Cura.icns', + 'includes': ['objc', 'Foundation'], + 'resources': DATA_FILES, + 'optimize': '2', + 'plist': PLIST + } + + setup( + name="Cura", + app=APP, + data_files=DATA_FILES, + options={'py2app': OPTIONS}, + setup_requires=['py2app'], + ) +else: + import zipfile + try: + import cx_Freeze + except: + print "ERROR: You need cx-Freeze installed to build this package" + sys.exit(1) + + freezeVersion = map(int, cx_Freeze.version.split('.')) + if freezeVersion[0] < 4 or freezeVersion[0] == 4 and freezeVersion[1] < 2: + print "ERROR: Your cx-Freeze version is too old to use with Cura." + sys.exit(1) + + sys.path.append(os.path.abspath('cura_sf')) + + # Dependencies are automatically detected, but it might need fine tuning. + build_exe_options = { + "silent": True, + "packages": [ + 'encodings.utf_8', + "OpenGL", "OpenGL.arrays", "OpenGL.platform", "OpenGL.GLU", + ], "excludes": [ + 'Tkinter', 'tcl', 'cura_sf', 'fabmetheus_utilities', 'skeinforge_application', 'numpy', + ], "include_files": [ + ('images', 'images'), + ], "build_exe": 'freeze_build'} + + # GUI applications require a different base on Windows (the default is for a + # console application). + base = None + if sys.platform == "win32": + base = "Win32GUI" + + cx_Freeze.setup( name = "Cura", + version = "RC5", + description = "Cura", + options = {"build_exe": build_exe_options}, + executables = [cx_Freeze.Executable("cura.py", base=base)]) + + m = cx_Freeze.ModuleFinder(excludes=["gui"]) + m.IncludeFile(os.path.abspath("cura.py")) + m.IncludeFile(os.path.abspath("cura_sf/skeinforge_application/skeinforge_plugins/profile_plugins/extrusion.py")) + m.IncludeFile(os.path.abspath("cura_sf/fabmetheus_utilities/fabmetheus_tools/interpret_plugins/stl.py")) + m.IncludeFile(os.path.abspath("cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins/export_plugins/static_plugins/gcode_small.py")) + for name in os.listdir("cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins"): + if name.endswith('.py'): + m.IncludeFile(os.path.abspath("cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins/" + name)) + m.ReportMissingModules() + cwd = os.path.abspath(".") + + z = zipfile.ZipFile("freeze_build/cura_sf.zip", "w", zipfile.ZIP_DEFLATED) + for mod in m.modules: + if mod.file != None and mod.file.startswith(cwd): + if mod.file[len(cwd)+1:] == "cura.py": + z.write(mod.file[len(cwd)+1:], "__main__.py") + else: + z.write(mod.file[len(cwd)+1:]) + z.write('cura_sf/fabmetheus_utilities/templates/layer_template.svg') + z.write('cura_sf/fabmetheus_utilities/version.txt') + z.write('__init__.py') + z.close()