Esempio n. 1
0
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)
Esempio n. 2
0
def build_updatepot():
    if ISOSX:
        print("Updating Cocoa strings file.")
        build_cocoalib_xibless('cocoalib/autogen')
        loc.generate_cocoa_strings_from_code('cocoalib', 'cocoalib/en.lproj')
        # If we don't delete 'cocoalib/autogen', it messes with compilation
        shutil.rmtree('cocoalib/autogen')
        build_xibless()
        loc.generate_cocoa_strings_from_code('cocoa', 'cocoa/en.lproj')
    print("Building .pot files from source files")
    print("Building core.pot")
    loc.generate_pot(['core'], op.join('locale', 'core.pot'), ['tr'])
    print("Building columns.pot")
    loc.generate_pot(['core'], op.join('locale', 'columns.pot'), ['trcol'])
    print("Building ui.pot")
    # When we're not under OS X, we don't want to overwrite ui.pot because it contains Cocoa locs
    # We want to merge the generated pot with the old pot in the most preserving way possible.
    loc.generate_pot(['qt'], op.join('locale', 'ui.pot'), ['tr'], merge=(not ISOSX))
    print("Building hscommon.pot")
    loc.generate_pot(['hscommon'], op.join('hscommon', 'locale', 'hscommon.pot'), ['tr'])
    print("Building qtlib.pot")
    loc.generate_pot(['qtlib'], op.join('qtlib', 'locale', 'qtlib.pot'), ['tr'])
    if ISOSX:
        print("Building cocoalib.pot")
        cocoalib_pot = op.join('cocoalib', 'locale', 'cocoalib.pot')
        os.remove(cocoalib_pot)
        loc.strings2pot(op.join('cocoalib', 'en.lproj', 'cocoalib.strings'), cocoalib_pot)
        print("Enhancing ui.pot with Cocoa's strings files")
        loc.strings2pot(op.join('cocoa', 'en.lproj', 'Localizable.strings'), op.join('locale', 'ui.pot'))
Esempio n. 3
0
def main():
    args = parse_args()
    print("Building moneyGuru")
    if args.dev:
        print("Building in Dev mode")
    if args.clean:
        clean()
    if not op.exists('build'):
        os.mkdir('build')
    if args.doc:
        build_help()
    elif args.loc:
        build_localizations()
    elif args.updatepot:
        build_updatepot()
    elif args.mergepot:
        build_mergepot()
    elif args.normpo:
        build_normpo()
    elif args.cocoamod:
        build_cocoa_proxy_module()
        build_cocoa_bridging_interfaces()
    elif args.ext:
        build_ext()
    elif args.cocoa_compile:
        os.chdir('cocoa')
        print_and_do(cocoa_compile_command())
        os.chdir('..')
        cocoa_app().copy_executable('cocoa/build/moneyGuru')
    elif args.xibless:
        build_cocoalib_xibless()
        build_xibless()
    else:
        build_normal(args.dev, not args.no_ext)
Esempio n. 4
0
def build_updatepot():
    if ISOSX:
        print("Updating Cocoa strings file.")
        # We need to have strings from *all* editions in here, so we'll call xibless for all editions
        # in dummy subfolders.
        build_cocoalib_xibless('cocoalib/autogen')
        loc.generate_cocoa_strings_from_code('cocoalib', 'cocoalib/en.lproj')
        for edition in ('se', 'me', 'pe'):
            build_xibless(edition, op.join('cocoa', 'autogen', edition))
        loc.generate_cocoa_strings_from_code('cocoa', 'cocoa/base/en.lproj')
    print("Building .pot files from source files")
    print("Building core.pot")
    all_cores = ['core', 'core_se', 'core_me', 'core_pe']
    loc.generate_pot(all_cores, op.join('locale', 'core.pot'), ['tr'])
    print("Building columns.pot")
    loc.generate_pot(all_cores, op.join('locale', 'columns.pot'), ['coltr'])
    print("Building ui.pot")
    # When we're not under OS X, we don't want to overwrite ui.pot because it contains Cocoa locs
    # We want to merge the generated pot with the old pot in the most preserving way possible.
    ui_packages = ['qt', op.join('cocoa', 'inter')]
    loc.generate_pot(ui_packages, op.join('locale', 'ui.pot'), ['tr'], merge=(not ISOSX))
    print("Building qtlib.pot")
    loc.generate_pot(['qtlib'], op.join('qtlib', 'locale', 'qtlib.pot'), ['tr'])
    if ISOSX:
        print("Building cocoalib.pot")
        cocoalib_pot = op.join('cocoalib', 'locale', 'cocoalib.pot')
        os.remove(cocoalib_pot)
        loc.strings2pot(op.join('cocoalib', 'en.lproj', 'cocoalib.strings'), cocoalib_pot)
        print("Enhancing ui.pot with Cocoa's strings files")
        loc.strings2pot(
            op.join('cocoa', 'base', 'en.lproj', 'Localizable.strings'),
            op.join('locale', 'ui.pot')
        )
Esempio n. 5
0
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)
Esempio n. 6
0
def build_updatepot():
    if ISOSX:
        print("Updating Cocoa strings file.")
        build_cocoalib_xibless("cocoalib/autogen")
        loc.generate_cocoa_strings_from_code("cocoalib", "cocoalib/en.lproj")
        # If we don't delete 'cocoalib/autogen', it messes with compilation
        shutil.rmtree("cocoalib/autogen")
        build_xibless()
        loc.generate_cocoa_strings_from_code("cocoa", "cocoa/en.lproj")
    print("Building .pot files from source files")
    print("Building core.pot")
    loc.generate_pot(["core"], op.join("locale", "core.pot"), ["tr"])
    print("Building columns.pot")
    loc.generate_pot(["core"], op.join("locale", "columns.pot"), ["trcol"])
    print("Building ui.pot")
    # When we're not under OS X, we don't want to overwrite ui.pot because it contains Cocoa locs
    # We want to merge the generated pot with the old pot in the most preserving way possible.
    loc.generate_pot(["qt"], op.join("locale", "ui.pot"), ["tr"], merge=(not ISOSX))
    print("Building qtlib.pot")
    loc.generate_pot(["qtlib"], op.join("qtlib", "locale", "qtlib.pot"), ["tr"])
    if ISOSX:
        print("Building cocoalib.pot")
        cocoalib_pot = op.join("cocoalib", "locale", "cocoalib.pot")
        os.remove(cocoalib_pot)
        loc.strings2pot(op.join("cocoalib", "en.lproj", "cocoalib.strings"), cocoalib_pot)
        print("Enhancing ui.pot with Cocoa's strings files")
        loc.strings2pot(op.join("cocoa", "en.lproj", "Localizable.strings"), op.join("locale", "ui.pot"))
Esempio n. 7
0
def main():
    args = parse_args()
    ui = args.ui
    if ui not in ("cocoa", "qt"):
        ui = "cocoa" if ISOSX else "qt"
    print("Building moneyGuru with UI {}".format(ui))
    if args.dev:
        print("Building in Dev mode")
    if args.clean:
        clean()
    if not op.exists("build"):
        os.mkdir("build")
    if args.doc:
        build_help()
    elif args.loc:
        build_localizations(ui)
    elif args.updatepot:
        build_updatepot()
    elif args.mergepot:
        build_mergepot()
    elif args.cocoamod:
        build_cocoa_proxy_module()
        build_cocoa_bridging_interfaces()
    elif args.ext:
        build_ext()
    elif args.cocoa_compile:
        os.chdir("cocoa")
        print_and_do(cocoa_compile_command())
        os.chdir("..")
        cocoa_app().copy_executable("cocoa/build/moneyGuru")
    elif args.xibless:
        build_cocoalib_xibless()
        build_xibless()
    else:
        build_normal(ui, args.dev, not args.no_ext)
Esempio n. 8
0
def build_updatepot():
    if ISOSX:
        print("Updating Cocoa strings file.")
        build_cocoalib_xibless('cocoalib/autogen')
        loc.generate_cocoa_strings_from_code('cocoalib', 'cocoalib/en.lproj')
        build_xibless()
        loc.generate_cocoa_strings_from_code('cocoa', 'cocoa/en.lproj')
    print("Building .pot files from source files")
    print("Building core.pot")
    loc.generate_pot(['core'], op.join('locale', 'core.pot'), ['tr'])
    print("Building columns.pot")
    loc.generate_pot(['core'], op.join('locale', 'columns.pot'), ['coltr'])
    print("Building ui.pot")
    # When we're not under OS X, we don't want to overwrite ui.pot because it contains Cocoa locs
    # We want to merge the generated pot with the old pot in the most preserving way possible.
    ui_packages = ['qt', op.join('cocoa', 'inter')]
    loc.generate_pot(ui_packages, op.join('locale', 'ui.pot'), ['tr'], merge=(not ISOSX))
    print("Building qtlib.pot")
    loc.generate_pot(['qtlib'], op.join('qtlib', 'locale', 'qtlib.pot'), ['tr'])
    if ISOSX:
        print("Building cocoalib.pot")
        cocoalib_pot = op.join('cocoalib', 'locale', 'cocoalib.pot')
        os.remove(cocoalib_pot)
        loc.strings2pot(op.join('cocoalib', 'en.lproj', 'cocoalib.strings'), cocoalib_pot)
        print("Enhancing ui.pot with Cocoa's strings files")
        loc.strings2pot(
            op.join('cocoa', 'en.lproj', 'Localizable.strings'),
            op.join('locale', 'ui.pot')
        )
Esempio n. 9
0
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)
Esempio n. 10
0
def build_updatepot():
    if ISOSX:
        print("Updating Cocoa strings file.")
        build_cocoalib_xibless('cocoalib/autogen')
        loc.generate_cocoa_strings_from_code('cocoalib', 'cocoalib/en.lproj')
        build_xibless('se', op.join('cocoa', 'autogen', 'se'))
        loc.generate_cocoa_strings_from_code('cocoa', 'cocoa/en.lproj')
    print("Building .pot files from source files")
    print("Building core.pot")
    loc.generate_pot(['core'], op.join('locale', 'core.pot'), ['tr'])
    print("Building columns.pot")
    loc.generate_pot(['core'], op.join('locale', 'columns.pot'), ['coltr'])
    print("Building ui.pot")
    # When we're not under OS X, we don't want to overwrite ui.pot because it contains Cocoa locs
    # We want to merge the generated pot with the old pot in the most preserving way possible.
    ui_packages = ['qt', op.join('cocoa', 'inter')]
    loc.generate_pot(ui_packages, op.join('locale', 'ui.pot'), ['tr'], merge=(not ISOSX))
    print("Building qtlib.pot")
    loc.generate_pot(['qtlib'], op.join('qtlib', 'locale', 'qtlib.pot'), ['tr'])
    if ISOSX:
        print("Building cocoalib.pot")
        cocoalib_pot = op.join('cocoalib', 'locale', 'cocoalib.pot')
        os.remove(cocoalib_pot)
        loc.strings2pot(op.join('cocoalib', 'en.lproj', 'cocoalib.strings'), cocoalib_pot)
        print("Enhancing ui.pot with Cocoa's strings files")
        loc.strings2pot(
            op.join('cocoa', 'en.lproj', 'Localizable.strings'),
            op.join('locale', 'ui.pot')
        )
Esempio n. 11
0
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)
Esempio n. 12
0
def main():
    args = parse_args()
    conf = json.load(open('conf.json'))
    ui = conf['ui']
    dev = conf['dev']
    print("Building moneyGuru with UI {}".format(ui))
    if dev:
        print("Building in Dev mode")
    if args.clean:
        clean()
    if not op.exists('build'):
        os.mkdir('build')
    if args.doc:
        build_help(dev)
    elif args.loc:
        build_localizations(ui)
    elif args.updatepot:
        build_updatepot()
    elif args.mergepot:
        build_mergepot()
    elif args.cocoamod:
        build_cocoa_proxy_module()
        build_cocoa_bridging_interfaces()
    elif args.ext:
        build_ext()
    elif args.cocoa_compile:
        os.chdir('cocoa')
        print_and_do(cocoa_compile_command())
        os.chdir('..')
        cocoa_app().copy_executable('cocoa/build/moneyGuru')
    elif args.xibless:
        build_cocoalib_xibless()
        build_xibless()
    else:
        build_normal(ui, dev)
Esempio n. 13
0
def build_updatepot():
    if ISOSX:
        print("Updating Cocoa strings file.")
        # We need to have strings from *all* editions in here, so we'll call xibless for all editions
        # in dummy subfolders.
        build_cocoalib_xibless('cocoalib/autogen')
        loc.generate_cocoa_strings_from_code('cocoalib', 'cocoalib/en.lproj')
        for edition in ('se', 'me', 'pe'):
            build_xibless(edition, op.join('cocoa', 'autogen', edition))
        loc.generate_cocoa_strings_from_code('cocoa', 'cocoa/base/en.lproj')
    print("Building .pot files from source files")
    print("Building core.pot")
    all_cores = ['core', 'core_se', 'core_me', 'core_pe']
    loc.generate_pot(all_cores, op.join('locale', 'core.pot'), ['tr'])
    print("Building columns.pot")
    loc.generate_pot(all_cores, op.join('locale', 'columns.pot'), ['coltr'])
    print("Building ui.pot")
    # When we're not under OS X, we don't want to overwrite ui.pot because it contains Cocoa locs
    # We want to merge the generated pot with the old pot in the most preserving way possible.
    ui_packages = ['qt', op.join('cocoa', 'inter')]
    loc.generate_pot(ui_packages, op.join('locale', 'ui.pot'), ['tr'], merge=(not ISOSX))
    print("Building hscommon.pot")
    loc.generate_pot(['hscommon'], op.join('hscommon', 'locale', 'hscommon.pot'), ['tr'])
    print("Building qtlib.pot")
    loc.generate_pot(['qtlib'], op.join('qtlib', 'locale', 'qtlib.pot'), ['tr'])
    if ISOSX:
        print("Building cocoalib.pot")
        cocoalib_pot = op.join('cocoalib', 'locale', 'cocoalib.pot')
        os.remove(cocoalib_pot)
        loc.strings2pot(op.join('cocoalib', 'en.lproj', 'cocoalib.strings'), cocoalib_pot)
        print("Enhancing ui.pot with Cocoa's strings files")
        loc.strings2pot(op.join('cocoa', 'base', 'en.lproj', 'Localizable.strings'),
            op.join('locale', 'ui.pot'))
Esempio n. 14
0
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)
Esempio n. 15
0
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')
Esempio n. 16
0
def build_updatepot():
    print("Updating Cocoa strings file.")
    build_cocoalib_xibless('cocoalib/autogen')
    loc.generate_cocoa_strings_from_code('cocoalib', 'cocoalib/en.lproj')
    # If we don't delete 'cocoalib/autogen', it messes with compilation
    shutil.rmtree('cocoalib/autogen')
    build_xibless()
    loc.generate_cocoa_strings_from_code('cocoa', 'cocoa/en.lproj')
    print("Building .pot files from source files")
    print("Building cocoalib.pot")
    cocoalib_pot = op.join('cocoalib', 'locale', 'cocoalib.pot')
    os.remove(cocoalib_pot)
    loc.strings2pot(op.join('cocoalib', 'en.lproj', 'cocoalib.strings'),
                    cocoalib_pot)
    print("Enhancing ui.pot with Cocoa's strings files")
    loc.strings2pot(op.join('cocoa', 'en.lproj', 'Localizable.strings'),
                    op.join('locale', 'ui.pot'))
Esempio n. 17
0
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')
Esempio n. 18
0
def main():
    options = parse_args()
    conf = json.load(open('conf.json'))
    edition = conf['edition']
    ui = conf['ui']
    dev = conf['dev']
    if dev:
        print("Building in Dev mode")
    if options.clean:
        for path in [
                'build',
                op.join('cocoa', 'build'),
                op.join('cocoa', 'autogen')
        ]:
            if op.exists(path):
                shutil.rmtree(path)
    if not op.exists('build'):
        os.mkdir('build')
    if options.doc:
        build_help(edition)
    elif options.loc:
        build_localizations(ui, edition)
    elif options.updatepot:
        build_updatepot()
    elif options.mergepot:
        build_mergepot()
    elif options.normpo:
        build_normpo()
    elif options.cocoa_ext:
        build_cocoa_proxy_module()
        build_cocoa_bridging_interfaces(edition)
    elif options.cocoa_compile:
        os.chdir('cocoa')
        print_and_do(cocoa_compile_command(edition))
        os.chdir('..')
        cocoa_app(edition).copy_executable('cocoa/build/dupeGuru')
    elif options.xibless:
        build_cocoalib_xibless()
        build_xibless(edition)
    else:
        build_normal(edition, ui, dev, conf)
Esempio n. 19
0
def main():
    options = parse_args()
    ui = options.ui
    if ui not in ('cocoa', 'qt'):
        ui = 'cocoa' if ISOSX else 'qt'
    if options.dev:
        print("Building in Dev mode")
    if options.clean:
        for path in [
                'build',
                op.join('cocoa', 'build'),
                op.join('cocoa', 'autogen')
        ]:
            if op.exists(path):
                shutil.rmtree(path)
    if not op.exists('build'):
        os.mkdir('build')
    if options.doc:
        build_help()
    elif options.loc:
        build_localizations(ui)
    elif options.updatepot:
        build_updatepot()
    elif options.mergepot:
        build_mergepot()
    elif options.normpo:
        build_normpo()
    elif options.cocoa_ext:
        build_cocoa_proxy_module()
        build_cocoa_bridging_interfaces()
    elif options.cocoa_compile:
        os.chdir('cocoa')
        print_and_do('{0} waf configure && {0} waf'.format(sys.executable))
        os.chdir('..')
        cocoa_app().copy_executable('cocoa/build/dupeGuru')
    elif options.xibless:
        build_cocoalib_xibless()
        build_xibless()
    else:
        build_normal(ui, options.dev)
Esempio n. 20
0
def main():
    options = parse_args()
    conf = json.load(open('conf.json'))
    edition = conf['edition']
    ui = conf['ui']
    dev = conf['dev']
    if dev:
        print("Building in Dev mode")
    if options.clean:
        for path in ['build', op.join('cocoa', 'build'), op.join('cocoa', 'autogen')]:
            if op.exists(path):
                shutil.rmtree(path)
    if not op.exists('build'):
        os.mkdir('build')
    if options.doc:
        build_help(edition)
    elif options.loc:
        build_localizations(ui, edition)
    elif options.updatepot:
        build_updatepot()
    elif options.mergepot:
        build_mergepot()
    elif options.normpo:
        build_normpo()
    elif options.cocoa_ext:
        build_cocoa_proxy_module()
        build_cocoa_bridging_interfaces(edition)
    elif options.cocoa_compile:
        os.chdir('cocoa')
        print_and_do('{0} waf configure --edition {1} && {0} waf'.format(sys.executable, edition))
        os.chdir('..')
        cocoa_app(edition).copy_executable('cocoa/build/dupeGuru')
    elif options.xibless:
        build_cocoalib_xibless()
        build_xibless(edition)
    else:
        build_normal(edition, ui, dev, conf)
Esempio n. 21
0
def main():
    options = parse_args()
    ui = options.ui
    if ui not in ('cocoa', 'qt'):
        ui = 'cocoa' if ISOSX else 'qt'
    if options.dev:
        print("Building in Dev mode")
    if options.clean:
        for path in ['build', op.join('cocoa', 'build'), op.join('cocoa', 'autogen')]:
            if op.exists(path):
                shutil.rmtree(path)
    if not op.exists('build'):
        os.mkdir('build')
    if options.doc:
        build_help()
    elif options.loc:
        build_localizations(ui)
    elif options.updatepot:
        build_updatepot()
    elif options.mergepot:
        build_mergepot()
    elif options.normpo:
        build_normpo()
    elif options.cocoa_ext:
        build_cocoa_proxy_module()
        build_cocoa_bridging_interfaces()
    elif options.cocoa_compile:
        os.chdir('cocoa')
        print_and_do('{0} waf configure && {0} waf'.format(sys.executable))
        os.chdir('..')
        cocoa_app().copy_executable('cocoa/build/dupeGuru')
    elif options.xibless:
        build_cocoalib_xibless()
        build_xibless()
    else:
        build_normal(ui, options.dev)
Esempio n. 22
0
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)