def build_cocoa(dev): if not dev: print("Building help index") help_path = op.abspath('help/musicguru_help') os.system('open -a /Developer/Applications/Utilities/Help\\ Indexer.app {0}'.format(help_path)) print("Building mg_cocoa.plugin") if op.exists('build'): shutil.rmtree('build') os.mkdir('build') if not dev: copy_packages(['core', 'hsaudiotag', 'hsfs', 'hscommon', 'jobprogress'], 'build') shutil.copy('cocoa/mg_cocoa.py', 'build') os.chdir('build') script_args = ['py2app', '-A'] if dev else ['py2app'] setup( script_args = script_args, plugin = ['mg_cocoa.py'], setup_requires = ['py2app'], ) os.chdir('..') if op.exists('cocoa/mg_cocoa.plugin'): shutil.rmtree('cocoa/mg_cocoa.plugin') shutil.move('build/dist/mg_cocoa.plugin', 'cocoa/mg_cocoa.plugin') if dev: # In alias mode, the tweakings we do to the pythonpath aren't counted in. We have to # manually put a .pth in the plugin pluginpath = 'cocoa/mg_cocoa.plugin' pthpath = op.join(pluginpath, 'Contents/Resources/dev.pth') open(pthpath, 'w').write(op.abspath('.')) os.chdir('cocoa') print("Building the XCode project") os.system('xcodebuild') os.chdir('..')
def build_cocoa(dev): sparkle_framework_path = op.join('cocoa', 'Sparkle', 'build', 'Release', 'Sparkle.framework') if not op.exists(sparkle_framework_path): print("Building Sparkle") os.chdir(op.join('cocoa', 'Sparkle')) print_and_do('make build') os.chdir(op.join('..', '..')) print("Creating OS X app structure") app = cocoa_app() app_version = get_module_version('core') cocoa_project_path = 'cocoa' filereplace(op.join(cocoa_project_path, 'InfoTemplate.plist'), op.join('build', 'Info.plist'), version=app_version) app.create(op.join('build', 'Info.plist')) print("Building localizations") build_localizations('cocoa') print("Building xibless UIs") build_cocoalib_xibless() build_xibless() print("Building Python extensions") build_cocoa_proxy_module() build_cocoa_bridging_interfaces() print("Building the cocoa layer") copy_embeddable_python_dylib('build') pydep_folder = op.join(app.resources, 'py') if not op.exists(pydep_folder): os.mkdir(pydep_folder) shutil.copy(op.join(cocoa_project_path, 'dg_cocoa.py'), 'build') tocopy = [ 'core', 'hscommon', 'cocoa/inter', 'cocoalib/cocoa', 'objp', 'send2trash', 'hsaudiotag', ] copy_packages(tocopy, pydep_folder, create_links=dev) sys.path.insert(0, 'build') # ModuleFinder can't seem to correctly detect the multiprocessing dependency, so we have # to manually specify it. extra_deps = ['multiprocessing'] collect_stdlib_dependencies('build/dg_cocoa.py', pydep_folder, extra_deps=extra_deps) del sys.path[0] # Views are not referenced by python code, so they're not found by the collector. copy_all('build/inter/*.so', op.join(pydep_folder, 'inter')) if not dev: # Important: Don't ever run delete_files_with_pattern('*.py') on dev builds because you'll # be deleting all py files in symlinked folders. compileall.compile_dir(pydep_folder, force=True, legacy=True) delete_files_with_pattern(pydep_folder, '*.py') delete_files_with_pattern(pydep_folder, '__pycache__') print("Compiling with WAF") os.chdir('cocoa') print_and_do('{0} waf configure && {0} waf'.format(sys.executable)) os.chdir('..') app.copy_executable('cocoa/build/dupeGuru') build_help() print("Copying resources and frameworks") image_path = 'cocoa/dupeguru.icns' resources = [image_path, 'cocoa/dsa_pub.pem', 'build/dg_cocoa.py', 'build/help'] app.copy_resources(*resources, use_symlinks=dev) app.copy_frameworks('build/Python', sparkle_framework_path) print("Creating the run.py file") tmpl = open('cocoa/run_template.py', 'rt').read() run_contents = tmpl.replace('{{app_path}}', app.dest) open('run.py', 'wt').write(run_contents)
def copy_files_to_package(destpath, packages, with_so): # when with_so is true, we keep .so files in the package, and otherwise, we don't. We need this # flag because when building debian src pkg, we *don't* want .so files (they're compiled later) # and when we're packaging under Arch, we're packaging a binary package, so we want them. if op.exists(destpath): shutil.rmtree(destpath) os.makedirs(destpath) shutil.copy("run.py", op.join(destpath, "run.py")) extra_ignores = ["*.so"] if not with_so else None copy_packages(packages, destpath, extra_ignores=extra_ignores) # include locale files if they are built otherwise exit as it will break # the localization if not op.exists("build/locale"): print( 'Locale files are missing. Have you run "build.py --loc"? Exiting...' ) return # include help files if they are built otherwise exit as they should be included? if not op.exists("build/help"): print( 'Help files are missing. Have you run "build.py --doc"? Exiting...' ) return shutil.copytree(op.join("build", "help"), op.join(destpath, "help")) shutil.copytree(op.join("build", "locale"), op.join(destpath, "locale")) compileall.compile_dir(destpath)
def build_cocoa(dev): print("Creating OS X app structure") app = cocoa_app() # We import this here because we don't want opened module to prevent us replacing .pyd files. from core.app import Application as MoneyGuruApp app_version = MoneyGuruApp.VERSION filereplace('cocoa/InfoTemplate.plist', 'build/Info.plist', version=app_version) app.create('build/Info.plist') print("Building localizations") build_localizations('cocoa') print("Building xibless UIs") build_cocoalib_xibless() build_xibless() print("Building Python extensions") build_cocoa_proxy_module() build_cocoa_bridging_interfaces() print("Building the cocoa layer") copy_embeddable_python_dylib('build') pydep_folder = op.join(app.resources, 'py') ensure_folder(pydep_folder) if dev: hardlink('cocoa/mg_cocoa.py', 'build/mg_cocoa.py') else: copy('cocoa/mg_cocoa.py', 'build/mg_cocoa.py') tocopy = ['core', 'hscommon', 'cocoalib/cocoa', 'objp'] copy_packages(tocopy, pydep_folder, create_links=dev) sys.path.insert(0, 'build') collect_stdlib_dependencies('build/mg_cocoa.py', pydep_folder) del sys.path[0] copy_sysconfig_files_for_embed(pydep_folder) if not dev: # Important: Don't ever run delete_files_with_pattern('*.py') on dev builds because you'll # be deleting all py files in symlinked folders. compileall.compile_dir(pydep_folder, force=True, legacy=True) delete_files_with_pattern(pydep_folder, '*.py') delete_files_with_pattern(pydep_folder, '__pycache__') print("Compiling with WAF") os.chdir('cocoa') print_and_do(cocoa_compile_command()) os.chdir('..') app.copy_executable('cocoa/build/moneyGuru') build_help() print("Copying resources and frameworks") resources = [ 'cocoa/dsa_pub.pem', 'build/mg_cocoa.py', 'build/help', 'data/example.moneyguru', ] + glob.glob('images/*') app.copy_resources(*resources, use_symlinks=dev) app.copy_frameworks( 'build/Python', 'cocoalib/Sparkle.framework', ) print("Creating the run.py file") tmpl = open('run_template_cocoa.py', 'rt').read() run_contents = tmpl.replace('{{app_path}}', app.dest) open('run.py', 'wt').write(run_contents)
def build_cocoa(dev): print("Creating OS X app structure") app = cocoa_app() # We import this here because we don't want opened module to prevent us replacing .pyd files. from core.app import Application as MoneyGuruApp app_version = MoneyGuruApp.VERSION filereplace('cocoa/InfoTemplate.plist', 'build/Info.plist', version=app_version) app.create('build/Info.plist') print("Building localizations") build_localizations('cocoa') print("Building xibless UIs") build_cocoalib_xibless() build_xibless() print("Building Python extensions") build_cocoa_proxy_module() build_cocoa_bridging_interfaces() print("Building the cocoa layer") copy_embeddable_python_dylib('build') pydep_folder = op.join(app.resources, 'py') ensure_folder(pydep_folder) if dev: hardlink('cocoa/mg_cocoa.py', 'build/mg_cocoa.py') else: copy('cocoa/mg_cocoa.py', 'build/mg_cocoa.py') tocopy = ['core', 'hscommon', 'cocoalib/cocoa', 'objp', 'sgmllib'] copy_packages(tocopy, pydep_folder, create_links=dev) sys.path.insert(0, 'build') collect_stdlib_dependencies('build/mg_cocoa.py', pydep_folder) del sys.path[0] copy_sysconfig_files_for_embed(pydep_folder) if not dev: # Important: Don't ever run delete_files_with_pattern('*.py') on dev builds because you'll # be deleting all py files in symlinked folders. compileall.compile_dir(pydep_folder, force=True, legacy=True) delete_files_with_pattern(pydep_folder, '*.py') delete_files_with_pattern(pydep_folder, '__pycache__') print("Compiling PSMTabBarControl framework") os.chdir('psmtabbarcontrol') print_and_do('{0} waf configure && {0} waf && {0} waf build_framework'.format(sys.executable)) os.chdir('..') print("Compiling with WAF") os.chdir('cocoa') print_and_do(cocoa_compile_command()) os.chdir('..') app.copy_executable('cocoa/build/moneyGuru') build_help() print("Copying resources and frameworks") resources = [ 'cocoa/dsa_pub.pem', 'build/mg_cocoa.py', 'build/help', 'data/example.moneyguru', 'plugin_examples' ] + glob.glob('images/*') app.copy_resources(*resources, use_symlinks=dev) app.copy_frameworks( 'build/Python', 'cocoalib/Sparkle.framework', 'psmtabbarcontrol/PSMTabBarControl.framework' ) print("Creating the run.py file") tmpl = open('run_template_cocoa.py', 'rt').read() run_contents = tmpl.replace('{{app_path}}', app.dest) open('run.py', 'wt').write(run_contents)
def copy_cource_files(destpath, packages): if op.exists(destpath): shutil.rmtree(destpath) os.makedirs(destpath) shutil.copy('run.py', op.join(destpath, 'run.py')) copy_packages(packages, destpath) shutil.copytree(op.join('build', 'help'), op.join(destpath, 'help')) shutil.copy(op.join('images', 'logo_small.png'), destpath) shutil.copy(op.join('images', 'logo_big.png'), destpath) compileall.compile_dir(destpath)
def copy_source_files(destpath, packages): if op.exists(destpath): shutil.rmtree(destpath) os.makedirs(destpath) shutil.copy('run.py', op.join(destpath, 'run.py')) copy_packages(packages, destpath) os.remove(op.join(destpath, 'qt', 'run_template.py')) # It doesn't belong in the package. shutil.copytree(op.join('build', 'help'), op.join(destpath, 'help')) shutil.copytree(op.join('build', 'locale'), op.join(destpath, 'locale')) compileall.compile_dir(destpath)
def copy_source_files(destpath, packages): if op.exists(destpath): shutil.rmtree(destpath) os.makedirs(destpath) shutil.copy('run.py', op.join(destpath, 'run.py')) # It's source files we're copying, we don't want to copy .so files copy_packages(packages, destpath, extra_ignores=['*.so']) shutil.copytree(op.join('build', 'help'), op.join(destpath, 'help')) shutil.copytree(op.join('build', 'locale'), op.join(destpath, 'locale')) shutil.copy(op.join('images', 'logo_small.png'), destpath) shutil.copy(op.join('images', 'logo_big.png'), destpath) compileall.compile_dir(destpath)
def build_cocoa(dev): print("Creating OS X app structure") app = cocoa_app() # We import this here because we don't want opened module to prevent us replacing .pyd files. from core.app import Application as MoneyGuruApp app_version = MoneyGuruApp.VERSION filereplace("cocoa/InfoTemplate.plist", "build/Info.plist", version=app_version) app.create("build/Info.plist") print("Building localizations") build_localizations("cocoa") print("Building xibless UIs") build_cocoalib_xibless() build_xibless() print("Building Python extensions") build_cocoa_proxy_module() build_cocoa_bridging_interfaces() print("Building the cocoa layer") copy_embeddable_python_dylib("build") pydep_folder = op.join(app.resources, "py") ensure_folder(pydep_folder) if dev: hardlink("cocoa/mg_cocoa.py", "build/mg_cocoa.py") else: copy("cocoa/mg_cocoa.py", "build/mg_cocoa.py") tocopy = ["core", "hscommon", "cocoalib/cocoa", "objp"] copy_packages(tocopy, pydep_folder, create_links=dev) sys.path.insert(0, "build") collect_stdlib_dependencies("build/mg_cocoa.py", pydep_folder) del sys.path[0] copy_sysconfig_files_for_embed(pydep_folder) if not dev: # Important: Don't ever run delete_files_with_pattern('*.py') on dev builds because you'll # be deleting all py files in symlinked folders. compileall.compile_dir(pydep_folder, force=True, legacy=True) delete_files_with_pattern(pydep_folder, "*.py") delete_files_with_pattern(pydep_folder, "__pycache__") print("Compiling with WAF") os.chdir("cocoa") print_and_do(cocoa_compile_command()) os.chdir("..") app.copy_executable("cocoa/build/moneyGuru") build_help() print("Copying resources and frameworks") resources = ["cocoa/dsa_pub.pem", "build/mg_cocoa.py", "build/help", "data/example.moneyguru"] + glob.glob( "images/*" ) app.copy_resources(*resources, use_symlinks=dev) app.copy_frameworks("build/Python", "cocoalib/Sparkle.framework") print("Creating the run.py file") tmpl = open("run_template_cocoa.py", "rt").read() run_contents = tmpl.replace("{{app_path}}", app.dest) open("run.py", "wt").write(run_contents)
def copy_files_to_package(destpath, packages, with_so): # when with_so is true, we keep .so files in the package, and otherwise, we don't. We need this # flag because when building debian src pkg, we *don't* want .so files (they're compiled later) # and when we're packaging under Arch, we're packaging a binary package, so we want them. if op.exists(destpath): shutil.rmtree(destpath) os.makedirs(destpath) shutil.copy('run.py', op.join(destpath, 'run.py')) extra_ignores = ['*.so'] if not with_so else None copy_packages(packages, destpath, extra_ignores=extra_ignores) shutil.copytree(op.join('build', 'help'), op.join(destpath, 'help')) shutil.copytree(op.join('build', 'locale'), op.join(destpath, 'locale')) compileall.compile_dir(destpath)
def build_cocoa(dev): app = OSXAppStructure('build/PdfMasher.app') print('Generating Info.plist') app_version = get_module_version('core') filereplace('cocoa/InfoTemplate.plist', 'cocoa/Info.plist', version=app_version) app.create('cocoa/Info.plist') print("Building the cocoa layer") build_cocoalib_xibless() build_xibless() pydep_folder = op.join(app.resources, 'py') if not op.exists(pydep_folder): os.mkdir(pydep_folder) build_cocoa_proxy_module() build_cocoa_bridging_interfaces() copy_embeddable_python_dylib('build') tocopy = [ 'core', 'ebooks', 'hscommon', 'cocoa/inter', 'cocoalib/cocoa', 'jobprogress', 'objp', 'cssutils', 'cssselect', 'pdfminer', 'lxml', 'ply', 'markdown', 'encutils' ] copy_packages(tocopy, pydep_folder, create_links=dev) copy('cocoa/pyplugin.py', 'build/pyplugin.py') sys.path.insert(0, 'build') collect_stdlib_dependencies('build/pyplugin.py', pydep_folder) del sys.path[0] # Views are not referenced by python code, so they're not found by the collector. copy_all('build/inter/*.so', op.join(pydep_folder, 'inter')) copy_sysconfig_files_for_embed(pydep_folder) if not dev: # Important: Don't ever run delete_files_with_pattern('*.py') on dev builds because you'll # be deleting all py files in symlinked folders. compileall.compile_dir(pydep_folder, force=True, legacy=True) delete_files_with_pattern(pydep_folder, '*.py') delete_files_with_pattern(pydep_folder, '__pycache__') os.chdir('cocoa') print("Compiling with WAF") os.system('{0} waf configure && {0} waf'.format(sys.executable)) os.chdir('..') print("Creating the .app folder") app.copy_executable('cocoa/build/PdfMasher') resources = [ 'images/main_icon.icns', 'cocoa/dsa_pub.pem', 'build/pyplugin.py', 'build/help' ] app.copy_resources(*resources, use_symlinks=dev) app.copy_frameworks('build/Python', 'cocoalib/Sparkle.framework') print("Creating the run.py file") copy('cocoa/runtemplate.py', 'run.py')
def build_cocoa(dev): build_localizations() build_cocoa_proxy_module() build_cocoa_bridging_interfaces() app_version = get_module_version('core') cocoa_project_path = 'cocoa' filereplace(op.join(cocoa_project_path, 'InfoTemplate.plist'), op.join('build', 'Info.plist'), version=app_version) copy_embeddable_python_dylib('build') if not op.exists('build/PythonHeaders'): os.symlink(op.dirname(sysconfig.get_config_h_filename()), 'build/PythonHeaders') build_help() pydep_folder = op.join('build', 'py') if not op.exists(pydep_folder): os.mkdir(pydep_folder) shutil.copy(op.join(cocoa_project_path, 'dg_cocoa.py'), 'build') tocopy = [ 'dupeguru/core', 'dupeguru/hscommon', 'cocoa/inter', 'cocoalib/cocoa', 'objp', 'send2trash', 'hsaudiotag', ] copy_packages(tocopy, pydep_folder, create_links=dev) sys.path.insert(0, 'build') # ModuleFinder can't seem to correctly detect the multiprocessing dependency, so we have # to manually specify it. extra_deps = ['multiprocessing'] collect_stdlib_dependencies('build/dg_cocoa.py', pydep_folder, extra_deps=extra_deps) del sys.path[0] # Views are not referenced by python code, so they're not found by the collector. copy_all('build/inter/*.so', op.join(pydep_folder, 'inter')) if not dev: # Important: Don't ever run delete_files_with_pattern('*.py') on dev builds because you'll # be deleting all py files in symlinked folders. compileall.compile_dir(pydep_folder, force=True, legacy=True) delete_files_with_pattern(pydep_folder, '*.py') delete_files_with_pattern(pydep_folder, '__pycache__') print_and_do('xcodebuild')
def package_debian(): if op.exists('build'): shutil.rmtree('build') add_to_pythonpath('qt') from app import MusicGuru destpath = op.join('build', 'musicguru-{0}'.format(MusicGuru.VERSION)) srcpath = op.join(destpath, 'src') os.makedirs(destpath) shutil.copytree('qt', srcpath) copy_packages(['hsaudiotag', 'hsfs', 'core', 'qtlib', 'hscommon', 'jobprogress'], srcpath) shutil.copytree('debian', op.join(destpath, 'debian')) build_debian_changelog(op.join('help', 'changelog.yaml'), op.join(destpath, 'debian', 'changelog'), 'musicguru', from_version='1.3.6') shutil.copytree(op.join('help', 'musicguru_help'), op.join(srcpath, 'help')) shutil.copy(op.join('images', 'mg_logo_big.png'), srcpath) compileall.compile_dir(srcpath) os.chdir(destpath) os.system("dpkg-buildpackage")
def copy_files_to_package(destpath, packages, with_so): # when with_so is true, we keep .so files in the package, and otherwise, we don't. We need this # flag because when building debian src pkg, we *don't* want .so files (they're compiled later) # and when we're packaging under Arch, we're packaging a binary package, so we want them. if op.exists(destpath): shutil.rmtree(destpath) os.makedirs(destpath) shutil.copy(ENTRY_SCRIPT, op.join(destpath, ENTRY_SCRIPT)) extra_ignores = ["*.so"] if not with_so else None copy_packages(packages, destpath, extra_ignores=extra_ignores) # include locale files if they are built otherwise exit as it will break # the localization if not check_loc_doc(): print("Exiting...") return shutil.copytree(op.join("build", "help"), op.join(destpath, "help")) shutil.copytree(op.join("build", "locale"), op.join(destpath, "locale")) compileall.compile_dir(destpath)
def build_cocoa(dev): app = OSXAppStructure('build/PdfMasher.app') print('Generating Info.plist') app_version = get_module_version('core') filereplace('cocoa/InfoTemplate.plist', 'cocoa/Info.plist', version=app_version) app.create('cocoa/Info.plist') print("Building the cocoa layer") build_cocoalib_xibless() build_xibless() pydep_folder = op.join(app.resources, 'py') if not op.exists(pydep_folder): os.mkdir(pydep_folder) build_cocoa_proxy_module() build_cocoa_bridging_interfaces() copy_embeddable_python_dylib('build') tocopy = ['core', 'ebooks', 'hscommon', 'cocoa/inter', 'cocoalib/cocoa', 'jobprogress', 'objp', 'cssutils', 'cssselect', 'pdfminer', 'lxml', 'ply', 'markdown', 'encutils'] copy_packages(tocopy, pydep_folder, create_links=dev) copy('cocoa/pyplugin.py', 'build/pyplugin.py') sys.path.insert(0, 'build') collect_stdlib_dependencies('build/pyplugin.py', pydep_folder) del sys.path[0] # Views are not referenced by python code, so they're not found by the collector. copy_all('build/inter/*.so', op.join(pydep_folder, 'inter')) copy_sysconfig_files_for_embed(pydep_folder) if not dev: # Important: Don't ever run delete_files_with_pattern('*.py') on dev builds because you'll # be deleting all py files in symlinked folders. compileall.compile_dir(pydep_folder, force=True, legacy=True) delete_files_with_pattern(pydep_folder, '*.py') delete_files_with_pattern(pydep_folder, '__pycache__') os.chdir('cocoa') print("Compiling with WAF") os.system('{0} waf configure && {0} waf'.format(sys.executable)) os.chdir('..') print("Creating the .app folder") app.copy_executable('cocoa/build/PdfMasher') resources = ['images/main_icon.icns', 'cocoa/dsa_pub.pem', 'build/pyplugin.py', 'build/help'] app.copy_resources(*resources, use_symlinks=dev) app.copy_frameworks('build/Python', 'cocoalib/Sparkle.framework') print("Creating the run.py file") copy('cocoa/runtemplate.py', 'run.py')
def package_debian(): if op.exists('build'): shutil.rmtree('build') add_to_pythonpath('qt') from app import MusicGuru destpath = op.join('build', 'musicguru-{0}'.format(MusicGuru.VERSION)) srcpath = op.join(destpath, 'src') os.makedirs(destpath) shutil.copytree('qt', srcpath) copy_packages( ['hsaudiotag', 'hsfs', 'core', 'qtlib', 'hscommon', 'jobprogress'], srcpath) shutil.copytree('debian', op.join(destpath, 'debian')) build_debian_changelog(op.join('help', 'changelog.yaml'), op.join(destpath, 'debian', 'changelog'), 'musicguru', from_version='1.3.6') shutil.copytree(op.join('help', 'musicguru_help'), op.join(srcpath, 'help')) shutil.copy(op.join('images', 'mg_logo_big.png'), srcpath) compileall.compile_dir(srcpath) os.chdir(destpath) os.system("dpkg-buildpackage")
def build_cocoa(dev): if not dev: print("Building help index") help_path = op.abspath('help/musicguru_help') os.system( 'open -a /Developer/Applications/Utilities/Help\\ Indexer.app {0}'. format(help_path)) print("Building mg_cocoa.plugin") if op.exists('build'): shutil.rmtree('build') os.mkdir('build') if not dev: copy_packages( ['core', 'hsaudiotag', 'hsfs', 'hscommon', 'jobprogress'], 'build') shutil.copy('cocoa/mg_cocoa.py', 'build') os.chdir('build') script_args = ['py2app', '-A'] if dev else ['py2app'] setup( script_args=script_args, plugin=['mg_cocoa.py'], setup_requires=['py2app'], ) os.chdir('..') if op.exists('cocoa/mg_cocoa.plugin'): shutil.rmtree('cocoa/mg_cocoa.plugin') shutil.move('build/dist/mg_cocoa.plugin', 'cocoa/mg_cocoa.plugin') if dev: # In alias mode, the tweakings we do to the pythonpath aren't counted in. We have to # manually put a .pth in the plugin pluginpath = 'cocoa/mg_cocoa.plugin' pthpath = op.join(pluginpath, 'Contents/Resources/dev.pth') open(pthpath, 'w').write(op.abspath('.')) os.chdir('cocoa') print("Building the XCode project") os.system('xcodebuild') os.chdir('..')
def build_cocoa(edition, dev): print("Creating OS X app structure") ed = lambda s: s.format(edition) app = cocoa_app(edition) app_version = get_module_version(ed('core_{}')) cocoa_project_path = ed('cocoa/{}') filereplace(op.join(cocoa_project_path, 'InfoTemplate.plist'), op.join('build', 'Info.plist'), version=app_version) app.create(op.join('build', 'Info.plist')) print("Building localizations") build_localizations('cocoa', edition) print("Building xibless UIs") build_cocoalib_xibless() build_xibless(edition) print("Building Python extensions") build_cocoa_proxy_module() build_cocoa_bridging_interfaces(edition) print("Building the cocoa layer") copy_embeddable_python_dylib('build') pydep_folder = op.join(app.resources, 'py') if not op.exists(pydep_folder): os.mkdir(pydep_folder) shutil.copy(op.join(cocoa_project_path, 'dg_cocoa.py'), 'build') appscript_pkgs = ['appscript', 'aem', 'mactypes', 'osax'] specific_packages = { 'se': ['core_se'], 'me': ['core_me'] + appscript_pkgs + ['hsaudiotag'], 'pe': ['core_pe'] + appscript_pkgs, }[edition] tocopy = ['core', 'hscommon', 'cocoa/inter', 'cocoalib/cocoa', 'jobprogress', 'objp', 'send2trash'] + specific_packages copy_packages(tocopy, pydep_folder, create_links=dev) sys.path.insert(0, 'build') extra_deps = None if edition == 'pe': # ModuleFinder can't seem to correctly detect the multiprocessing dependency, so we have # to manually specify it. extra_deps=['multiprocessing'] collect_stdlib_dependencies('build/dg_cocoa.py', pydep_folder, extra_deps=extra_deps) del sys.path[0] # Views are not referenced by python code, so they're not found by the collector. copy_all('build/inter/*.so', op.join(pydep_folder, 'inter')) copy_sysconfig_files_for_embed(pydep_folder) if not dev: # Important: Don't ever run delete_files_with_pattern('*.py') on dev builds because you'll # be deleting all py files in symlinked folders. compileall.compile_dir(pydep_folder, force=True, legacy=True) delete_files_with_pattern(pydep_folder, '*.py') delete_files_with_pattern(pydep_folder, '__pycache__') print("Compiling with WAF") os.chdir('cocoa') print_and_do(cocoa_compile_command(edition)) os.chdir('..') app.copy_executable('cocoa/build/dupeGuru') print("Copying resources and frameworks") image_path = ed('cocoa/{}/dupeguru.icns') resources = [image_path, 'cocoa/base/dsa_pub.pem', 'build/dg_cocoa.py', 'build/help'] app.copy_resources(*resources, use_symlinks=dev) app.copy_frameworks('build/Python', 'cocoalib/Sparkle.framework') print("Creating the run.py file") tmpl = open('cocoa/run_template.py', 'rt').read() run_contents = tmpl.replace('{{app_path}}', app.dest) open('run.py', 'wt').write(run_contents)