chiark / gitweb /
Update build_app.py to use proper versions, maybe this fixes the random Mac bugs...
[cura.git] / build_app.py
1 # coding=utf-8
2 import sys
3 import os
4
5 if sys.platform.startswith('darwin'):
6     from setuptools import setup
7
8     try:
9         f = open('scripts/darwin/dist/Cura.app/Contents/Resources/version', 'r')
10         version = unicode(f.readline().strip())
11         f.close()
12     except IOError:
13         version = 'Unknown'
14
15     APP = ['Cura/cura.py']
16     DATA_FILES = ['Cura/LICENSE', 'Cura/resources/images', 'Cura/resources/meshes', 'Cura/resources/example', 'Cura/resources/firmware', 'Cura/resources/locale', 'Cura/resources/machine_profiles']
17     PLIST = {
18         u'CFBundleName': u'Cura-'+version,
19         u'CFBundleShortVersionString': version,
20         u'CFBundleVersion': version,
21         u'CFBundleIdentifier': u'com.ultimaker.Cura-'+version,
22         u'LSMinimumSystemVersion': u'10.6',
23         u'LSApplicationCategoryType': u'public.app-category.graphics-design',
24         u'CFBundleDocumentTypes': [
25             {
26                 u'CFBundleTypeRole': u'Viewer',
27                 u'LSItemContentTypes': [u'com.pleasantsoftware.uti.stl'],
28                 u'LSHandlerRank': u'Owner',
29                 },
30             {
31                 u'CFBundleTypeRole': u'Viewer',
32                 u'LSItemContentTypes': [u'org.khronos.collada.digital-asset-exchange'],
33                 u'LSHandlerRank': u'Owner'
34             },
35             {
36                 u'CFBundleTypeName': u'Wavefront 3D Object',
37                 u'CFBundleTypeExtensions': [u'obj'],
38                 u'CFBundleTypeMIMETypes': [u'application/obj-3d'],
39                 u'CFBundleTypeRole': u'Viewer',
40                 u'LSHandlerRank': u'Owner'
41             }
42         ],
43         u'UTImportedTypeDeclarations': [
44             {
45                 u'UTTypeIdentifier': u'com.pleasantsoftware.uti.stl',
46                 u'UTTypeConformsTo': [u'public.data'],
47                 u'UTTypeDescription': u'Stereo Lithography 3D object',
48                 u'UTTypeReferenceURL': u'http://en.wikipedia.org/wiki/STL_(file_format)',
49                 u'UTTypeTagSpecification': {u'public.filename-extension': [u'stl'], u'public.mime-type': [u'text/plain']}
50             },
51             {
52                 u'UTTypeIdentifier': u'org.khronos.collada.digital-asset-exchange',
53                 u'UTTypeConformsTo': [u'public.xml', u'public.audiovisual-content'],
54                 u'UTTypeDescription': u'Digital Asset Exchange (DAE)',
55                 u'UTTypeTagSpecification': {u'public.filename-extension': [u'dae'], u'public.mime-type': [u'model/vnd.collada+xml']}
56             },
57             {
58                 u'UTTypeIdentifier': u'com.ultimaker.obj',
59                 u'UTTypeConformsTo': [u'public.data'],
60                 u'UTTypeDescription': u'Wavefront OBJ',
61                 u'UTTypeReferenceURL': u'https://en.wikipedia.org/wiki/Wavefront_.obj_file',
62                 u'UTTypeTagSpecification': {u'public.filename-extension': [u'obj'], u'public.mime-type': [u'text/plain']}
63             },
64             {
65                 u'UTTypeIdentifier': u'com.ultimaker.amf',
66                 u'UTTypeConformsTo': [u'public.data'],
67                 u'UTTypeDescription': u'Additive Manufacturing File',
68                 u'UTTypeReferenceURL': u'https://en.wikipedia.org/wiki/Additive_Manufacturing_File_Format',
69                 u'UTTypeTagSpecification': {u'public.filename-extension': [u'amf'], u'public.mime-type': [u'text/plain']}
70             }
71         ]
72     }
73     OPTIONS = {
74         'argv_emulation': True,
75         'iconfile': 'Cura/resources/Cura.icns',
76         'includes': ['objc', 'Foundation'],
77         'resources': DATA_FILES,
78         'optimize': '2',
79         'plist': PLIST,
80         'bdist_base': 'scripts/darwin/build',
81         'dist_dir': 'scripts/darwin/dist'
82     }
83
84     setup(
85         name="Cura",
86         app=APP,
87         data_files=DATA_FILES,
88         options={'py2app': OPTIONS},
89         setup_requires=['py2app']
90     )
91 else:
92    print 'No build_app implementation for your system.'