Commits

Virgil Dupras  committed d0faf91

Added build support for ME in the new waf script (but I haven't converted ME's pref panel to xibless yet).

  • Participants
  • Parent commits 7156e9d
  • Branches xibless

Comments (0)

Files changed (4)

 
 from hscommon import sphinxgen
 from hscommon.build import (add_to_pythonpath, print_and_do, copy_packages, filereplace,
-    get_module_version, move_all, copy_sysconfig_files_for_embed, copy_all, move, copy,
+    get_module_version, move_all, copy_sysconfig_files_for_embed, copy_all, move,
     create_osx_app_structure)
 from hscommon import loc
 
         xibless.generate('cocoa/base/ui/details_panel.py', 'cocoa/autogen/DetailsPanel_UI', localizationTable='Localizable')
     if edition == 'se':
         xibless.generate('cocoa/se/ui/preferences_panel.py', 'cocoa/autogen/PreferencesPanel_UI', localizationTable='Localizable')
-        
+    if edition == 'me':
+        xibless.generate('cocoa/se/ui/preferences_panel.py', 'cocoa/autogen/PreferencesPanel_UI', localizationTable='Localizable')
 
 def build_cocoa(edition, dev):
     ed = lambda s: s.format(edition)
     build_cocoa_proxy_module()
     build_cocoa_bridging_interfaces(edition)
     print("Building the cocoa layer")
-    from pluginbuilder import copy_embeddable_python_dylib, get_python_header_folder, collect_dependencies
+    from pluginbuilder import copy_embeddable_python_dylib, collect_dependencies
     copy_embeddable_python_dylib('build')
-    if not op.exists('build/PythonHeaders'):
-        os.symlink(get_python_header_folder(), 'build/PythonHeaders')
     if not op.exists('build/py'):
         os.mkdir('build/py')
     cocoa_project_path = ed('cocoa/{}')
     filereplace('InfoTemplate.plist', 'Info.plist', version=app_version)
     print("Compiling with WAF")
     os.chdir('..')
-    os.system('{0} waf configure && {0} waf'.format(sys.executable))
+    os.system('{0} waf configure --edition {1} && {0} waf'.format(sys.executable, edition))
     os.chdir('..')
     print("Creating the .app folder")
     image_path = ed('cocoa/{}/dupeguru.icns')
     resources = [image_path, 'cocoa/base/dsa_pub.pem', 'build/dg_cocoa.py',
         'build/py', 'build/help'] + glob.glob('cocoa/base/*.lproj')
     frameworks = ['build/Python', 'cocoalib/Sparkle.framework']
-    create_osx_app_structure('build/dupeGuru.app', 'cocoa/build/dupeGuru', ed('cocoa/{}/Info.plist'),
+    app_path = {
+        'se': 'build/dupeGuru.app',
+        'me': 'build/dupeGuru ME.app',
+        'pe': 'build/dupeGuru PE.app',
+    }[edition]
+    create_osx_app_structure(app_path, 'cocoa/build/dupeGuru', ed('cocoa/{}/Info.plist'),
         resources, frameworks, symlink_resources=dev)
     print("Creating the run.py file")
-    app_path = {
-        'se': 'build/dupeGuru.app',
-        'me': 'build/dupeGuru\\ ME.app',
-        'pe': 'build/dupeGuru\\ PE.app',
-    }[edition]
     tmpl = open('run_template_cocoa.py', 'rt').read()
     run_contents = tmpl.replace('{{app_path}}', app_path)
     open('run.py', 'wt').write(run_contents)

File cocoa/me/InfoTemplate.plist

 	<key>CFBundleDevelopmentRegion</key>
 	<string>English</string>
 	<key>CFBundleExecutable</key>
-	<string>${EXECUTABLE_NAME}</string>
+	<string>dupeGuru</string>
 	<key>CFBundleHelpBookFolder</key>
 	<string>dupeguru_me_help</string>
 	<key>CFBundleHelpBookName</key>
 	<key>CFBundleInfoDictionaryVersion</key>
 	<string>6.0</string>
 	<key>CFBundleName</key>
-	<string>${PRODUCT_NAME}</string>
+	<string>dupeGuru ME</string>
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<key>CFBundleSignature</key>

File cocoa/wscript

 
 def options(opt):
     opt.load('compiler_c python')
+    opt.add_option('--edition', default='se', help="dupeGuru edition to build (se, me pe)")
 
 def configure(conf):
+    if conf.options.edition not in ('se', 'me', 'pe'):
+        conf.options.edition = 'se'
+    print("Building dupeGuru {}".format(conf.options.edition.upper()))
+    conf.env.DGEDITION = conf.options.edition
     # We use clang to compile our app
     conf.env.CC = 'clang'
     # WAF has a "pyembed" feature allowing us to automatically find Python and compile by linking
         'controllers/HSColumns', 'controllers/HSGUIController', 'controllers/HSTable',
         'controllers/HSOutline', 'controllers/HSPopUpList', 'controllers/HSSelectableList']
     cocoalib_src = [cocoalib_node.find_node(usename + '.m') for usename in cocoalib_uses] + cocoalib_node.ant_glob('autogen/*.m')
-    project_folders = ['autogen', 'base', 'se']
+    project_folders = ['autogen', 'base', ctx.env.DGEDITION]
     project_src = sum([ctx.srcnode.ant_glob('%s/*.m' % folder) for folder in project_folders], [])
     
     # Compile

File run_template_cocoa.py

 import os
 
 def main():
-    return os.system('open {{app_path}}')
+    return os.system('open "{{app_path}}"')
 
 if __name__ == '__main__':
     sys.exit(main())