Ejemplo n.º 1
0
            dest='checksums_only',
            default=False,
            help=
            'Leave only checksum files in references dir, other files will be deleted'
        )
        parser.add_argument('tests')

    def run(self, options):
        config = Config()
        config.force = options['force']
        config.checksums_only = options['checksums_only']

        t = Timer()
        doc = options['tests']
        if os.path.isdir(doc):
            docs_dir = doc
        else:
            docs_dir = os.path.dirname(doc)

        refs = TestReferences(docs_dir, options['refs_dir'])
        if doc == docs_dir:
            refs.create_refs()
        else:
            refs.create_refs_for_file(os.path.basename(doc))
        get_printer().printout_ln("Refs created in %s" % (t.elapsed_str()))

        return 0


register_command('create-refs', CreateRefs)
Ejemplo n.º 2
0
        
        if has_conf:
            create = get_answer("Create config file", quit='q') == 'Y'
        
        if not has_conf or (has_conf and create):
            d['project'] = get_input("Project name [Parm]:", default=d['project'])
            d['copyright'] = get_input("Copyright information [%s]:" % d['copyright'], default=d['copyright'])
            d['version'] = get_input("Version [%s]:" % d['version'], default=d['version'])

            extract_file('parm', 'templates/env/conf.py', '.')
            text = template.template_file('conf.py', d).replace('\r\n', '\n')
            f = open('conf.py', 'wb')
            f.write(text)
            f.close()
            
register_command(InitCommand)

class MakeCommand(Command):
    name = 'make'
    help = "Make parm project. It'll create all markdown files to html files."
    has_options = True
    option_list = (
        make_option('-d', dest='directory', default='../html',
            help='Output directory of converted files.'),
    )
    
    r_header = re.compile(r'<h(\d)(.*?)>(.*?)</h\1>', re.IGNORECASE)
    r_tag = re.compile(r'<.*?>')
    r_id = re.compile(r'id="([^"]*)"')
    
    def handle(self, options, global_options, *args):
Ejemplo n.º 3
0
    def __init__(self):
        Command.__init__(self)
        parser = self._get_args_parser()
        parser.add_argument('--refs-dir',
                            action = 'store', dest = 'refs_dir', default = os.path.join(tempfile.gettempdir(), 'refs'),
                            help = 'Directory containing the references')
        parser.add_argument('-o', '--out-dir',
                            action = 'store', dest = 'out_dir', default = os.path.join(tempfile.gettempdir(), 'out'),
                            help = 'Directory containing the results')
        parser.add_argument('-p', '--pretty-diff',
                            action = 'store_true', dest = 'pretty_diff', default = False,
                            help = 'Include pretty diff output')
        parser.add_argument('tests')

    def run(self, options):
        config = Config()
        config.pretty_diff = options['pretty_diff']

        doc = options['tests']
        if os.path.isdir(doc):
            docs_dir = doc
        else:
            docs_dir = os.path.dirname(doc)

        report = HTMLReport(docs_dir, options['refs_dir'], options['out_dir'])
        report.create()

        return 0

register_command('create-report', CreateReport)
Ejemplo n.º 4
0
        parser.add_argument('--bad',
                            action='store',
                            dest='bad',
                            default='HEAD',
                            metavar='REVISION',
                            help='Bad revision')
        parser.add_argument('test')

    def run(self, options):
        config = Config()
        config.src_dir = options['src_dir']
        config.builder = options['builder']
        config.prefix = options['prefix']
        config.good = options['good']
        config.bad = options['bad']

        doc = options['test']
        if not os.path.isfile(doc):
            get_printer().printerr("Invalid test %s: not a regulat file" %
                                   (doc))
            return

        t = Timer()
        bisect = Bisect(options['test'], options['refs_dir'],
                        options['out_dir'])
        bisect.run()
        get_printer().printout_ln("Tests run in %s" % (t.elapsed_str()))


register_command('find-regression', FindRegression)
Ejemplo n.º 5
0
            action="store_true",
            dest="update_refs",
            default=False,
            help="Update references for failed tests",
        )
        parser.add_argument("tests")

    def run(self, options):
        config = Config()
        config.keep_results = options["keep_results"]
        config.create_diffs = options["create_diffs"]
        config.update_refs = options["update_refs"]

        t = Timer()
        doc = options["tests"]
        if os.path.isdir(doc):
            docs_dir = doc
        else:
            docs_dir = os.path.dirname(doc)

        tests = TestRun(docs_dir, options["refs_dir"], options["out_dir"])
        if doc == docs_dir:
            tests.run_tests()
        else:
            tests.run_test(os.path.basename(doc))
        tests.summary()
        print("Tests run in %s" % (t.elapsed_str()))


register_command("run-tests", RunTests)
Ejemplo n.º 6
0
            default="autotools",
            help="Build system to use",
        )
        parser.add_argument("--prefix", action="store", dest="prefix", default="/usr/local", help="Build prefix")
        parser.add_argument("--good", action="store", dest="good", metavar="REVISION", help="Good revision")
        parser.add_argument(
            "--bad", action="store", dest="bad", default="HEAD", metavar="REVISION", help="Bad revision"
        )
        parser.add_argument("test")

    def run(self, options):
        config = Config()
        config.src_dir = options["src_dir"]
        config.builder = options["builder"]
        config.prefix = options["prefix"]
        config.good = options["good"]
        config.bad = options["bad"]

        doc = options["test"]
        if not os.path.isfile(doc):
            get_printer().printerr("Invalid test %s: not a regulat file" % (doc))
            return

        t = Timer()
        bisect = Bisect(options["test"], options["refs_dir"], options["out_dir"])
        bisect.run()
        get_printer().printout_ln("Tests run in %s" % (t.elapsed_str()))


register_command("find-regression", FindRegression)
Ejemplo n.º 7
0
        parser.add_argument('--create-diffs',
                            action = 'store_true', dest = 'create_diffs', default = False,
                            help = 'Create diff files for failed tests')
        parser.add_argument('--update-refs',
                            action = 'store_true', dest = 'update_refs', default = False,
                            help = 'Update references for failed tests')
        parser.add_argument('tests')

    def run(self, options):
        config = Config()
        config.keep_results = options['keep_results']
        config.create_diffs = options['create_diffs']
        config.update_refs = options['update_refs']

        t = Timer()
        doc = options['tests']
        if os.path.isdir(doc):
            docs_dir = doc
        else:
            docs_dir = os.path.dirname(doc)

        tests = TestRun(docs_dir, options['refs_dir'], options['out_dir'])
        if doc == docs_dir:
            tests.run_tests()
        else:
            tests.run_test(os.path.basename(doc))
        tests.summary()
        get_printer().printout_ln("Tests run in %s" % (t.elapsed_str()))

register_command('run-tests', RunTests)
Ejemplo n.º 8
0
                ofile = None
                commit_id = args[0]
                if options.output_filename:
                    ofile = options.output_filename
                
                if options.bundle:
                    return client.archive_bundle(options.bundle, commit_id, ofile)
                else:
                    path = os.getcwd()
                    return client.archive_dir(path, commit_id, ofile)
                

                    
            return 
        self.print_help(__prog_name__, self.name)

register_command(ConfigCommand)
register_command(PushCommand)
register_command(PullCommand)    
register_command(UploadCommand)    
register_command(DownloadCommand)  
register_command(LocalPullCommand)  
register_command(ArchiveCommand)

def main():
    modules = []
    call(__prog_name__, __version__, modules)
    
if __name__ == '__main__':
    main()
Ejemplo n.º 9
0
        parser.add_argument('--prefix',
                            action = 'store', dest = 'prefix', default = '/usr/local',
                            help = 'Build prefix')
        parser.add_argument('--good',
                            action = 'store', dest = 'good', metavar = 'REVISION',
                            help = 'Good revision')
        parser.add_argument('--bad',
                            action = 'store', dest = 'bad', default = 'HEAD', metavar = 'REVISION',
                            help = 'Bad revision')
        parser.add_argument('test')

    def run(self, options):
        config = Config()
        config.src_dir = options['src_dir']
        config.builder = options['builder']
        config.prefix = options['prefix']
        config.good = options['good']
        config.bad = options['bad']

        doc = options['test']
        if not os.path.isfile(doc):
            print("Invalid test %s: not a regulat file" % (doc))
            return

        t = Timer()
        bisect = Bisect(options['test'], options['refs_dir'], options['out_dir'])
        bisect.run()
        print("Tests run in %s" % (t.elapsed_str()))

register_command('find-regression', FindRegression)
Ejemplo n.º 10
0
        parser.add_argument('--update-refs',
                            action='store_true',
                            dest='update_refs',
                            default=False,
                            help='Update references for failed tests')
        parser.add_argument('tests')

    def run(self, options):
        config = Config()
        config.keep_results = options['keep_results']
        config.create_diffs = options['create_diffs']
        config.update_refs = options['update_refs']

        t = Timer()
        doc = options['tests']
        if os.path.isdir(doc):
            docs_dir = doc
        else:
            docs_dir = os.path.dirname(doc)

        tests = TestRun(docs_dir, options['refs_dir'], options['out_dir'])
        if doc == docs_dir:
            tests.run_tests()
        else:
            tests.run_test(os.path.basename(doc))
        tests.summary()
        get_printer().printout_ln("Tests run in %s" % (t.elapsed_str()))


register_command('run-tests', RunTests)
Ejemplo n.º 11
0
                commit_id = args[0]
                if options.output_filename:
                    ofile = options.output_filename

                if options.bundle:
                    return client.archive_bundle(options.bundle, commit_id,
                                                 ofile)
                else:
                    path = os.getcwd()
                    return client.archive_dir(path, commit_id, ofile)

            return
        self.print_help(__prog_name__, self.name)


register_command(ConfigCommand)
register_command(PushCommand)
register_command(PullCommand)
register_command(UploadCommand)
register_command(DownloadCommand)
register_command(LocalPullCommand)
register_command(ArchiveCommand)


def main():
    modules = []
    call(__prog_name__, __version__, modules)


if __name__ == '__main__':
    main()
Ejemplo n.º 12
0
                            help='Directory containing the references')
        parser.add_argument('-o',
                            '--out-dir',
                            action='store',
                            dest='out_dir',
                            default=os.path.join(tempfile.gettempdir(), 'out'),
                            help='Directory containing the results')
        parser.add_argument('-p',
                            '--pretty-diff',
                            action='store_true',
                            dest='pretty_diff',
                            default=False,
                            help='Include pretty diff output')
        parser.add_argument('tests')

    def run(self, options):
        config = Config()
        config.pretty_diff = options['pretty_diff']

        doc = options['tests']
        if os.path.isdir(doc):
            docs_dir = doc
        else:
            docs_dir = os.path.dirname(doc)

        report = HTMLReport(docs_dir, options['refs_dir'], options['out_dir'])
        report.create()


register_command('create-report', CreateReport)
Ejemplo n.º 13
0
                            action = 'store', dest = 'refs_dir', default = os.path.join(tempfile.gettempdir(), 'refs'),
                            help = 'Directory where the references will be created')
        parser.add_argument('-f', '--force',
                            action = 'store_true', dest = 'force', default = False,
                            help = 'Create references again for tests that already have references')
        parser.add_argument('-c', '--checksums-only',
                            action = 'store_true', dest = 'checksums_only', default = False,
                            help = 'Leave only checksum files in references dir, other files will be deleted')
        parser.add_argument('tests')

    def run(self, options):
        config = Config()
        config.force = options['force']
        config.checksums_only = options['checksums_only']

        t = Timer()
        doc = options['tests']
        if os.path.isdir(doc):
            docs_dir = doc
        else:
            docs_dir = os.path.dirname(doc)

        refs = TestReferences(docs_dir, options['refs_dir'])
        if doc == docs_dir:
            refs.create_refs()
        else:
            refs.create_refs_for_file(os.path.basename(doc))
        print("Refs created in %s" % (t.elapsed_str()))

register_command('create-refs', CreateRefs)
Ejemplo n.º 14
0
        await client.change_presence(
            activity=discord.Game('*help - Flonki Bot'),
            status=discord.Status.online)
        await asyncio.sleep(3)
        await client.change_presence(activity=discord.Game('Mein DC bot'),
                                     status=discord.Status.online)
        await asyncio.sleep(3)


@client.event
async def on_message(message):
    if message.author.bot:
        return
    if str(message.content).startswith("*"):
        response = interpreter(message)
        if not response == None:
            if type(response) == discord.Embed:
                await message.channel.send(embed=response)
            else:
                await message.channel.send(response)


with open("token", "r") as file:
    token = file.readline()

register_command(system.HelpCommand())
register_command(system.AnnounceCommand())
register_command(system.StopCommand())

client.run(token)