Beispiel #1
0
def build_help():
    print("Generating Help")
    current_platform = 'osx' if ISOSX else 'win'
    current_path = op.abspath('.')
    confpath = op.join(current_path, 'help', 'conf.tmpl')
    help_basepath = op.join(current_path, 'help', 'en')
    help_destpath = op.join(current_path, 'build', 'help')
    changelog_path = op.join(current_path, 'help', 'changelog')
    credits_path = op.join(current_path, 'help', 'credits.rst')
    credits_tmpl = op.join(help_basepath, 'credits.tmpl')
    credits_out = op.join(help_basepath, 'credits.rst')
    filereplace(credits_tmpl,
                credits_out,
                credits=open(credits_path, 'rt', encoding='utf-8').read())
    image_src = op.join(current_path, 'help',
                        'image_{}'.format(current_platform))
    image_dst = op.join(current_path, 'help', 'en', 'image')
    if not op.exists(image_dst):
        try:
            os.symlink(image_src, image_dst)
        except (NotImplementedError,
                OSError):  # Windows crappy symlink support
            shutil.copytree(image_src, image_dst)
    tixurl = "https://github.com/hsoft/moneyguru/issues/{}"
    confrepl = {'platform': current_platform}
    sphinxgen.gen(help_basepath, help_destpath, changelog_path, tixurl,
                  confrepl, confpath)
Beispiel #2
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)
Beispiel #3
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)
Beispiel #4
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)
Beispiel #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)
Beispiel #6
0
def build_qt(edition, dev, conf):
    print("Building localizations")
    build_localizations('qt', edition)
    print("Building Qt stuff")
    print_and_do("pyrcc4 -py3 {0} > {1}".format(op.join('qt', 'base', 'dg.qrc'), op.join('qt', 'base', 'dg_rc.py')))
    fix_qt_resource_file(op.join('qt', 'base', 'dg_rc.py'))
    print("Creating the run.py file")
    filereplace(op.join('qt', 'run_template.py'), 'run.py', edition=edition)
Beispiel #7
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)
Beispiel #8
0
def package_arch():
    # For now, package_arch() will only copy the source files into build/. It copies less packages
    # than package_debian because there are more python packages available in Arch (so we don't
    # need to include them).
    print("Packaging for Arch")
    srcpath = op.join("build", "dupeguru-arch")
    packages = ["hscommon", "core", "qtlib", "qt", "send2trash"]
    copy_files_to_package(srcpath, packages, with_so=True)
    shutil.copy(op.join("images", "dgse_logo_128.png"), srcpath)
    debopts = json.load(open(op.join("pkg", "arch", "dupeguru.json")))
    filereplace(op.join("pkg", "arch", "dupeguru.desktop"),
                op.join(srcpath, "dupeguru.desktop"), **debopts)
Beispiel #9
0
def package_arch():
    # For now, package_arch() will only copy the source files into build/. It copies less packages
    # than package_debian because there are more python packages available in Arch (so we don't
    # need to include them).
    print("Packaging for Arch")
    srcpath = op.join('build', 'dupeguru-arch')
    packages = [
        'hscommon', 'core', 'qtlib', 'qt', 'send2trash', 'hsaudiotag',
    ]
    copy_files_to_package(srcpath, packages, with_so=True)
    shutil.copy(op.join('images', 'dgse_logo_128.png'), srcpath)
    debopts = json.load(open(op.join('pkg', 'arch', 'dupeguru.json')))
    filereplace(op.join('pkg', 'arch', 'dupeguru.desktop'), op.join(srcpath, 'dupeguru.desktop'), **debopts)
Beispiel #10
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')
Beispiel #11
0
def package_arch(edition):
    # For now, package_arch() will only copy the source files into build/. It copies less packages
    # than package_debian because there are more python packages available in Arch (so we don't
    # need to include them).
    print("Packaging for Arch")
    ed = lambda s: s.format(edition)
    srcpath = op.join('build', ed('dupeguru-{}-arch'))
    packages = ['hscommon', 'core', ed('core_{0}'), 'qtlib', 'qt', 'send2trash']
    if edition == 'me':
        packages.append('hsaudiotag')
    copy_files_to_package(srcpath, packages, with_so=True)
    shutil.copy(op.join('images', ed('dg{}_logo_128.png')), srcpath)
    debopts = json.load(open(op.join('pkg', 'arch', ed('{}.json'))))
    filereplace(op.join('pkg', 'arch', 'dupeguru.desktop'), op.join(srcpath, ed('dupeguru-{}.desktop')), **debopts)
Beispiel #12
0
def package_arch(edition):
    # For now, package_arch() will only copy the source files into build/. It copies less packages
    # than package_debian because there are more python packages available in Arch (so we don't
    # need to include them).
    print("Packaging for Arch")
    ed = lambda s: s.format(edition)
    srcpath = op.join('build', ed('dupeguru-{}-arch'))
    packages = ['hscommon', 'core', ed('core_{0}'), 'qtlib', 'qt', 'send2trash']
    if edition == 'me':
        packages.append('hsaudiotag')
    copy_files_to_package(srcpath, packages, with_so=True)
    shutil.copy(op.join('images', ed('dg{}_logo_128.png')), srcpath)
    debopts = json.load(open(op.join('pkg', 'arch', ed('{}.json'))))
    filereplace(op.join('pkg', 'arch', 'dupeguru.desktop'), op.join(srcpath, ed('dupeguru-{}.desktop')), **debopts)
Beispiel #13
0
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')
Beispiel #14
0
def package_arch():
    # For now, package_arch() will only copy the source files into build/. It copies less packages
    # than package_debian because there are more python packages available in Arch (so we don't
    # need to include them).
    print("Packaging for Arch")
    srcpath = op.join('build', 'dupeguru-arch')
    packages = [
        'hscommon',
        'core',
        'qtlib',
        'qt',
        'send2trash',
        'hsaudiotag',
    ]
    copy_files_to_package(srcpath, packages, with_so=True)
    shutil.copy(op.join('images', 'dgse_logo_128.png'), srcpath)
    debopts = json.load(open(op.join('pkg', 'arch', 'dupeguru.json')))
    filereplace(op.join('pkg', 'arch', 'dupeguru.desktop'),
                op.join(srcpath, 'dupeguru.desktop'), **debopts)
Beispiel #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')
Beispiel #16
0
def package_debian_distribution(distribution):
    app_version = get_module_version('core')
    version = '{}~{}'.format(app_version, distribution)
    destpath = op.join('build', 'dupeguru-{}'.format(version))
    srcpath = op.join(destpath, 'src')
    packages = [
        'hscommon', 'core', 'qtlib', 'qt', 'send2trash', 'hsaudiotag'
    ]
    copy_files_to_package(srcpath, packages, with_so=False)
    os.mkdir(op.join(destpath, 'modules'))
    copy_all(op.join('core', 'pe', 'modules', '*.*'), op.join(destpath, 'modules'))
    copy(op.join('qt', 'pe', 'modules', 'block.c'), op.join(destpath, 'modules', 'block_qt.c'))
    copy(op.join('pkg', 'debian', 'build_pe_modules.py'), op.join(destpath, 'build_pe_modules.py'))
    debdest = op.join(destpath, 'debian')
    debskel = op.join('pkg', 'debian')
    os.makedirs(debdest)
    debopts = json.load(open(op.join(debskel, 'dupeguru.json')))
    for fn in ['compat', 'copyright', 'dirs', 'rules']:
        copy(op.join(debskel, fn), op.join(debdest, fn))
    filereplace(op.join(debskel, 'control'), op.join(debdest, 'control'), **debopts)
    filereplace(op.join(debskel, 'Makefile'), op.join(destpath, 'Makefile'), **debopts)
    filereplace(op.join(debskel, 'dupeguru.desktop'), op.join(debdest, 'dupeguru.desktop'), **debopts)
    changelogpath = op.join('help', 'changelog')
    changelog_dest = op.join(debdest, 'changelog')
    project_name = debopts['pkgname']
    from_version = '2.9.2'
    build_debian_changelog(
        changelogpath, changelog_dest, project_name, from_version=from_version,
        distribution=distribution
    )
    shutil.copy(op.join('images', 'dgse_logo_128.png'), srcpath)
    os.chdir(destpath)
    cmd = "dpkg-buildpackage -S"
    os.system(cmd)
    os.chdir('../..')
Beispiel #17
0
def package_debian_distribution(edition, distribution):
    app_version = get_module_version('core_{}'.format(edition))
    version = '{}~{}'.format(app_version, distribution)
    ed = lambda s: s.format(edition)
    destpath = op.join('build', 'dupeguru-{0}-{1}'.format(edition, version))
    srcpath = op.join(destpath, 'src')
    packages = ['hscommon', 'core', ed('core_{0}'), 'qtlib', 'qt', 'send2trash', 'jobprogress']
    if edition == 'me':
        packages.append('hsaudiotag')
    copy_files_to_package(srcpath, packages, with_so=False)
    if edition == 'pe':
        os.mkdir(op.join(destpath, 'modules'))
        copy_all(op.join('core_pe', 'modules', '*.*'), op.join(destpath, 'modules'))
        copy(op.join('qt', 'pe', 'modules', 'block.c'), op.join(destpath, 'modules', 'block_qt.c'))
        copy(op.join('debian', 'build_pe_modules.py'), op.join(destpath, 'build_pe_modules.py'))
    debdest = op.join(destpath, 'debian')
    os.makedirs(debdest)
    debopts = json.load(open(op.join('debian', ed('{}.json'))))
    for fn in ['compat', 'copyright', 'dirs', 'rules']:
        copy(op.join('debian', fn), op.join(debdest, fn))
    filereplace(op.join('debian', 'control'), op.join(debdest, 'control'), **debopts)
    filereplace(op.join('debian', 'Makefile'), op.join(destpath, 'Makefile'), **debopts)
    filereplace(op.join('debian', 'dupeguru.desktop'), op.join(debdest, ed('dupeguru_{}.desktop')), **debopts)
    changelogpath = op.join('help', ed('changelog_{}'))
    changelog_dest = op.join(debdest, 'changelog')
    project_name = debopts['pkgname']
    from_version = {'se': '2.9.2', 'me': '5.7.2', 'pe': '1.8.5'}[edition]
    build_debian_changelog(changelogpath, changelog_dest, project_name, from_version=from_version,
        distribution=distribution)
    shutil.copy(op.join('images', ed('dg{0}_logo_128.png')), srcpath)
    os.chdir(destpath)
    cmd = "dpkg-buildpackage -S"
    os.system(cmd)
    os.chdir('../..')
Beispiel #18
0
def package_debian_distribution(edition, distribution):
    app_version = get_module_version('core_{}'.format(edition))
    version = '{}~{}'.format(app_version, distribution)
    ed = lambda s: s.format(edition)
    destpath = op.join('build', 'dupeguru-{0}-{1}'.format(edition, version))
    srcpath = op.join(destpath, 'src')
    packages = ['hscommon', 'core', ed('core_{0}'), 'qtlib', 'qt', 'send2trash']
    if edition == 'me':
        packages.append('hsaudiotag')
    copy_files_to_package(srcpath, packages, with_so=False)
    if edition == 'pe':
        os.mkdir(op.join(destpath, 'modules'))
        copy_all(op.join('core_pe', 'modules', '*.*'), op.join(destpath, 'modules'))
        copy(op.join('qt', 'pe', 'modules', 'block.c'), op.join(destpath, 'modules', 'block_qt.c'))
        copy(op.join('pkg', 'debian', 'build_pe_modules.py'), op.join(destpath, 'build_pe_modules.py'))
    debdest = op.join(destpath, 'debian')
    debskel = op.join('pkg', 'debian')
    os.makedirs(debdest)
    debopts = json.load(open(op.join(debskel, ed('{}.json'))))
    for fn in ['compat', 'copyright', 'dirs', 'rules']:
        copy(op.join(debskel, fn), op.join(debdest, fn))
    filereplace(op.join(debskel, 'control'), op.join(debdest, 'control'), **debopts)
    filereplace(op.join(debskel, 'Makefile'), op.join(destpath, 'Makefile'), **debopts)
    filereplace(op.join(debskel, 'dupeguru.desktop'), op.join(debdest, ed('dupeguru_{}.desktop')), **debopts)
    changelogpath = op.join('help', ed('changelog_{}'))
    changelog_dest = op.join(debdest, 'changelog')
    project_name = debopts['pkgname']
    from_version = {'se': '2.9.2', 'me': '5.7.2', 'pe': '1.8.5'}[edition]
    build_debian_changelog(changelogpath, changelog_dest, project_name, from_version=from_version,
        distribution=distribution)
    shutil.copy(op.join('images', ed('dg{0}_logo_128.png')), srcpath)
    os.chdir(destpath)
    cmd = "dpkg-buildpackage -S"
    os.system(cmd)
    os.chdir('../..')
Beispiel #19
0
def build_help():
    print("Generating Help")
    current_platform = "osx" if ISOSX else "win"
    current_path = op.abspath(".")
    confpath = op.join(current_path, "help", "conf.tmpl")
    help_basepath = op.join(current_path, "help", "en")
    help_destpath = op.join(current_path, "build", "help")
    changelog_path = op.join(current_path, "help", "changelog")
    credits_path = op.join(current_path, "help", "credits.rst")
    credits_tmpl = op.join(help_basepath, "credits.tmpl")
    credits_out = op.join(help_basepath, "credits.rst")
    filereplace(credits_tmpl, credits_out, credits=open(credits_path, "rt", encoding="utf-8").read())
    image_src = op.join(current_path, "help", "image_{}".format(current_platform))
    image_dst = op.join(current_path, "help", "en", "image")
    if not op.exists(image_dst):
        try:
            os.symlink(image_src, image_dst)
        except (NotImplementedError, OSError):  # Windows crappy symlink support
            shutil.copytree(image_src, image_dst)
    tixurl = "https://github.com/hsoft/moneyguru/issues/{}"
    confrepl = {"platform": current_platform}
    sphinxgen.gen(help_basepath, help_destpath, changelog_path, tixurl, confrepl, confpath)
Beispiel #20
0
def build_help():
    print("Generating Help")
    current_platform = 'osx' if ISOSX else 'win'
    current_path = op.abspath('.')
    confpath = op.join(current_path, 'help', 'conf.tmpl')
    help_basepath = op.join(current_path, 'help', 'en')
    help_destpath = op.join(current_path, 'build', 'help')
    changelog_path = op.join(current_path, 'help', 'changelog')
    credits_path = op.join(current_path, 'help', 'credits.rst')
    credits_tmpl = op.join(help_basepath, 'credits.tmpl')
    credits_out = op.join(help_basepath, 'credits.rst')
    filereplace(credits_tmpl, credits_out, credits=open(credits_path, 'rt', encoding='utf-8').read())
    image_src = op.join(current_path, 'help', 'image_{}'.format(current_platform))
    image_dst = op.join(current_path, 'help', 'en', 'image')
    if not op.exists(image_dst):
        try:
            os.symlink(image_src, image_dst)
        except (NotImplementedError, OSError): # Windows crappy symlink support
            shutil.copytree(image_src, image_dst)
    tixurl = "https://github.com/hsoft/moneyguru/issues/{}"
    confrepl = {'platform': current_platform}
    sphinxgen.gen(help_basepath, help_destpath, changelog_path, tixurl, confrepl, confpath)
Beispiel #21
0
def package_debian_distribution(distribution):
    app_version = get_module_version("core")
    version = "{}~{}".format(app_version, distribution)
    destpath = op.join("build", "dupeguru-{}".format(version))
    srcpath = op.join(destpath, "src")
    packages = ["hscommon", "core", "qtlib", "qt", "send2trash", "hsaudiotag"]
    copy_files_to_package(srcpath, packages, with_so=False)
    os.mkdir(op.join(destpath, "modules"))
    copy_all(op.join("core", "pe", "modules", "*.*"),
             op.join(destpath, "modules"))
    copy(
        op.join("qt", "pe", "modules", "block.c"),
        op.join(destpath, "modules", "block_qt.c"),
    )
    copy(
        op.join("pkg", "debian", "build_pe_modules.py"),
        op.join(destpath, "build_pe_modules.py"),
    )
    debdest = op.join(destpath, "debian")
    debskel = op.join("pkg", "debian")
    os.makedirs(debdest)
    debopts = json.load(open(op.join(debskel, "dupeguru.json")))
    for fn in ["compat", "copyright", "dirs", "rules", "source"]:
        copy(op.join(debskel, fn), op.join(debdest, fn))
    filereplace(op.join(debskel, "control"), op.join(debdest, "control"),
                **debopts)
    filereplace(op.join(debskel, "Makefile"), op.join(destpath, "Makefile"),
                **debopts)
    filereplace(op.join(debskel, "dupeguru.desktop"),
                op.join(debdest, "dupeguru.desktop"), **debopts)
    changelogpath = op.join("help", "changelog")
    changelog_dest = op.join(debdest, "changelog")
    project_name = debopts["pkgname"]
    from_version = "2.9.2"
    build_debian_changelog(
        changelogpath,
        changelog_dest,
        project_name,
        from_version=from_version,
        distribution=distribution,
    )
    shutil.copy(op.join("images", "dgse_logo_128.png"), srcpath)
    os.chdir(destpath)
    cmd = "dpkg-buildpackage -F -us -uc"
    os.system(cmd)
    os.chdir("../..")
Beispiel #22
0
def package_debian_distribution(distribution):
    app_version = get_module_version('core')
    version = '{}~{}'.format(app_version, distribution)
    destpath = op.join('build', 'dupeguru-{}'.format(version))
    srcpath = op.join(destpath, 'src')
    packages = ['hscommon', 'core', 'qtlib', 'qt', 'send2trash', 'hsaudiotag']
    copy_files_to_package(srcpath, packages, with_so=False)
    os.mkdir(op.join(destpath, 'modules'))
    copy_all(op.join('core', 'pe', 'modules', '*.*'),
             op.join(destpath, 'modules'))
    copy(op.join('qt', 'pe', 'modules', 'block.c'),
         op.join(destpath, 'modules', 'block_qt.c'))
    copy(op.join('pkg', 'debian', 'build_pe_modules.py'),
         op.join(destpath, 'build_pe_modules.py'))
    debdest = op.join(destpath, 'debian')
    debskel = op.join('pkg', 'debian')
    os.makedirs(debdest)
    debopts = json.load(open(op.join(debskel, 'dupeguru.json')))
    for fn in ['compat', 'copyright', 'dirs', 'rules', 'source']:
        copy(op.join(debskel, fn), op.join(debdest, fn))
    filereplace(op.join(debskel, 'control'), op.join(debdest, 'control'),
                **debopts)
    filereplace(op.join(debskel, 'Makefile'), op.join(destpath, 'Makefile'),
                **debopts)
    filereplace(op.join(debskel, 'dupeguru.desktop'),
                op.join(debdest, 'dupeguru.desktop'), **debopts)
    changelogpath = op.join('help', 'changelog')
    changelog_dest = op.join(debdest, 'changelog')
    project_name = debopts['pkgname']
    from_version = '2.9.2'
    build_debian_changelog(changelogpath,
                           changelog_dest,
                           project_name,
                           from_version=from_version,
                           distribution=distribution)
    shutil.copy(op.join('images', 'dgse_logo_128.png'), srcpath)
    os.chdir(destpath)
    cmd = "dpkg-buildpackage -S -us -uc"
    os.system(cmd)
    os.chdir('../..')
Beispiel #23
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)