Exemple #1
0
def ajax():
    global nt
    lock.acquire(timeout=60)
    try:
        recv_data = json.loads(request.get_data('data'))
        logs = ""
        if nt + 60 <= time.time():
            nt = time.time()
            p = subprocess.Popen(["git", "pull", "origin", "master"],
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.STDOUT,
                                 stdin=subprocess.PIPE)
            p.wait()
            logs += str(p.communicate()[0], 'utf-8', 'ignore')
        else:
            logs += 'Skipping the repository update because there\'s an available cache within 60 seconds.\n'
        builder = build.builder()
        builder.args = recv_data
        builder.build()
        logs += builder.logs
        message = {
            "code": 200,
            "argument": recv_data,
            "logs": logs,
            "filename": builder.filename
        }
        print(recv_data)
    finally:
        lock.release()
    return json.dumps(message)
Exemple #2
0
 def build(self):
     builderClass = builder.builder()
     trainData = builder.builder.startBuild(builderClass,
                                            self.directory_path_text.get(),
                                            self.entered_number)
     print trainData
     tkMessageBox.showinfo("Naive Bayes Classifier",
                           "Building classifier using train-set is done!")
Exemple #3
0
 def build(self, *arg):
     core.builder(self.setup, self.command_list)
Exemple #4
0
     'output': 'builds'
 }, {
     'type': 'mcpack',
     'resource': ['all'],
     'hash': False,
     'output': 'builds'
 }]
 preset_name = [
     "meme-resourcepack_noresource_noblueui.zip",
     "meme-resourcepack_noresource.zip", "meme-resourcepack_noblueui.zip",
     "meme-resourcepack_noresource_noblueui.mcpack",
     "meme-resourcepack_noresource.mcpack",
     "meme-resourcepack_noblueui.mcpack", "meme-resourcepack.zip",
     "meme-resourcepack.mcpack"
 ]
 pack_builder = build.builder()
 pack_counter = 0
 perfect_pack_counter = 0
 base_folder = "builds"
 if os.path.exists(base_folder) and not os.path.isdir(base_folder):
     os.remove(base_folder)
 if not os.path.exists(base_folder):
     os.mkdir(base_folder)
 for file in os.listdir(base_folder):
     os.remove(os.path.join(base_folder, file))
 for item, name in zip(preset_args, preset_name):
     pack_builder.args = item
     pack_builder.build()
     if pack_builder.error_count == 0:
         pack_counter += 1
         if pack_builder.warning_count == 0:
Exemple #5
0
def main():
    preset_args = [
        {
            'type': 'normal',
            'language': [],
            'resource': ['all'],
            'mod': ['all'],
            'sfw': True,
            'hash': False,
            'output': None
        },
        {
            'type': 'normal',
            'language': [],
            'resource': ['all'],
            'mod': [],
            'sfw': True,
            'hash': False,
            'output': None
        },
        {
            'type': 'normal',
            'language': [],
            'resource': [],
            'mod': [],
            'sfw': True,
            'hash': False,
            'output': None
        },
        {
            'type': 'compat',
            'language': [],
            'resource': ['all'],
            'mod': ['all'],
            'sfw': True,
            'hash': False,
            'output': None
        },
        {
            'type': 'compat',
            'language': [],
            'resource': ['all'],
            'mod': [],
            'sfw': True,
            'hash': False,
            'output': None
        },
        {
            'type': 'compat',
            'language': [],
            'resource': [],
            'mod': [],
            'sfw': True,
            'hash': False,
            'output': None
        },
        {
            'type': 'legacy',
            'language': ['attributes', 'old_strings', 'diamond_hoe'],
            'resource': [],
            'mod': [],
            'sfw': True,
            'hash': False,
            'output': None
        },
        {
            'type': 'normal',
            'language': [],
            'resource': ['all'],
            'mod': ['all'],
            'sfw': False,
            'hash': False,
            'output': None
        },
    ]
    preset_name = [
        "mcwzh-meme_sfw.zip", "mcwzh-meme_nomod_sfw.zip",
        "mcwzh-meme_nomod_noresource_sfw.zip", "mcwzh-meme_compatible_sfw.zip",
        "mcwzh-meme_compatible_nomod_sfw.zip",
        "mcwzh-meme_compatible_nomod_noresource_sfw.zip",
        "mcwzh-meme_legacy_noresource_sfw.zip", "mcwzh-meme.zip"
    ]
    pack_builder = build.builder()
    pack_counter = 0
    perfect_pack_counter = 0
    base_folder = "builds"
    if os.path.exists(base_folder) and not os.path.isdir(base_folder):
        os.remove(base_folder)
    if not os.path.exists(base_folder):
        os.mkdir(base_folder)
    for file in os.listdir(base_folder):
        os.remove(os.path.join(base_folder, file))
    for item, name in zip(preset_args, preset_name):
        pack_builder.args = item
        pack_builder.build()
        if pack_builder.error_count == 0:
            pack_counter += 1
            if pack_builder.warning_count == 0:
                perfect_pack_counter += 1
            if name != "mcwzh-meme.zip":
                os.rename("builds/mcwzh-meme.zip",
                          os.path.join(base_folder, name))
            print(f"Renamed pack to {name}.")
        else:
            print(f"Failed to build pack {name}.")
    print(
        f"Built {pack_counter} packs with {perfect_pack_counter} pack(s) no warning."
    )