예제 #1
0
    def handle(self, *args, **options):
        db_ptl_buildversion = get_pootle_build(DEFAULT_POOTLE_BUILDVERSION)
        db_tt_buildversion = get_toolkit_build(DEFAULT_TT_BUILDVERSION)

        ptl_changed = db_ptl_buildversion < CODE_PTL_BUILDVERSION
        tt_changed = db_tt_buildversion < CODE_TTK_BUILDVERSION

        if ptl_changed or tt_changed:
            if ptl_changed:
                logging.info('Detected new Pootle version: %d.',
                             CODE_PTL_BUILDVERSION)
                save_build_version('pootle', CODE_PTL_BUILDVERSION)

            if tt_changed:
                logging.info('Detected new Translate Toolkit version: %d.',
                             CODE_TTK_BUILDVERSION)
                save_build_version('ttk', CODE_TTK_BUILDVERSION)

            # Perform the option related actions.
            if options['calculate_stats']:
                calculate_stats()

            if options['flush_qc']:
                flush_quality_checks()

            logging.info('Done.')
        else:
            logging.info(
                'You are already up to date! Current build versions:\n'
                '- Pootle: %s\n'
                '- Translate Toolkit: %s',
                CODE_PTL_BUILDVERSION,
                CODE_TTK_BUILDVERSION,
            )
예제 #2
0
파일: upgrade.py 프로젝트: mtr/pootle
    def handle(self, *args, **options):
        db_ptl_buildversion = get_pootle_build(DEFAULT_POOTLE_BUILDVERSION)
        db_tt_buildversion = get_toolkit_build(DEFAULT_TT_BUILDVERSION)

        ptl_changed = db_ptl_buildversion < CODE_PTL_BUILDVERSION
        tt_changed = db_tt_buildversion < CODE_TTK_BUILDVERSION

        if ptl_changed or tt_changed:
            if ptl_changed:
                logging.info('Detected new Pootle version: %d.',
                             CODE_PTL_BUILDVERSION)
                save_build_version('pootle', CODE_PTL_BUILDVERSION)

            if tt_changed:
                logging.info('Detected new Translate Toolkit version: %d.',
                             CODE_TTK_BUILDVERSION)
                save_build_version('ttk', CODE_TTK_BUILDVERSION)

            # Perform the option related actions.
            if options['calculate_stats']:
                calculate_stats()

            if options['flush_qc']:
                flush_quality_checks()

            logging.info('Done.')
        else:
            logging.info(
                    'You are already up to date! Current build versions:\n'
                    '- Pootle: %s\n'
                    '- Translate Toolkit: %s',
                CODE_PTL_BUILDVERSION, CODE_TTK_BUILDVERSION,
            )
예제 #3
0
파일: upgrade.py 프로젝트: atassumer/pootle
    def handle(self, *args, **options):
        db_ptl_buildversion = get_pootle_build(DEFAULT_POOTLE_BUILDVERSION)
        db_tt_buildversion = get_toolkit_build(DEFAULT_TT_BUILDVERSION)

        ptl_changed = db_ptl_buildversion < code_ptl_buildversion
        tt_changed = db_tt_buildversion < code_tt_buildversion

        if ptl_changed or tt_changed:

            if ptl_changed:
                logging.info('Detected new Pootle version: %d.',
                             code_ptl_buildversion)
            else:
                db_ptl_buildversion = 0

            if tt_changed:
                logging.info('Detected new Translate Toolkit version: %d.',
                             code_tt_buildversion)
            else:
                db_tt_buildversion = 0

            logging.info('Running the upgrade machinery...')

            from pootle_misc.upgrade import run_upgrade
            run_upgrade(db_ptl_buildversion, code_ptl_buildversion,
                        db_tt_buildversion, code_tt_buildversion)

            if options['calculate_stats']:
                from pootle_misc.upgrade import calculate_stats
                calculate_stats()

            if options['flush_qc']:
                from pootle_misc.upgrade import flush_checks
                flush_checks()

            logging.info('Done.')
        else:
            logging.info(
                    'You are already up to date! Current build versions:\n'
                    '- Pootle: %s\n'
                    '- Translate Toolkit: %s',
                code_ptl_buildversion, code_tt_buildversion,
            )