diff --git a/Python Version/Setup.py b/Python Version/Setup.py index d1e68bc..deb56b6 100644 --- a/Python Version/Setup.py +++ b/Python Version/Setup.py @@ -7,10 +7,10 @@ import pkg_resources import sys import time import os -import shutil from zipfile import ZipFile DIRPATH = os.path.dirname(os.path.realpath(__file__)) + #Checking the required folders folders= ["Assets","FFglitch","DatamoshLib","pymosh"] missingfolder=[] @@ -32,10 +32,10 @@ missingset=[*missing,] #Download the modules if not installed if missing: - res=input("Some modules are not installed \n do you want to download and install them? (Y/N): ") + res = input("Some modules are not installed... \n do you want to download and install them now? (Y/N): ") while not ((res=="Y") or (res=="y") or (res=="N") or (res=="n")): print("Please choose a valid option!") - res=input("Some modules are not installed \n do you want to download and install them? (Y/N): ") + res = input("Some modules are not installed... \n do you want to download and install them now? (Y/N): ") if res=="Y" or res=="y": try: print("Installing modules...") @@ -50,43 +50,48 @@ if missing: time.sleep(3) sys.exit() elif res=="N" or res=="n": - print("Without the modules you can't use this program. Please install them first! \nThis are the required one: "+str(required) - +"\nUse 'pip install module_name' to download modules one by one") + print("Without the modules you can't open this program. Please install them first! \nThis are the required one: "+str(required) + +"\nUse 'pip install module_name' to download modules one by one manually") time.sleep(3) sys.exit() else: - print("All modules installed!") + print("All required modules installed!") #Check FFglitch Status def checkffglitch(): print("Checking FFglitch:") print("Running ffgac...") - ffgac=str(DIRPATH).replace(os.sep, '/')+"/FFglitch/ffgac" - ffedit=str(DIRPATH).replace(os.sep, '/')+"/FFglitch/ffedit" + ffgac = os.path.join(DIRPATH,"FFglitch","ffgac") + ffedit = os.path.join(DIRPATH,"FFglitch","ffedit") + try: subprocess.Popen(f'"{ffgac}" -version', shell=True) except: - print("permission denied! Please give permission to ffgac to execute.") + print("permission denied! Please give permission to ffgac!") + time.sleep(1) print("Running ffedit...") try: subprocess.Popen(f'"{ffedit}" -version', shell=True) except: - print("permission denied! Please give permission to ffedit to execute.") + print("permission denied! Please give permission to ffedit!") time.sleep(1) print("Done...") #Download ffglitch if not available -if (os.path.exists("FFglitch/ffgac") or os.path.exists("FFglitch/ffgac.exe")) and (os.path.exists("FFglitch/ffedit") or os.path.exists("FFglitch/ffedit.exe")): +if (os.path.exists(os.path.join("FFglitch","ffgac")) or + os.path.exists(os.path.join("FFglitch","ffgac.exe"))) and (os.path.exists(os.path.join("FFglitch","ffedit")) + or os.path.exists(os.path.join("FFglitch","ffedit.exe"))): checkffglitch() else: print("ffgac/ffedit not found inside ffglitch folder, you cannot run the ffglitch modes without these programs") - res2=input("Do you want to download ffglitch now? (Y/N): ") + res2 = input("Do you want to download ffglitch now? (Y/N): ") while not ((res2=="Y") or (res2=="y") or (res2=="N") or (res2=="n")): print("Please choose a valid option!") - res2=input("Do you want to download ffglitch now? (Y/N): ") + res2 = input("Do you want to download ffglitch now? (Y/N): ") + if res2=="Y" or res2=="y": - print("Downloading FFglitch...(size: approx 17MB)") + print("Downloading FFglitch... (size: approx 17MB)") if sys.platform.startswith("win"): #download ffglitch for windows URL = "https://github.com/Akascape/FFglitch-0.9.3-executables/releases/download/zip-packages/ffglitch-0.9.3-win64.zip" elif sys.platform.startswith("linux"): #download ffglitch for linux @@ -99,20 +104,21 @@ else: response = requests.get(URL) open("FFglitch//ffglitch.zip", "wb").write(response.content) except: - print("Unable to download ffglitch from site! Check your connection or download it manually from https://github.com/Akascape/FFglitch-0.9.3-executables \nand paste the files (ffgac and ffedit) inside FFglitch folder.") + print("Unable to download ffglitch from site! Check your connection or download it manually from: | https://github.com/Akascape/FFglitch-0.9.3-executables |") + print("Paste the files (ffgac and ffedit) inside FFglitch folder.") time.sleep(3) sys.exit() time.sleep(1) print("Exctracting the files...") try: - with ZipFile('FFglitch/ffglitch.zip', 'r') as zip: + with ZipFile(os.path.join('FFglitch','ffglitch.zip'), 'r') as zip: zip.extractall('FFglitch/') except: print("Failed to extract ffglitch.zip, please extract it manually in the FFglitch folder.") time.sleep(3) sys.exit() - if os.path.exists("FFglitch/ffgac") or os.path.exists("FFglitch/ffgac.exe"): - os.remove("FFglitch//ffglitch.zip") + if os.path.exists(os.path.join("FFglitch","ffgac")) or os.path.exists(os.path.join("FFglitch","ffgac.exe")): + os.remove(os.path.join("FFglitch","ffglitch.zip")) time.sleep(1) checkffglitch() print("FFglitch setup complete!")