Browse Source

making some suggestions from a friend, found what looks to be a bug around long arg --wow_path, maybe?? I will test more and get some others input.

suggestions
prasket 1 year ago
parent
commit
9914f18a17
2 changed files with 26 additions and 26 deletions
  1. +2
    -1
      .gitignore
  2. +24
    -25
      update.py

+ 2
- 1
.gitignore View File

@ -1,3 +1,4 @@
.vscode/
.tmp/
elvui_update.zip
elvui_update.zip
_retail_

+ 24
- 25
update.py View File

@ -35,16 +35,15 @@ def get_update(update_version):
except urllib.error.URLError as e:
print(f"Update Version {update_version} {e.reason}")
sys.exit(1)
#usage()
print(f"Download of {update_url} completed.")
def install_update(wow_path):
install_path = wow_path + '_retail_/Interface/AddOns/'
def install_update(wowPath):
install_path = wowPath + '/_retail_/Interface/AddOns/'
with ZipFile('elvui_update.zip', 'r') as zipObj:
zipObj.extractall(install_path)
print("Extraction over old add-on completed.")
print(f"Extraction over old add-on completed in: {install_path}")
def remove_download():
os.remove('elvui_update.zip')
@ -53,29 +52,29 @@ def remove_download():
# Define the usage of the app
def usage():
"""Prints usage information"""
print()
print("ElvUI Updater by prasket")
print(" ")
print("Usage: python update.py")
print(" ")
print("-h --help - this message")
print("-w --wow_path - *OPTIONAL* path to your base WOW install")
print(" Default = /Applications/World of Warcraft/")
print()
print("Examples:")
print(" Running with default install path:")
print(" python update.py")
print(" Running with custom install path:")
print(" python update.py --wow_path /apps/wow")
print()
print("""
ElvUI Updater by prasket
Usage: python update.py
-h --help - this message
-w --wow_path - *OPTIONAL* path to your base WOW install
(Default = /Applications/World of Warcraft/)
Examples:
Running with default install path:
python update.py
Running with custom install path:
python update.py --wow_path /apps/wow
""")
sys.exit(0)
def main():
def main(argv):
# set default wow path making -w argv optional
wow_path = '/Application/World of Warcraft' # default wow install dir on MacOS.
wowPath = "/Applications/World of Warcraft" # default wow install dir on MacOS.
try:
opts, args = getopt.getopt(sys.argv[1:], "h:w:", ["help", "wow_path"])
opts, args = getopt.getopt(argv,"hw:",["help","wow_path="])
except getopt.GetoptError as err:
print(str(err))
@ -85,17 +84,17 @@ def main():
if o in ("-h", "--help"):
usage()
elif o in ("-w", "--wow_path"):
wow_path = a
wowPath = a
else:
assert False, "Unhandled Option"
# grab update version #
update_version = get_update_version()
get_update(update_version)
install_update(wow_path)
install_update(wowPath)
remove_download()
print(f"ElvUI has been updated to {update_version}")
if __name__ == "__main__":
main()
main(sys.argv[1:])

Loading…
Cancel
Save