diff --git a/README.md b/README.md index d0fc8fb..dcd712d 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,16 @@ -# CMAN +# DeltaMC ![Badge](https://img.shields.io/github/downloads/comprehensive-minecraft-archive-network/CMAN-Python/total.svg) -Comprehensive Minecraft Archive Network - Licenced under the GPL v3 -Have a mod on the CMAN? Add one of these to your forum page so that everyone knows! +Have a mod on DeltaMC? Add one of these to your forum page so that everyone knows! -![Badge](https://img.shields.io/badge/CMAN-Indexed-green.svg) +![Badge](https://img.shields.io/badge/DeltaMC-Indexed-green.svg) -![Badge](https://img.shields.io/badge/CMAN-Indexed-green.svg?style=flat-square) +![Badge](https://img.shields.io/badge/DeltaMC-Indexed-green.svg?style=flat-square) -![Badge](https://img.shields.io/badge/CMAN-Indexed-green.svg?style=plastic) +![Badge](https://img.shields.io/badge/DeltaMC-Indexed-green.svg?style=plastic) Proudly supporting [#StopModReposts](http://www.stopmodreposts.org)! diff --git a/CMAN_gui.py b/delta_gui.py similarity index 90% rename from CMAN_gui.py rename to delta_gui.py index 7b3abf1..f3cac1f 100644 --- a/CMAN_gui.py +++ b/delta_gui.py @@ -7,14 +7,14 @@ import zipfile import argparse import tkinter as tk -import CMAN_remove -import CMAN_upgrade -import CMAN_install -import CMAN_importexport +import delta_remove +import delta_upgrade +import delta_install +import delta_importexport import tkinter.messagebox as msgbox import tkinter.simpledialog as dialogs import tkinter.filedialog as filedialogs -from CMAN_util import * +from delta_util import * modfolder = "@ERROR@" jarfolder = "@ERROR@" @@ -37,10 +37,10 @@ def gui_setup_config(_instance): modfolder, jarfolder, mc_version = read_config(_instance) #gets config stuff os.chdir(execdir) init_config_util((modfolder, jarfolder, mc_version, execdir, instance, gui)) #transferring config data (and Tkinter instance) to all files - CMAN_install.init_config_install((modfolder, jarfolder, mc_version, execdir, instance, gui)) - CMAN_remove.init_config_remove((modfolder, jarfolder, mc_version, execdir, instance, gui)) - CMAN_upgrade.init_config_upgrade((modfolder, jarfolder, mc_version, execdir, instance, gui)) - CMAN_importexport.init_config_importexport((modfolder, jarfolder, mc_version, execdir, instance, gui)) + delta_install.init_config_install((modfolder, jarfolder, mc_version, execdir, instance, gui)) + delta_remove.init_config_remove((modfolder, jarfolder, mc_version, execdir, instance, gui)) + delta_upgrade.init_config_upgrade((modfolder, jarfolder, mc_version, execdir, instance, gui)) + delta_importexport.init_config_importexport((modfolder, jarfolder, mc_version, execdir, instance, gui)) init_config_gui((modfolder, jarfolder, mc_version, execdir, instance, gui)) @@ -51,7 +51,7 @@ def instmods(): _mods = map(int, tkinst.mlist.curselection()) for _mod in _mods: - CMAN_install.install_mod(tkinst.mods[int(_mod)]["Name"]) + delta_install.install_mod(tkinst.mods[int(_mod)]["Name"]) updateinst() @@ -59,14 +59,14 @@ def removmods(): _mods = map(int, tkinst.mlisti.curselection()) for _mod in _mods: - CMAN_remove.remove_mod(tkinst.modsi[int(_mod)]["Name"]) + delta_remove.remove_mod(tkinst.modsi[int(_mod)]["Name"]) updateinst() def upgrmods(): _mods = map(int, tkinst.mlisti.curselection()) for _mod in _mods: - CMAN_upgrade.upgrade_mod(tkinst.modsi[int(_mod)]["Name"]) + delta_upgrade.upgrade_mod(tkinst.modsi[int(_mod)]["Name"]) updateinst() def runcmd(): @@ -129,7 +129,7 @@ def updateinst(): tkinst.ilabel.configure(text = "Current Instance: "+instance) tkinst.mlisti.delete(0, tk.END) tkinst.modsi = listmods(False, False) - upgrades = CMAN_upgrade.get_upgrade_names(instance) + upgrades = delta_upgrade.get_upgrade_names(instance) for mod in tkinst.modsi: if mod != None: if mod in upgrades: @@ -140,11 +140,11 @@ def updateinst(): def importmlist(): fname = filedialogs.askopenfilename(parent=tkinst) - CMAN_importexport.import_mods(fname) + delta_importexport.import_mods(fname) def exportmlist(): fname = filedialogs.asksaveasfilename(parent=tkinst) - CMAN_importexport.export_mods(fname) + delta_importexport.export_mods(fname) def exit(): sys.exit() @@ -162,7 +162,7 @@ def update_modlist(self): if mod != None: self.mlist.insert(tk.END, mod["Name"]) def initialise_window(self): - self.master.title("CMAN v2.1.0") + self.master.title("DeltaMC v2.1.0") #self.master.geometry("800x400") self.winv = tk.PanedWindow(self, orient=tk.VERTICAL, sashrelief=tk.RAISED, height=400, width=800) @@ -237,7 +237,7 @@ def initialise_window(self): self.definst = tk.Button(self.lpane, text = "Set as Default Instance", command=sdinst) self.definst.pack() - self.update = tk.Button(self.lpane, text = "Update CMAN Archive", command=update_archive) + self.update = tk.Button(self.lpane, text = "Update DeltaMC Archive", command=update_archive) self.update.pack(side = tk.BOTTOM) self.blankf = tk.Frame(self.lpane, height = 20) @@ -249,7 +249,7 @@ def initialise_window(self): self.implist = tk.Button(self.lpane, text = "Import Mod List...", command=importmlist) self.implist.pack(side = tk.BOTTOM) - self.exit = tk.Button(self.lpane, text = "Exit CMAN", command=exit) + self.exit = tk.Button(self.lpane, text = "Exit DeltaMC", command=exit) self.exit.pack(side = tk.BOTTOM) self.mpane = tk.Frame(self.win) @@ -312,7 +312,7 @@ def parsecmd(command): cprint("Instance "+inst+" does not exist.") return update_archive() - CMAN_upgrade.check_upgrades(True, inst) + delta_upgrade.check_upgrades(True, inst) elif(len(command.split(" ")) == 1): cprint("upgrades: not enough arguments") else: @@ -321,13 +321,13 @@ def parsecmd(command): if(len(command.split(" ")) == 2 and command.split(" ")[1] != ""): mod = command.split(" ")[1] update_archive() - upgrades = CMAN_upgrade.get_upgrades() - CMAN_upgrade.upgrade_mod(mod) + upgrades = delta_upgrade.get_upgrades() + delta_upgrade.upgrade_mod(mod) elif(len(command.split(" ")) == 1): mod = None update_archive() - upgrades = CMAN_upgrade.get_upgrades() - CMAN_upgrade.upgrade_mod(mod) + upgrades = delta_upgrade.get_upgrades() + delta_upgrade.upgrade_mod(mod) else: cprint("Invalid command syntax.") elif(command.split(" ")[0] == "upgradeall"): @@ -343,30 +343,30 @@ def parsecmd(command): else: cprint("Invalid command syntax.") update_archive() - updates = CMAN_upgrade.get_upgrades(inst) + updates = delta_upgrade.get_upgrades(inst) if(len(updates) == 0): cprint("No upgrades available.") else: for update in updates: - CMAN_upgrade.upgrade_mod(update[0]["Name"]) + delta_upgrade.upgrade_mod(update[0]["Name"]) elif(command.split(" ")[0] == "install"): if(len(command.split(" ")) == 2 and command.split(" ")[1] != ""): mod = command.split(" ")[1] update_archive() - CMAN_install.install_mod(mod) + delta_install.install_mod(mod) elif(len(command.split(" ")) == 1): mod = None update_archive() - CMAN_install.install_mod(mod) + delta_install.install_mod(mod) else: cprint("Invalid command syntax.") elif(command.split(" ")[0] == "remove"): if(len(command.split(" ")) == 2 and command.split(" ")[1] != ""): mod = command.split(" ")[1] - CMAN_remove.remove_mod(mod) + delta_remove.remove_mod(mod) elif(len(command.split(" ")) == 1): mod = None - CMAN_remove.remove_mod(mod) + delta_remove.remove_mod(mod) else: cprint("Invalid command syntax.") elif(command.split(" ")[0] == "info"): @@ -385,7 +385,7 @@ def parsecmd(command): string = string + item+", " cprint(string[:-2]+"...") #[:-2] to cut off the extra ", " after the last element for item in modslist: - CMAN_install.install_mod(item) + delta_install.install_mod(item) else: cprint("Invalid command syntax.") elif(command.split(" ")[0] == "removem" or command.split(" ")[0] == "removemany"): @@ -397,7 +397,7 @@ def parsecmd(command): string = string + item+", " cprint(string[:-2]+"...") #[:-2] to cut off the extra ", " after the last element for item in modslist: - CMAN_remove.remove_mod(item) + delta_remove.remove_mod(item) else: cprint("Invalid command syntax.") elif(command.split(" ")[0] == "upgradem" or command.split(" ")[0] == "upgrademany"): @@ -409,29 +409,29 @@ def parsecmd(command): string = string + item+", " cprint(string[:-2]+"...") #[:-2] to cut off the extra ", " after the last element for item in modslist: - CMAN_upgrade.upgrade_mod(item) + delta_upgrade.upgrade_mod(item) else: cprint("Invalid command syntax.") elif(command.split(" ")[0] == "export"): if(len(command.split(" ")) == 2 and command.split(" ")[1] != ""): name = command.split(" ")[1] update_archive() - CMAN_importexport.export_mods(name) + delta_importexport.export_mods(name) elif(len(command.split(" ")) == 1): name = None update_archive() - CMAN_importexport.export_mods(name) + delta_importexport.export_mods(name) else: cprint("Invalid command syntax.") elif(command.split(" ")[0] == "import"): if(len(command.split(" ")) == 2 and command.split(" ")[1] != ""): path = command.split(" ")[1] update_archive() - CMAN_importexport.import_mods(path) + delta_importexport.import_mods(path) elif(len(command.split(" ")) == 1): path = None update_archive() - CMAN_importexport.import_mods(path) + delta_importexport.import_mods(path) else: cprint("Invalid command syntax.") elif(command.split(" ")[0] == "instance" or command.split(" ")[0] == "inst"): @@ -500,7 +500,7 @@ def parsecmd(command): elif(command.split(" ")[0] == "list"): listmods() elif(command.split(" ")[0] == "version"): - cprint("CMAN v"+version) + cprint("DeltaMC v"+version) elif(command.split(" ")[0] == "help" or command.split(" ")[0] == "?"): print_help() elif(command.split(" ")[0] == "exit"): diff --git a/CMAN_importexport.py b/delta_importexport.py similarity index 96% rename from CMAN_importexport.py rename to delta_importexport.py index 2509633..8bf7652 100644 --- a/CMAN_importexport.py +++ b/delta_importexport.py @@ -5,7 +5,7 @@ import sys import tarfile import zipfile -from CMAN_util import * +from delta_util import * modfolder = "@ERROR@" jarfolder = "@ERROR@" @@ -62,4 +62,4 @@ def import_mods(path): mods = json_data["Mods"] for mod in mods: cprint(mod) - CMAN_install.install_mod(mod) + delta_install.install_mod(mod) diff --git a/CMAN_install.py b/delta_install.py similarity index 95% rename from CMAN_install.py rename to delta_install.py index f4eeb6a..1662640 100644 --- a/CMAN_install.py +++ b/delta_install.py @@ -6,7 +6,7 @@ import sys import tarfile import zipfile -from CMAN_util import * +from delta_util import * import tkinter as tk import tkinter.messagebox as msgbox import tkinter.simpledialog as dialogs @@ -28,7 +28,7 @@ def recieve_tkinst_install(data): def install_mod(modname, version = None): - os.chdir(execdir + "/Data/CMAN-Archive") + os.chdir(execdir + "/Data/DeltaMC-Archive") if(modname == None): modname = cinput("Enter mod name: ") @@ -72,7 +72,7 @@ def install_mod(modname, version = None): cprint(modname + " is already installed!") return - originalfile = execdir + "/Data/CMAN-Archive/" + modname + ".json" # Saving Modname.json for future reference + originalfile = execdir + "/Data/DeltaMC-Archive/" + modname + ".json" # Saving Modname.json for future reference if(not os.path.exists(execdir + "/LocalData/ModsDownloaded/"+instance)): os.mkdir(execdir + "/LocalData/ModsDownloaded/"+instance) os.chdir(execdir + "/LocalData/ModsDownloaded/"+instance) @@ -120,7 +120,7 @@ def install_mod(modname, version = None): cprint(modname + " is at version " + version) if (modtype == "Basemod"): os.chdir(execdir + "/Data/temp") - file_name = modname + "-" + version + "-CMANtemp.zip" + file_name = modname + "-" + version + "-DeltaMCtemp.zip" cprint("Downloading " + url) with open(file_name, 'wb') as out_file: response = requests.get(url) @@ -149,9 +149,9 @@ def install_mod(modname, version = None): folderpath = os.path.join(jarfolder, foldernamefinal) shutil.copytree(vpath, folderpath) fix_names(folderpath, vname, foldernamefinal) - zipfile.ZipFile(os.path.join(jarfolder, foldernamefinal, newjarname)).extractall(path="./"+file_name+"CMANtemp") - mergedirs(modname, file_name+"CMANtemp") - os.chdir(file_name+"CMANtemp") + zipfile.ZipFile(os.path.join(jarfolder, foldernamefinal, newjarname)).extractall(path="./"+file_name+"DeltaMCtemp") + mergedirs(modname, file_name+"DeltaMCtemp") + os.chdir(file_name+"DeltaMCtemp") shutil.rmtree("META-INF") #delete META-INF cprint("Making jar (this might take a while).") shutil.make_archive("../"+foldername, "zip") diff --git a/CMAN_remove.py b/delta_remove.py similarity index 83% rename from CMAN_remove.py rename to delta_remove.py index a622f30..ee04a47 100644 --- a/CMAN_remove.py +++ b/delta_remove.py @@ -5,7 +5,7 @@ import sys import tarfile import zipfile -from CMAN_util import * +from delta_util import * import tkinter as tk import tkinter.messagebox as msgbox import tkinter.simpledialog as dialogs @@ -23,7 +23,7 @@ def recieve_tkinst_remove(data): global tkinst tkinst = data -def remove_mod(modname): #behavior not guaranteed on mods installed outside of CMAN +def remove_mod(modname): #behavior not guaranteed on mods installed outside of DeltaMC if(modname == None): modname = cinput("Enter mod name: ") cprint("Removing file for mod in ModsDownloaded") @@ -49,5 +49,5 @@ def remove_mod(modname): #behavior not guaranteed on mods installed outside of C cprint("Skipped \""+file+"\".") else: if(gui): - msgbox.showerror("Removal Failed", "CMAN cannot remove installer mods or base mods.\nRemoving mod from CMAN listing only.") - cprint("CMAN cannot remove installer mods or base mods! (If "+modname+" is not an installer mod or base mod, then something went wrong.)") + msgbox.showerror("Removal Failed", "DeltaMC cannot remove installer mods or base mods.\nRemoving mod from DeltaMC listing only.") + cprint("DeltaMC cannot remove installer mods or base mods! (If "+modname+" is not an installer mod or base mod, then something went wrong.)") diff --git a/CMAN_upgrade.py b/delta_upgrade.py similarity index 93% rename from CMAN_upgrade.py rename to delta_upgrade.py index 3c6a2fa..db5699f 100644 --- a/CMAN_upgrade.py +++ b/delta_upgrade.py @@ -6,9 +6,9 @@ import sys import tarfile import zipfile -from CMAN_util import * -import CMAN_install -import CMAN_remove +from delta_util import * +import delta_install +import delta_remove modfolder = "@ERROR@" jarfolder = "@ERROR@" @@ -25,7 +25,7 @@ def recieve_tkinst_upgrade(data): tkinst = data def upgrade_mod(modname): - os.chdir(execdir + "/Data/CMAN-Archive") + os.chdir(execdir + "/Data/DeltaMC-Archive") if(modname == None): modname = cinput("Enter mod name: ") update = [get_installed_json(modname),get_mod(modname)] @@ -37,8 +37,8 @@ def upgrade_mod(modname): return os.chdir(execdir + "/LocalData") #restoring current working dir if(update[1]["Versions"][0]["Version"] != get_latest_compatible_version(update[0]) and mod_installed(modname)): - CMAN_remove.remove_mod(modname) - CMAN_install.install_mod(modname) + delta_remove.remove_mod(modname) + delta_install.install_mod(modname) elif(not mod_installed(modname)): cprint(modname+" is not installed.") else: diff --git a/CMAN_util.py b/delta_util.py similarity index 92% rename from CMAN_util.py rename to delta_util.py index 96fc93a..44cca85 100644 --- a/CMAN_util.py +++ b/delta_util.py @@ -40,13 +40,13 @@ def read_default_instance(): return default def check_for_updates(): - response = requests.get('http://raw.githubusercontent.com/Comprehensive-Minecraft-Archive-Network/CMAN-Python/master/version.txt') + response = requests.get('https://raw.githubusercontent.com/deltamc-project/deltamc-python/master/version.txt') latestversion = response.text if (version != str(latestversion)): #if (gui): - # msgbox.askyesno("Update available", "You are running CMAN " + version + ".\nThe newest version is " + str(latestversion) + ".", parent=tkinst, master=tkinst) + # msgbox.askyesno("Update available", "You are running DeltaMC " + version + ".\nThe newest version is " + str(latestversion) + ".", parent=tkinst, master=tkinst) #else: - cprint("!!Update Available! You are running CMAN " + version + ". The newest version is " + str(latestversion) + "!!") + cprint("!!Update Available! You are running DeltaMC " + version + ". The newest version is " + str(latestversion) + "!!") def init_config_util(data): #data is a 5-tuple global modfolder, jarfolder, mc_version, execdir, instance, gui #makes it edit the global vars rather than create new ones @@ -85,7 +85,7 @@ def instance_exists(instance): try: json_data = json.load(json_file) except(json.decoder.JSONDecodeError): - cprint("The config JSON appears to be invalid. Delete it and run CMAN again.") + cprint("The config JSON appears to be invalid. Delete it and run DeltaMC again.") json_file.close() sys.exit() return(instance in json_data.keys()) @@ -96,7 +96,7 @@ def read_config(instance): try: json_data = json.load(json_file) except(json.decoder.JSONDecodeError): - cprint("The config JSON appears to be invalid. Delete it and run CMAN again.") + cprint("The config JSON appears to be invalid. Delete it and run DeltaMC again.") json_file.close() sys.exit() json_file.close() @@ -171,7 +171,7 @@ def rm_config(_instance): try: json_data = json.load(json_file) except(json.decoder.JSONDecodeError): - cprint("The config JSON appears to be invalid. Delete it and run CMAN again.") + cprint("The config JSON appears to be invalid. Delete it and run DeltaMC again.") json_file.close() sys.exit() json_file.close() @@ -190,10 +190,10 @@ def rm_config(_instance): cprint("Done.") def get_json(modname): - if(os.path.exists(execdir + "/Data/CMAN-Archive")): - os.chdir(execdir + "/Data/CMAN-Archive") + if(os.path.exists(execdir + "/Data/DeltaMC-Archive")): + os.chdir(execdir + "/Data/DeltaMC-Archive") else: - cprint("CMAN archive not found. Please update the CMAN archive.") + cprint("DeltaMC archive not found. Please update the DeltaMC archive.") return(-1) if(os.path.exists(modname + ".json")): # JSON parsing @@ -202,7 +202,7 @@ def get_json(modname): json_data = json.load(json_file) json_file.close() except(json.decoder.JSONDecodeError): - cprint("The JSON file \""+modname+".json\" appears to be invalid. Please update the CMAN archive.") + cprint("The JSON file \""+modname+".json\" appears to be invalid. Please update the DeltaMC archive.") json_file.close() return return(json_data) @@ -220,7 +220,7 @@ def get_installed_json(modname): try: json_data = json.load(json_file) except(json.decoder.JSONDecodeError): - cprint("The JSON file \""+modname+".installed\" appears to be invalid. Using data from CMAN archive.") + cprint("The JSON file \""+modname+".installed\" appears to be invalid. Using data from DeltaMC archive.") json_data = (get_json(modname)) finally: json_file.close() @@ -287,8 +287,8 @@ def get_installed_mods(inst = None, allinst=True): def get_all_jsons(): jsons = [] - if(os.path.exists(execdir + "/Data/CMAN-Archive")): - mods = os.listdir(execdir + "/Data/CMAN-Archive") + if(os.path.exists(execdir + "/Data/DeltaMC-Archive")): + mods = os.listdir(execdir + "/Data/DeltaMC-Archive") for mod in mods: json_data = get_json(mod[:-5]) #[:-5] cuts off the .json extension if json_data != None: @@ -362,16 +362,16 @@ def get_deps(modname): def update_archive(start=False): #Delete old archive os.chdir(execdir + "/Data") - if(os.path.exists(execdir + "/Data/CMAN-Archive")): - shutil.rmtree("CMAN-Archive") + if(os.path.exists(execdir + "/Data/DeltaMC-Archive")): + shutil.rmtree("DeltaMC-Archive") # Archive Download - url = "https://github.com/Comprehensive-Minecraft-Archive-Network/CMAN-Archive/tarball/master" - file_name = "CMAN.tar.gz" + url = "https://github.com/deltamc-project/deltamc-archive/tarball/master" + file_name = "DeltaMC.tar.gz" cprint("Downloading Archive...") # Download it. try: with open(file_name, 'wb') as out_file: - response = requests.get('https://github.com/Comprehensive-Minecraft-Archive-Network/CMAN-Archive/tarball/new-syntax') + response = requests.get('https://github.com/deltamc-project/deltamc-archive/tarball/new-syntax') out_file.write(response.content) cprint("Done.") except Exception as e: @@ -380,15 +380,15 @@ def update_archive(start=False): if(gui and not start): msgbox.showerror("Archive download failed", "Something went wrong while downloading the archive.", parent=tkinst) if(start): - print("CMAN: fatal: Something went wrong while downloading the archive.") + print("DeltaMC: fatal: Something went wrong while downloading the archive.") sys.exit() else: return -1 cprint("Extracting Archive...") - tar = tarfile.open("CMAN.tar.gz") # untar + tar = tarfile.open("DeltaMC.tar.gz") # untar tar.extractall() tarlist = tar.getnames() - os.rename(tarlist[0], "CMAN-Archive") #rename the resulting folder to CMAN-Archive + os.rename(tarlist[0], "DeltaMC-Archive") #rename the resulting folder to DeltaMC-Archive cprint("Converting to Mod objects") for json_data in get_all_jsons(): mod_item = get_mod_from_json(json_data) @@ -402,7 +402,7 @@ def update_archive(start=False): cprint("Done.") if(gui and not start): - msgbox.showinfo("Archive updated", "The CMAN archive has been successfully updated.", parent=tkinst) + msgbox.showinfo("Archive updated", "The DeltaMC archive has been successfully updated.", parent=tkinst) def get_info_console(modname, output=False): istr = [] @@ -468,9 +468,9 @@ def print_help(): cprint(" upgradem: upgrade multiple mods") cprint(" upgradeall: upgrade all outdated mods for Minecraft instance 'inst', or use '*' to check all instances") cprint(" upgrades 'inst': list available mod upgrades for Minecraft instance 'inst', or use '*' to check all instances") - cprint(" update: update the CMAN archive") + cprint(" update: update the DeltaMC archive") cprint(" help: display this help message") - cprint(" version: display the CMAN version number") + cprint(" version: display the DeltaMC version number") cprint(" list: list installed mods") cprint(" export 'name': export a modlist with the name 'name' , which can be imported later") cprint(" import 'pathtomodlist': import the modlist 'pathtomodlist'") @@ -479,7 +479,7 @@ def print_help(): cprint(" addinst 'inst': adds the Minecraft instance 'inst'") cprint(" rminst 'inst': removes the Minecraft instance 'inst'") cprint(" insts: lists all Minecraft instances") - cprint(" exit: exit CMAN") + cprint(" exit: exit DeltaMC") def get_mod_from_json(json_data): @@ -527,7 +527,7 @@ def is_any_version_compatible(mod): return True return False -def cinput(terminal_text, gui_text=None, input_type='text', title="CMAN"): +def cinput(terminal_text, gui_text=None, input_type='text', title="DeltaMC"): print(terminal_text, gui_text, input_type, title) if gui_text == None: gui_text = terminal_text diff --git a/CMAN.py b/deltamc.py similarity index 85% rename from CMAN.py rename to deltamc.py index 43acdcd..5243ff2 100644 --- a/CMAN.py +++ b/deltamc.py @@ -7,13 +7,13 @@ import zipfile import argparse import tkinter as tk -import CMAN_remove -import CMAN_upgrade -import CMAN_install -import CMAN_importexport -from CMAN_gui import * -import CMAN_gui -from CMAN_util import * +import delta_remove +import delta_upgrade +import delta_install +import delta_importexport +from delta_gui import * +import delta_gui +from delta_util import * import tkinter.messagebox as msgbox import tkinter.simpledialog as dialogs @@ -40,25 +40,25 @@ def setup_config(_instance): global modfolder, jarfolder, mc_version, instance, gui os.chdir(os.path.join(execdir, "LocalData")) instance = _instance - init_config_util_guionly(gui) # transferring gui flag to CMAN_util + init_config_util_guionly(gui) # transferring gui flag to delta_util modfolder, jarfolder, mc_version = read_config(_instance) # gets config stuff os.chdir(execdir) init_config_util((modfolder, jarfolder, mc_version, execdir, instance, gui)) # transferring config data (and Tkinter instance) to all files - CMAN_install.init_config_install((modfolder, jarfolder, mc_version, execdir, instance, gui)) - CMAN_remove.init_config_remove((modfolder, jarfolder, mc_version, execdir, instance, gui)) - CMAN_upgrade.init_config_upgrade((modfolder, jarfolder, mc_version, execdir, instance, gui)) - CMAN_importexport.init_config_importexport((modfolder, jarfolder, mc_version, execdir, instance, gui)) + delta_install.init_config_install((modfolder, jarfolder, mc_version, execdir, instance, gui)) + delta_remove.init_config_remove((modfolder, jarfolder, mc_version, execdir, instance, gui)) + delta_upgrade.init_config_upgrade((modfolder, jarfolder, mc_version, execdir, instance, gui)) + delta_importexport.init_config_importexport((modfolder, jarfolder, mc_version, execdir, instance, gui)) init_config_gui((modfolder, jarfolder, mc_version, execdir, instance, gui)) def transfer_tkinst(): global tkinst recieve_tkinst_util(tkinst) - CMAN_install.recieve_tkinst_install(tkinst) - CMAN_remove.recieve_tkinst_remove(tkinst) - CMAN_upgrade.recieve_tkinst_upgrade(tkinst) - CMAN_importexport.recieve_tkinst_importexport(tkinst) - CMAN_gui.recieve_tkinst_gui(tkinst) + delta_install.recieve_tkinst_install(tkinst) + delta_remove.recieve_tkinst_remove(tkinst) + delta_upgrade.recieve_tkinst_upgrade(tkinst) + delta_importexport.recieve_tkinst_importexport(tkinst) + delta_gui.recieve_tkinst_gui(tkinst) @@ -68,7 +68,7 @@ def transfer_tkinst(): tkinst = None -parser = argparse.ArgumentParser(description="CMAN: the Comprehensive Minecraft Archive Network") +parser = argparse.ArgumentParser(description="DeltaMC: A package manager for Minecraft Mods") parser.add_argument("-i", "--install", help="install mod", metavar="MOD", default="None") parser.add_argument("-r", "--remove", help="remove mod", metavar="MOD", default="None") @@ -129,22 +129,22 @@ def transfer_tkinst(): update_archive(True) if(gui): - CMAN_gui.updateinst() + delta_gui.updateinst() tkinst.update_modlist() check_for_updates() -cprint("CMAN v"+version) -instance = CMAN_gui.instance +cprint("DeltaMC v"+version) +instance = delta_gui.instance if (args.instance != "None"): instance = args.instance if(instance == "@ERROR@"): - instance = CMAN_gui.instance + instance = delta_gui.instance cprint("Selected Instance: "+instance) cprint("Minecraft Version: "+mc_version) -upgradesavailable = CMAN_upgrade.get_upgrades(instance) +upgradesavailable = delta_upgrade.get_upgrades(instance) if (upgradesavailable == []): pass else: @@ -152,22 +152,22 @@ def transfer_tkinst(): for upgrade in upgradesavailable: cprint(" "+upgrade[0].name+" (current version: "+upgrade[1].versions[0]["Version"]+", you have: "+upgrade[0].versions[0]["Version"]+")") if (args.install != "None"): - CMAN_install.install_mod(args.install) + delta_install.install_mod(args.install) sys.exit() if (args.remove != "None"): - CMAN_remove.remove_mod(args.remove) + delta_remove.remove_mod(args.remove) sys.exit() if (args.upgrade != "None"): - CMAN_upgrade.upgrade_mod(args.upgrade) + delta_upgrade.upgrade_mod(args.upgrade) sys.exit() if (args.info != "None"): get_info(args.info) sys.exit() if (args.export != "None"): - CMAN_importexport.export_mods(args.export) + delta_importexport.export_mods(args.export) sys.exit() if (args.importa != "None"): - CMAN_importexport.import_mods(args.importa) + delta_importexport.import_mods(args.importa) sys.exit() if (gui == False): @@ -185,7 +185,7 @@ def parsecmd(command): cprint("Instance "+inst+" does not exist.") return update_archive() - CMAN_upgrade.check_upgrades(True, inst) + delta_upgrade.check_upgrades(True, inst) elif(len(command.split(" ")) == 1): inst = input("Enter instance name: ") if(inst == "*"): @@ -194,20 +194,20 @@ def parsecmd(command): cprint("Instance "+inst+" does not exist.") return update_archive() - CMAN_upgrade.check_upgrades(True, inst) + delta_upgrade.check_upgrades(True, inst) else: cprint("Invalid command syntax.") elif(command.split(" ")[0] == "upgrade"): if(len(command.split(" ")) == 2 and command.split(" ")[1] != ""): mod = command.split(" ")[1] update_archive() - upgrades = CMAN_upgrade.get_upgrades() - CMAN_upgrade.upgrade_mod(mod) + upgrades = delta_upgrade.get_upgrades() + delta_upgrade.upgrade_mod(mod) elif(len(command.split(" ")) == 1): mod = None update_archive() - upgrades = CMAN_upgrade.get_upgrades() - CMAN_upgrade.upgrade_mod(mod) + upgrades = delta_upgrade.get_upgrades() + delta_upgrade.upgrade_mod(mod) else: cprint("Invalid command syntax.") elif(command.split(" ")[0] == "upgradeall"): @@ -228,36 +228,36 @@ def parsecmd(command): else: cprint("Invalid command syntax.") update_archive() - updates = CMAN_upgrade.get_upgrades(inst) + updates = delta_upgrade.get_upgrades(inst) if(len(updates) == 0): cprint("No upgrades available.") else: for update in updates: - CMAN_upgrade.upgrade_mod(update[0]["Name"]) + delta_upgrade.upgrade_mod(update[0]["Name"]) elif(command.split(" ")[0] == "install"): if(len(command.split(" ")) == 3 and command.split(" ")[2] != ""): mod = command.split(" ")[1] mod_version = command.split(" ")[2] update_archive() - CMAN_install.install_mod(mod, version) + delta_install.install_mod(mod, version) elif(len(command.split(" ")) == 2 and command.split(" ")[1] != ""): mod = command.split(" ")[1] update_archive() - CMAN_install.install_mod(mod) + delta_install.install_mod(mod) elif(len(command.split(" ")) == 1): mod = None update_archive() - CMAN_install.install_mod(mod) + delta_install.install_mod(mod) else: cprint("Invalid command syntax.") cprint(len(command.split(" "))) elif(command.split(" ")[0] == "remove"): if(len(command.split(" ")) == 2 and command.split(" ")[1] != ""): mod = command.split(" ")[1] - CMAN_remove.remove_mod(mod) + delta_remove.remove_mod(mod) elif(len(command.split(" ")) == 1): mod = None - CMAN_remove.remove_mod(mod) + delta_remove.remove_mod(mod) else: cprint("Invalid command syntax.") elif(command.split(" ")[0] == "info"): @@ -276,7 +276,7 @@ def parsecmd(command): string = string + item+", " cprint(string[:-2]+"...") # [:-2] to cut off the extra ", " after the last element for item in modslist: - CMAN_install.install_mod(item) + delta_install.install_mod(item) else: cprint("Invalid command syntax.") elif(command.split(" ")[0] == "removem" or command.split(" ")[0] == "removemany"): @@ -288,7 +288,7 @@ def parsecmd(command): string = string + item+", " cprint(string[:-2]+"...") # [:-2] to cut off the extra ", " after the last element for item in modslist: - CMAN_remove.remove_mod(item) + delta_remove.remove_mod(item) else: cprint("Invalid command syntax.") elif(command.split(" ")[0] == "upgradem" or command.split(" ")[0] == "upgrademany"): @@ -300,29 +300,29 @@ def parsecmd(command): string = string + item+", " cprint(string[:-2]+"...") # [:-2] to cut off the extra ", " after the last element for item in modslist: - CMAN_upgrade.upgrade_mod(item) + delta_upgrade.upgrade_mod(item) else: cprint("Invalid command syntax.") elif(command.split(" ")[0] == "export"): if(len(command.split(" ")) == 2 and command.split(" ")[1] != ""): name = command.split(" ")[1] update_archive() - CMAN_importexport.export_mods(name) + delta_importexport.export_mods(name) elif(len(command.split(" ")) == 1): name = None update_archive() - CMAN_importexport.export_mods(name) + delta_importexport.export_mods(name) else: cprint("Invalid command syntax.") elif(command.split(" ")[0] == "import"): if(len(command.split(" ")) == 2 and command.split(" ")[1] != ""): path = command.split(" ")[1] update_archive() - CMAN_importexport.import_mods(path) + delta_importexport.import_mods(path) elif(len(command.split(" ")) == 1): path = None update_archive() - CMAN_importexport.import_mods(path) + delta_importexport.import_mods(path) else: cprint("Invalid command syntax.") elif(command.split(" ")[0] == "instance" or command.split(" ")[0] == "inst"): @@ -416,7 +416,7 @@ def parsecmd(command): elif(command.split(" ")[0] == "list"): listmods() elif(command.split(" ")[0] == "version"): - cprint("CMAN v"+version) + cprint("delta v"+version) elif(command.split(" ")[0] == "help" or command.split(" ")[0] == "?"): print_help() elif(command.split(" ")[0] == "exit"):