示例#1
0
def package_windows(edition, dev):
    if not ISWINDOWS:
        print("Qt packaging only works under Windows.")
        return
    add_to_pythonpath('.')
    app_version = get_module_version('core_{}'.format(edition))
    distdir = 'dist'

    if op.exists(distdir):
        shutil.rmtree(distdir)

    is64bit = platform.architecture()[0] == '64bit'
    # Since v4.2.3, cx_freeze started to falsely include tkinter in the package. We exclude it explicitly because of that.
    cmd = 'cxfreeze --base-name Win32GUI --target-dir "{0}" --target-name "{1}.exe" --icon {2} --exclude-modules tkinter run.py'
    target_name = {
        'se': 'dupeGuru',
        'me': 'dupeGuru ME',
        'pe': 'dupeGuru PE'
    }[edition]
    icon_path = 'images\\dg{0}_logo.ico'.format(edition)
    print_and_do(cmd.format(distdir, target_name, icon_path))

    if not dev:
        # Copy qt plugins
        plugin_dest = op.join(distdir, 'qt4_plugins')
        plugin_names = ['accessible', 'codecs', 'iconengines', 'imageformats']
        copy_qt_plugins(plugin_names, plugin_dest)

        # Compress with UPX
        if not is64bit:  # UPX doesn't work on 64 bit
            libs = [
                name for name in os.listdir(distdir)
                if op.splitext(name)[1] in ('.pyd', '.dll', '.exe')
            ]
            for lib in libs:
                print_and_do("upx --best \"{0}\"".format(op.join(distdir,
                                                                 lib)))

    help_path = op.join('build', 'help')
    print("Copying {} to dist\\help".format(help_path))
    shutil.copytree(help_path, op.join(distdir, 'help'))
    locale_path = op.join('build', 'locale')
    print("Copying {} to dist\\locale".format(locale_path))
    shutil.copytree(locale_path, op.join(distdir, 'locale'))
    # We don't install the VC redist as a prerequisite. We just bundle the appropriate dlls.
    shutil.copy(find_in_path('msvcr100.dll'), distdir)
    shutil.copy(find_in_path('msvcp100.dll'), distdir)

    # AdvancedInstaller.com has to be in your PATH
    # this is so we don'a have to re-commit installer.aip at every version change
    installer_file = 'installer64.aip' if is64bit else 'installer.aip'
    installer_path = op.join('qt', edition, installer_file)
    shutil.copy(installer_path, 'installer_tmp.aip')
    print_and_do(
        'AdvancedInstaller.com /edit installer_tmp.aip /SetVersion %s' %
        app_version)
    print_and_do('AdvancedInstaller.com /build installer_tmp.aip -force')
    os.remove('installer_tmp.aip')
    if op.exists('installer_tmp.back.aip'):
        os.remove('installer_tmp.back.aip')
示例#2
0
def package_windows(dev):
    if sys.platform != "win32":
        print("Qt packaging only works under Windows.")
        return
    add_to_pythonpath('.')
    add_to_pythonpath('qt')
    os.chdir('qt')
    from app import MusicGuru
    
    if op.exists('dist'):
        shutil.rmtree('dist')
    
    cmd = 'cxfreeze --base-name Win32GUI --target-name musicGuru.exe --icon ..\\images\\mg_logo.ico start.py'
    print_and_do(cmd)
    
    if not dev:
        # Copy qt plugins
        plugin_dest = op.join('dist', 'qt4_plugins')
        plugin_names = ['accessible', 'codecs', 'iconengines', 'imageformats']
        copy_qt_plugins(plugin_names, plugin_dest)
        
        # Compress with UPX 
        libs = [name for name in os.listdir('dist') if op.splitext(name)[1] in ('.pyd', '.dll', '.exe')]
        for lib in libs:
            print_and_do("upx --best \"dist\\{0}\"".format(lib))

    print_and_do("xcopy /Y /S /I ..\\help\\musicguru_help dist\\help")

    # AdvancedInstaller.com has to be in your PATH
    # this copying is so we don't have to re-commit installer.aip at every version change
    shutil.copy('installer.aip', 'installer_tmp.aip')
    print_and_do('AdvancedInstaller.com /edit installer_tmp.aip /SetVersion %s' % MusicGuru.VERSION)
    print_and_do('AdvancedInstaller.com /build installer_tmp.aip -force')
    os.remove('installer_tmp.aip')
    os.chdir(op.join('..', '..'))
示例#3
0
def build_cocoa_bridging_interfaces(edition):
    print("Building Cocoa Bridging Interfaces")
    import objp.o2p
    import objp.p2o
    add_to_pythonpath('cocoa')
    add_to_pythonpath('cocoalib')
    from cocoa.inter import (PyGUIObject, GUIObjectView, PyColumns, ColumnsView, PyOutline,
        OutlineView, PySelectableList, SelectableListView, PyTable, TableView, PyBaseApp,
        PyFairware, PyTextField, ProgressWindowView, PyProgressWindow)
    from inter.deletion_options import PyDeletionOptions, DeletionOptionsView
    from inter.details_panel import PyDetailsPanel, DetailsPanelView
    from inter.directory_outline import PyDirectoryOutline, DirectoryOutlineView
    from inter.prioritize_dialog import PyPrioritizeDialog, PrioritizeDialogView
    from inter.prioritize_list import PyPrioritizeList, PrioritizeListView
    from inter.problem_dialog import PyProblemDialog
    from inter.ignore_list_dialog import PyIgnoreListDialog, IgnoreListDialogView
    from inter.result_table import PyResultTable, ResultTableView
    from inter.stats_label import PyStatsLabel, StatsLabelView
    from inter.app import PyDupeGuruBase, DupeGuruView
    appmod = importlib.import_module('inter.app_{}'.format(edition))
    allclasses = [PyGUIObject, PyColumns, PyOutline, PySelectableList, PyTable, PyBaseApp, PyFairware,
        PyDetailsPanel, PyDirectoryOutline, PyPrioritizeDialog, PyPrioritizeList, PyProblemDialog,
        PyIgnoreListDialog, PyDeletionOptions, PyResultTable, PyStatsLabel, PyDupeGuruBase,
        PyTextField, PyProgressWindow, appmod.PyDupeGuru]
    for class_ in allclasses:
        objp.o2p.generate_objc_code(class_, 'cocoa/autogen', inherit=True)
    allclasses = [GUIObjectView, ColumnsView, OutlineView, SelectableListView, TableView,
        DetailsPanelView, DirectoryOutlineView, PrioritizeDialogView, PrioritizeListView,
        IgnoreListDialogView, DeletionOptionsView, ResultTableView, StatsLabelView,
        ProgressWindowView, DupeGuruView]
    clsspecs = [objp.o2p.spec_from_python_class(class_) for class_ in allclasses]
    objp.p2o.generate_python_proxy_code_from_clsspec(clsspecs, 'build/CocoaViews.m')
    build_cocoa_ext('CocoaViews', 'cocoa/inter', ['build/CocoaViews.m', 'build/ObjP.m'])
示例#4
0
def build_cocoa_bridging_interfaces():
    print("Building Cocoa Bridging Interfaces")
    import objp.o2p
    import objp.p2o
    add_to_pythonpath('cocoa')
    add_to_pythonpath('cocoalib')
    from cocoa.inter import (PyGUIObject, GUIObjectView, PyTable, TableView,
                             PyColumns, ColumnsView, PyBaseApp, BaseAppView,
                             PyTextField)
    from inter.app import PyPdfMasher, PdfMasherView
    from inter.build_pane import PyBuildPane
    from inter.edit_pane import PyEditPane, EditPaneView
    from inter.element_table import PyElementTable
    from inter.page_controller import PyPageController, PageControllerView
    from inter.page_repr import PyPageRepr, PageReprView
    allclasses = [
        PyGUIObject, PyTable, PyColumns, PyBaseApp, PyTextField, PyPdfMasher,
        PyBuildPane, PyEditPane, PyElementTable, PyPageController, PyPageRepr
    ]
    for class_ in allclasses:
        objp.o2p.generate_objc_code(class_, 'cocoa/autogen', inherit=True)
    allclasses = [
        GUIObjectView, TableView, ColumnsView, BaseAppView, EditPaneView,
        PageControllerView, PageReprView, PdfMasherView
    ]
    clsspecs = [
        objp.o2p.spec_from_python_class(class_) for class_ in allclasses
    ]
    objp.p2o.generate_python_proxy_code_from_clsspec(clsspecs,
                                                     'build/CocoaViews.m')
    build_cocoa_ext('CocoaViews', 'cocoa/inter',
                    ['build/CocoaViews.m', 'build/ObjP.m'])
示例#5
0
def build_normal(ui, dev):
    print("Building dupeGuru with UI {}".format(ui))
    add_to_pythonpath('.')
    print("Building dupeGuru")
    build_pe_modules(ui)
    if ui == 'cocoa':
        build_cocoa(dev)
    elif ui == 'qt':
        build_qt(dev)
示例#6
0
def build_normal(ui, dev):
    print("Building dupeGuru with UI {}".format(ui))
    add_to_pythonpath('.')
    print("Building dupeGuru")
    build_pe_modules(ui)
    if ui == 'cocoa':
        build_cocoa(dev)
    elif ui == 'qt':
        build_qt(dev)
示例#7
0
def build_normal(edition, ui, dev, conf):
    print("Building dupeGuru {0} with UI {1}".format(edition.upper(), ui))
    add_to_pythonpath('.')
    print("Building dupeGuru")
    if edition == 'pe':
        build_pe_modules(ui)
    if ui == 'cocoa':
        build_cocoa(edition, dev)
    elif ui == 'qt':
        build_qt(edition, dev, conf)
示例#8
0
def build_normal(edition, ui, dev, conf):
    print("Building dupeGuru {0} with UI {1}".format(edition.upper(), ui))
    add_to_pythonpath('.')
    print("Building dupeGuru")
    if edition == 'pe':
        build_pe_modules(ui)
    if ui == 'cocoa':
        build_cocoa(edition, dev)
    elif ui == 'qt':
        build_qt(edition, dev, conf)
示例#9
0
def build_normal():
    print("Building dupeGuru with UI qt")
    add_to_pythonpath(".")
    print("Building dupeGuru")
    build_pe_modules()
    print("Building localizations")
    build_localizations()
    print("Building Qt stuff")
    print_and_do("pyrcc5 {0} > {1}".format(Path("qt", "dg.qrc"), Path("qt", "dg_rc.py")))
    fix_qt_resource_file(Path("qt", "dg_rc.py"))
    build_help()
示例#10
0
def build_cocoa_bridging_interfaces():
    print("Building Cocoa Bridging Interfaces")
    import objp.o2p
    import objp.p2o
    import objp.const
    add_to_pythonpath('cocoa')
    add_to_pythonpath('cocoalib')
    from cocoa.inter import (PyGUIObject, GUIObjectView, PyTextField, PyTable, TableView, PyColumns,
        ColumnsView, PyOutline, PySelectableList, SelectableListView, PyBaseApp, BaseAppView)
    # This createPool() business is a bit hacky, but upon importing mg_cocoa, we call
    # install_gettext_trans_under_cocoa() which uses proxy functions (and thus need an active
    # autorelease pool). If we don't do that, we get leak warnings.
    from cocoa import proxy
    proxy.createPool()
    from mg_cocoa import (PyPanel, PanelView, PyBaseView,
        PyTableWithDate, PyCompletableEdit, PyDateWidget,
        PyCSVImportOptions, CSVImportOptionsView, PyImportTable, PySplitTable, PyLookup, LookupView,
        PyDateRangeSelector, DateRangeSelectorView, PyImportWindow, ImportWindowView,
        PyFilterBar, FilterBarView, PyReport, ReportView, PyScheduleTable, PyBudgetTable,
        PyEntryTable, PyTransactionTable, PyGeneralLedgerTable, PyChart, ChartView,
        PyAccountPanel, PyMassEditionPanel, PyBudgetPanel, BudgetPanelView, PyCustomDateRangePanel,
        PyAccountReassignPanel, PyExportPanel, ExportPanelView, PyPanelWithTransaction,
        PanelWithTransactionView, PyTransactionPanel, PySchedulePanel, SchedulePanelView,
        BaseViewView, PyAccountSheetView, PyTransactionView,
        PyAccountView, AccountViewView, PyScheduleView, PyBudgetView, PyCashculatorView,
        PyGeneralLedgerView, PyDocPropsView, PyEmptyView, PyReadOnlyPluginView, PyMainWindow,
        MainWindowView, PyDocument, DocumentView, PyMoneyGuruApp)
    from mg_cocoa import PyPrintView, PySplitPrint, PyTransactionPrint, PyEntryPrint
    allclasses = [PyGUIObject, PyTextField, PyTable, PyColumns, PyOutline, PySelectableList,
        PyBaseApp, PyPanel, PyBaseView, PyTableWithDate, PyCompletableEdit, PyDateWidget,
        PyCSVImportOptions, PyImportTable, PySplitTable, PyLookup, PyDateRangeSelector,
        PyImportWindow, PyFilterBar, PyReport, PyScheduleTable, PyBudgetTable,
        PyEntryTable, PyTransactionTable, PyGeneralLedgerTable, PyChart, PyAccountPanel,
        PyMassEditionPanel, PyBudgetPanel, PyCustomDateRangePanel, PyAccountReassignPanel,
        PyExportPanel, PyPanelWithTransaction, PyTransactionPanel, PySchedulePanel,
        PyAccountSheetView, PyTransactionView, PyAccountView, PyScheduleView, PyBudgetView,
        PyCashculatorView, PyGeneralLedgerView, PyDocPropsView, PyEmptyView, PyReadOnlyPluginView,
        PyMainWindow, PyDocument, PyMoneyGuruApp]
    proxy.destroyPool()
    allclasses += [PyPrintView, PySplitPrint, PyTransactionPrint, PyEntryPrint]
    for class_ in allclasses:
        objp.o2p.generate_objc_code(class_, 'cocoa/autogen', inherit=True)
    allclasses = [GUIObjectView, TableView, ColumnsView, SelectableListView, BaseAppView, 
        PanelView, CSVImportOptionsView, LookupView, DateRangeSelectorView, ImportWindowView,
        FilterBarView, ReportView, BudgetPanelView, ExportPanelView, PanelWithTransactionView,
        SchedulePanelView, BaseViewView, AccountViewView, MainWindowView,
        DocumentView, ChartView]
    clsspecs = [objp.o2p.spec_from_python_class(class_) for class_ in allclasses]
    objp.p2o.generate_python_proxy_code_from_clsspec(clsspecs, 'build/CocoaViews.m')
    py_folder = op.join(cocoa_app().resources, 'py')
    ensure_folder(py_folder)
    build_cocoa_ext('CocoaViews', py_folder, ['build/CocoaViews.m', 'build/ObjP.m'])
    import mg_const
    objp.const.generate_objc_code(mg_const, 'cocoa/autogen/PyConst.h')
示例#11
0
文件: run.py 项目: hsoft/musicguru
def main():
    conf = yaml.load(open('conf.yaml'))
    ui = conf['ui']
    print("Running musicGuru with UI {0}".format(ui))
    if ui == 'cocoa':
        os.system('open cocoa/build/Release/musicGuru.app')
    elif ui == 'qt':
        add_to_pythonpath('.')
        os.chdir('qt')
        os.system('python start.py')
        os.chdir('..')
示例#12
0
def build_normal():
    print("Building dupeGuru with UI qt")
    add_to_pythonpath('.')
    print("Building dupeGuru")
    build_pe_modules()
    print("Building localizations")
    build_localizations()
    print("Building Qt stuff")
    print_and_do("pyrcc5 {0} > {1}".format(op.join('qt', 'dg.qrc'),
                                           op.join('qt', 'dg_rc.py')))
    fix_qt_resource_file(op.join('qt', 'dg_rc.py'))
    build_help()
示例#13
0
def package_windows(edition, dev):
    if not ISWINDOWS:
        print("Qt packaging only works under Windows.")
        return
    add_to_pythonpath('.')
    app_version = get_module_version('core_{}'.format(edition))
    distdir = 'dist'
    
    if op.exists(distdir):
        shutil.rmtree(distdir)
    
    is64bit = platform.architecture()[0] == '64bit'
    # Since v4.2.3, cx_freeze started to falsely include tkinter in the package. We exclude it explicitly because of that.
    cmd = 'cxfreeze --base-name Win32GUI --target-dir "{0}" --target-name "{1}.exe" --icon {2} --exclude-modules tkinter run.py'
    target_name = {'se': 'dupeGuru', 'me': 'dupeGuru ME', 'pe': 'dupeGuru PE'}[edition]
    icon_path = 'images\\dg{0}_logo.ico'.format(edition)
    print_and_do(cmd.format(distdir, target_name, icon_path))
    
    if not dev:
        # Copy qt plugins
        plugin_dest = op.join(distdir, 'qt4_plugins')
        plugin_names = ['accessible', 'codecs', 'iconengines', 'imageformats']
        copy_qt_plugins(plugin_names, plugin_dest)
        
        # Compress with UPX 
        if not is64bit: # UPX doesn't work on 64 bit
            libs = [name for name in os.listdir(distdir) if op.splitext(name)[1] in ('.pyd', '.dll', '.exe')]
            for lib in libs:
                print_and_do("upx --best \"{0}\"".format(op.join(distdir, lib)))
    
    help_path = op.join('build', 'help')
    print("Copying {} to dist\\help".format(help_path))
    shutil.copytree(help_path, op.join(distdir, 'help'))
    locale_path = op.join('build', 'locale')
    print("Copying {} to dist\\locale".format(locale_path))
    shutil.copytree(locale_path, op.join(distdir, 'locale'))
    if is64bit:
        # In 64bit mode, we don't install the VC redist as a prerequisite. We just bundle the
        # appropriate dlls.
        shutil.copy(find_in_path('msvcr100.dll'), distdir)
        shutil.copy(find_in_path('msvcp100.dll'), distdir)

    # AdvancedInstaller.com has to be in your PATH
    # this is so we don'a have to re-commit installer.aip at every version change
    installer_file = 'installer64.aip' if is64bit else 'installer.aip'
    installer_path = op.join('qt', edition, installer_file)
    shutil.copy(installer_path, 'installer_tmp.aip')
    print_and_do('AdvancedInstaller.com /edit installer_tmp.aip /SetVersion %s' % app_version)
    print_and_do('AdvancedInstaller.com /build installer_tmp.aip -force')
    os.remove('installer_tmp.aip')
    if op.exists('installer_tmp.back.aip'):
        os.remove('installer_tmp.back.aip')
示例#14
0
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")
示例#15
0
文件: build.py 项目: hsoft/musicguru
def main():
    conf = yaml.load(open('conf.yaml'))
    ui = conf['ui']
    dev = conf['dev']
    print("Building musicGuru with UI {0}".format(ui))
    if dev:
        print("Building in Dev mode")
    add_to_pythonpath('.')

    print("Generating Help")
    windows = sys.platform == 'win32'
    profile = 'win_en' if windows else 'osx_en'
    basepath = op.abspath('help')
    destpath = op.abspath(op.join('help', 'musicguru_help'))
    helpgen.gen(basepath, destpath, profile=profile)
    if ui == 'cocoa':
        build_cocoa(dev)
    elif ui == 'qt':
        build_qt()
示例#16
0
文件: build.py 项目: hsoft/musicguru
def main():
    conf = yaml.load(open('conf.yaml'))
    ui = conf['ui']
    dev = conf['dev']
    print("Building musicGuru with UI {0}".format(ui))
    if dev:
        print("Building in Dev mode")
    add_to_pythonpath('.')
    
    print("Generating Help")
    windows = sys.platform == 'win32'
    profile = 'win_en' if windows else 'osx_en'
    basepath = op.abspath('help')
    destpath = op.abspath(op.join('help', 'musicguru_help'))
    helpgen.gen(basepath, destpath, profile=profile)
    if ui == 'cocoa':
        build_cocoa(dev)
    elif ui == 'qt':
        build_qt()
示例#17
0
def package_windows(dev):
    if sys.platform != "win32":
        print("Qt packaging only works under Windows.")
        return
    add_to_pythonpath('.')
    add_to_pythonpath('qt')
    os.chdir('qt')
    from app import MusicGuru

    if op.exists('dist'):
        shutil.rmtree('dist')

    cmd = 'cxfreeze --base-name Win32GUI --target-name musicGuru.exe --icon ..\\images\\mg_logo.ico start.py'
    print_and_do(cmd)

    if not dev:
        # Copy qt plugins
        plugin_dest = op.join('dist', 'qt4_plugins')
        plugin_names = ['accessible', 'codecs', 'iconengines', 'imageformats']
        copy_qt_plugins(plugin_names, plugin_dest)

        # Compress with UPX
        libs = [
            name for name in os.listdir('dist')
            if op.splitext(name)[1] in ('.pyd', '.dll', '.exe')
        ]
        for lib in libs:
            print_and_do("upx --best \"dist\\{0}\"".format(lib))

    print_and_do("xcopy /Y /S /I ..\\help\\musicguru_help dist\\help")

    # AdvancedInstaller.com has to be in your PATH
    # this copying is so we don't have to re-commit installer.aip at every version change
    shutil.copy('installer.aip', 'installer_tmp.aip')
    print_and_do(
        'AdvancedInstaller.com /edit installer_tmp.aip /SetVersion %s' %
        MusicGuru.VERSION)
    print_and_do('AdvancedInstaller.com /build installer_tmp.aip -force')
    os.remove('installer_tmp.aip')
    os.chdir(op.join('..', '..'))
示例#18
0
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")
示例#19
0
文件: build.py 项目: hsoft/pdfmasher
def build_cocoa_bridging_interfaces():
    print("Building Cocoa Bridging Interfaces")
    import objp.o2p
    import objp.p2o
    add_to_pythonpath('cocoa')
    add_to_pythonpath('cocoalib')
    from cocoa.inter import (PyGUIObject, GUIObjectView, PyTable, TableView, PyColumns,
        ColumnsView, PyBaseApp, BaseAppView, PyTextField)
    from inter.app import PyPdfMasher, PdfMasherView
    from inter.build_pane import PyBuildPane
    from inter.edit_pane import PyEditPane, EditPaneView
    from inter.element_table import PyElementTable
    from inter.page_controller import PyPageController, PageControllerView
    from inter.page_repr import PyPageRepr, PageReprView
    allclasses = [PyGUIObject, PyTable, PyColumns, PyBaseApp, PyTextField, PyPdfMasher,
        PyBuildPane, PyEditPane, PyElementTable, PyPageController, PyPageRepr]
    for class_ in allclasses:
        objp.o2p.generate_objc_code(class_, 'cocoa/autogen', inherit=True)
    allclasses = [GUIObjectView, TableView, ColumnsView, BaseAppView, EditPaneView,
        PageControllerView, PageReprView, PdfMasherView]
    clsspecs = [objp.o2p.spec_from_python_class(class_) for class_ in allclasses]
    objp.p2o.generate_python_proxy_code_from_clsspec(clsspecs, 'build/CocoaViews.m')
    build_cocoa_ext('CocoaViews', 'cocoa/inter', ['build/CocoaViews.m', 'build/ObjP.m'])
示例#20
0
def package_windows(edition, dev):
    if not ISWINDOWS:
        print("Qt packaging only works under Windows.")
        return
    from cx_Freeze import setup, Executable
    from PyQt5.QtCore import QLibraryInfo
    add_to_pythonpath('.')
    app_version = get_module_version('core_{}'.format(edition))
    distdir = 'dist'

    if op.exists(distdir):
        shutil.rmtree(distdir)

    if not dev:
        # Copy qt plugins
        plugin_dest = distdir
        plugin_names = ['accessible', 'codecs', 'iconengines', 'imageformats']
        copy_qt_plugins(plugin_names, plugin_dest)

    # Since v4.2.3, cx_freeze started to falsely include tkinter in the package. We exclude it explicitly because of that.
    options = {
        'build_exe': {
            'includes': 'atexit',
            'excludes': ['tkinter'],
            'bin_excludes': ['icudt51', 'icuin51.dll', 'icuuc51.dll'],
            'icon': 'images\\dg{0}_logo.ico'.format(edition),
            'include_msvcr': True,
        },
        'install_exe': {
            'install_dir': 'dist',
        }
    }

    executables = [
        Executable(
            'run.py',
            base='Win32GUI',
            targetDir=distdir,
            targetName={'se': 'dupeGuru', 'me': 'dupeGuru ME', 'pe': 'dupeGuru PE'}[edition] + '.exe',
        )
    ]

    setup(
        script_args=['install'],
        options=options,
        executables=executables
    )

    print("Removing useless files")
    # Debug info that cx_freeze brings in.
    for fn in glob.glob(op.join(distdir, '*', '*.pdb')):
        os.remove(fn)
    print("Copying forgotten DLLs")
    qtlibpath = QLibraryInfo.location(QLibraryInfo.LibrariesPath)
    shutil.copy(op.join(qtlibpath, 'libEGL.dll'), distdir)
    shutil.copy(find_in_path('msvcp110.dll'), distdir)
    print("Copying the rest")
    help_path = op.join('build', 'help')
    print("Copying {} to dist\\help".format(help_path))
    shutil.copytree(help_path, op.join(distdir, 'help'))
    locale_path = op.join('build', 'locale')
    print("Copying {} to dist\\locale".format(locale_path))
    shutil.copytree(locale_path, op.join(distdir, 'locale'))

    # AdvancedInstaller.com has to be in your PATH
    # this is so we don'a have to re-commit installer.aip at every version change
    installer_file = 'installer.aip'
    installer_path = op.join('qt', edition, installer_file)
    shutil.copy(installer_path, 'installer_tmp.aip')
    print_and_do('AdvancedInstaller.com /edit installer_tmp.aip /SetVersion %s' % app_version)
    print_and_do('AdvancedInstaller.com /build installer_tmp.aip -force')
    os.remove('installer_tmp.aip')
    if op.exists('installer_tmp.back.aip'):
        os.remove('installer_tmp.back.aip')
示例#21
0
def build_cocoa_bridging_interfaces():
    print("Building Cocoa Bridging Interfaces")
    import objp.o2p
    import objp.p2o
    import objp.const
    add_to_pythonpath('cocoa')
    add_to_pythonpath('cocoalib')
    from cocoa.inter import (PyGUIObject, GUIObjectView, PyTextField, PyTable,
                             TableView, PyColumns, ColumnsView, PyOutline,
                             PySelectableList, SelectableListView, PyBaseApp,
                             BaseAppView)
    # This createPool() business is a bit hacky, but upon importing mg_cocoa, we call
    # install_gettext_trans_under_cocoa() which uses proxy functions (and thus need an active
    # autorelease pool). If we don't do that, we get leak warnings.
    from cocoa import proxy
    proxy.createPool()
    from mg_cocoa import (
        PyPanel, PanelView, PyBaseView, PyTableWithDate, PyCompletableEdit,
        PyDateWidget, PyCSVImportOptions, CSVImportOptionsView, PyImportTable,
        PySplitTable, PyLookup, LookupView, PyDateRangeSelector,
        DateRangeSelectorView, PyImportWindow, ImportWindowView, PyFilterBar,
        FilterBarView, PyReport, ReportView, PyScheduleTable, PyBudgetTable,
        PyEntryTable, PyTransactionTable, PyGeneralLedgerTable, PyChart,
        ChartView, PyAccountPanel, PyMassEditionPanel, PyBudgetPanel,
        BudgetPanelView, PyCustomDateRangePanel, PyAccountReassignPanel,
        PyExportPanel, ExportPanelView, PyPanelWithTransaction,
        PanelWithTransactionView, PyTransactionPanel, PySchedulePanel,
        SchedulePanelView, BaseViewView, PyAccountSheetView, PyTransactionView,
        PyAccountView, AccountViewView, PyScheduleView, PyBudgetView,
        PyGeneralLedgerView, PyDocPropsView, PyPluginListView, PyEmptyView,
        PyReadOnlyPluginView, PyMainWindow, MainWindowView, PyDocument,
        DocumentView, PyMoneyGuruApp)
    from mg_cocoa import PyPrintView, PySplitPrint, PyTransactionPrint, PyEntryPrint
    allclasses = [
        PyGUIObject, PyTextField, PyTable, PyColumns, PyOutline,
        PySelectableList, PyBaseApp, PyPanel, PyBaseView, PyTableWithDate,
        PyCompletableEdit, PyDateWidget, PyCSVImportOptions, PyImportTable,
        PySplitTable, PyLookup, PyDateRangeSelector, PyImportWindow,
        PyFilterBar, PyReport, PyScheduleTable, PyBudgetTable, PyEntryTable,
        PyTransactionTable, PyGeneralLedgerTable, PyChart, PyAccountPanel,
        PyMassEditionPanel, PyBudgetPanel, PyCustomDateRangePanel,
        PyAccountReassignPanel, PyExportPanel, PyPanelWithTransaction,
        PyTransactionPanel, PySchedulePanel, PyAccountSheetView,
        PyTransactionView, PyAccountView, PyScheduleView, PyBudgetView,
        PyGeneralLedgerView, PyDocPropsView, PyPluginListView, PyEmptyView,
        PyReadOnlyPluginView, PyMainWindow, PyDocument, PyMoneyGuruApp
    ]
    proxy.destroyPool()
    allclasses += [PyPrintView, PySplitPrint, PyTransactionPrint, PyEntryPrint]
    for class_ in allclasses:
        objp.o2p.generate_objc_code(class_, 'cocoa/autogen', inherit=True)
    allclasses = [
        GUIObjectView, TableView, ColumnsView, SelectableListView, BaseAppView,
        PanelView, CSVImportOptionsView, LookupView, DateRangeSelectorView,
        ImportWindowView, FilterBarView, ReportView, BudgetPanelView,
        ExportPanelView, PanelWithTransactionView, SchedulePanelView,
        BaseViewView, AccountViewView, MainWindowView, DocumentView, ChartView
    ]
    clsspecs = [
        objp.o2p.spec_from_python_class(class_) for class_ in allclasses
    ]
    objp.p2o.generate_python_proxy_code_from_clsspec(clsspecs,
                                                     'build/CocoaViews.m')
    py_folder = op.join(cocoa_app().resources, 'py')
    ensure_folder(py_folder)
    build_cocoa_ext('CocoaViews', py_folder,
                    ['build/CocoaViews.m', 'build/ObjP.m'])
    import mg_const
    objp.const.generate_objc_code(mg_const, 'cocoa/autogen/PyConst.h')
示例#22
0
def package_windows(edition, dev):
    if not ISWINDOWS:
        print("Qt packaging only works under Windows.")
        return
    from cx_Freeze import setup, Executable
    from PyQt5.QtCore import QLibraryInfo
    add_to_pythonpath('.')
    app_version = get_module_version('core_{}'.format(edition))
    distdir = 'dist'

    if op.exists(distdir):
        shutil.rmtree(distdir)

    if not dev:
        # Copy qt plugins
        plugin_dest = distdir
        plugin_names = ['accessible', 'codecs', 'iconengines', 'imageformats']
        copy_qt_plugins(plugin_names, plugin_dest)

    # Since v4.2.3, cx_freeze started to falsely include tkinter in the package. We exclude it
    # explicitly because of that.
    options = {
        'build_exe': {
            'includes': 'atexit',
            'excludes': ['tkinter'],
            'bin_excludes': ['icudt51', 'icuin51.dll', 'icuuc51.dll'],
            'icon': 'images\\dg{0}_logo.ico'.format(edition),
            'include_msvcr': True,
        },
        'install_exe': {
            'install_dir': 'dist',
        }
    }

    executables = [
        Executable(
            'run.py',
            base='Win32GUI',
            targetDir=distdir,
            targetName={'se': 'dupeGuru', 'me': 'dupeGuru ME', 'pe': 'dupeGuru PE'}[edition] + '.exe',
        )
    ]

    setup(
        script_args=['install'],
        options=options,
        executables=executables
    )

    print("Removing useless files")
    # Debug info that cx_freeze brings in.
    for fn in glob.glob(op.join(distdir, '*', '*.pdb')):
        os.remove(fn)
    print("Copying forgotten DLLs")
    qtlibpath = QLibraryInfo.location(QLibraryInfo.LibrariesPath)
    shutil.copy(op.join(qtlibpath, 'libEGL.dll'), distdir)
    shutil.copy(find_in_path('msvcp110.dll'), distdir)
    print("Copying the rest")
    help_path = op.join('build', 'help')
    print("Copying {} to dist\\help".format(help_path))
    shutil.copytree(help_path, op.join(distdir, 'help'))
    locale_path = op.join('build', 'locale')
    print("Copying {} to dist\\locale".format(locale_path))
    shutil.copytree(locale_path, op.join(distdir, 'locale'))

    # AdvancedInstaller.com has to be in your PATH
    # this is so we don'a have to re-commit installer.aip at every version change
    installer_file = 'installer.aip'
    installer_path = op.join('qt', edition, installer_file)
    shutil.copy(installer_path, 'installer_tmp.aip')
    print_and_do('AdvancedInstaller.com /edit installer_tmp.aip /SetVersion %s' % app_version)
    print_and_do('AdvancedInstaller.com /build installer_tmp.aip -force')
    os.remove('installer_tmp.aip')
    if op.exists('installer_tmp.back.aip'):
        os.remove('installer_tmp.back.aip')
示例#23
0
def build_normal(dev):
    print("Building dupeGuru with UI cocoa")
    add_to_pythonpath('.')
    build_pe_modules()
    build_cocoa(dev)