diff --git a/.gitignore b/.gitignore index 3811ffc..607877c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +*workspace* *.conf *.shlf *test* diff --git a/py/VERSION b/py/VERSION index 23aa839..b966e81 100644 --- a/py/VERSION +++ b/py/VERSION @@ -1 +1 @@ -1.2.2 +1.2.4 \ No newline at end of file diff --git a/py/init.py b/py/init.py index 4aa798f..c410f8d 100644 --- a/py/init.py +++ b/py/init.py @@ -4,11 +4,10 @@ import sys import os import configparser import wget -import sysrsync import shutil #funky stuff to deal with relative file paths -dir = os.getcwd() +randir = os.getcwd() os.chdir(os.path.dirname(os.path.realpath(__file__))) config = configparser.ConfigParser() @@ -16,16 +15,22 @@ config.read("config.conf") if config["config"]["autoupdate"] == "true": versionl = version.local() versionr = version.remote() + print(versionr.join(".")) #updater -if versionl < versionr: - print("outdated version detected\n",versionl," < ",versionr) +if ".".join(versionl)<".".join(versionr): + print("outdated version",versionl,"<",versionr) if config["config"]["autoupdate"] == "true": print("autoupdate is enabled, attempting to update") - wget.download("https://github.com/ionburger/turdbot/archive/refs/tags/"+versionr+".zip",out = "turdbot.zip") - shutil.unpack_archive("turdbot.zip","turdbot") - sysrsync.run(source="turdbot/turdbot-"+versionr+"/py/*.py",destination="*.py") - os.chdir(dir) + wget.download("https://github.com/ionburger/turdbot/archive/refs/tags/"+versionr+".zip",out = "turdbottmp.zip") + shutil.unpack_archive("turdbottmp.zip","turdbottmp") + for file in os.listdir("turdbottmp/turdbot-"+versionr+"/py/"): + if file.endswith(".py"): + shutil.move("turdbottmp/turdbot-"+versionr+"/py/"+file,file) + with open("VERSION","w") as file: + file.write(versionr) + + os.chdir(randir) os.execl(sys.executable, sys.executable, *sys.argv) else: - print("running latest version of turdbot ",versionl) + print("running latest version of turdbot",versionl) diff --git a/py/turdbot (1).zip b/py/turdbottmp (1).zip similarity index 100% rename from py/turdbot (1).zip rename to py/turdbottmp (1).zip diff --git a/py/turdbot.zip b/py/turdbottmp (2).zip similarity index 100% rename from py/turdbot.zip rename to py/turdbottmp (2).zip diff --git a/py/turdbottmp.zip b/py/turdbottmp.zip new file mode 100644 index 0000000..9ea419d Binary files /dev/null and b/py/turdbottmp.zip differ diff --git a/py/turdbot/turdbot-1.2.4/.gitignore b/py/turdbottmp/turdbot-1.2.4/.gitignore similarity index 100% rename from py/turdbot/turdbot-1.2.4/.gitignore rename to py/turdbottmp/turdbot-1.2.4/.gitignore diff --git a/py/turdbot/turdbot-1.2.4/LICENSE b/py/turdbottmp/turdbot-1.2.4/LICENSE similarity index 100% rename from py/turdbot/turdbot-1.2.4/LICENSE rename to py/turdbottmp/turdbot-1.2.4/LICENSE diff --git a/py/turdbot/turdbot-1.2.4/README.md b/py/turdbottmp/turdbot-1.2.4/README.md similarity index 100% rename from py/turdbot/turdbot-1.2.4/README.md rename to py/turdbottmp/turdbot-1.2.4/README.md diff --git a/py/turdbot/turdbot-1.2.4/html/about.html b/py/turdbottmp/turdbot-1.2.4/html/about.html similarity index 100% rename from py/turdbot/turdbot-1.2.4/html/about.html rename to py/turdbottmp/turdbot-1.2.4/html/about.html diff --git a/py/turdbot/turdbot-1.2.4/html/images/a.jpg b/py/turdbottmp/turdbot-1.2.4/html/images/a.jpg similarity index 100% rename from py/turdbot/turdbot-1.2.4/html/images/a.jpg rename to py/turdbottmp/turdbot-1.2.4/html/images/a.jpg diff --git a/py/turdbot/turdbot-1.2.4/html/images/coffee.jpg b/py/turdbottmp/turdbot-1.2.4/html/images/coffee.jpg similarity index 100% rename from py/turdbot/turdbot-1.2.4/html/images/coffee.jpg rename to py/turdbottmp/turdbot-1.2.4/html/images/coffee.jpg diff --git a/py/turdbot/turdbot-1.2.4/html/index.html b/py/turdbottmp/turdbot-1.2.4/html/index.html similarity index 100% rename from py/turdbot/turdbot-1.2.4/html/index.html rename to py/turdbottmp/turdbot-1.2.4/html/index.html diff --git a/py/turdbot/turdbot-1.2.4/py/VERSION b/py/turdbottmp/turdbot-1.2.4/py/VERSION similarity index 100% rename from py/turdbot/turdbot-1.2.4/py/VERSION rename to py/turdbottmp/turdbot-1.2.4/py/VERSION diff --git a/py/turdbot/turdbot-1.2.4/py/init.py b/py/turdbottmp/turdbot-1.2.4/py/init.py similarity index 100% rename from py/turdbot/turdbot-1.2.4/py/init.py rename to py/turdbottmp/turdbot-1.2.4/py/init.py diff --git a/py/turdbot/turdbot-1.2.4/py/main.py b/py/turdbottmp/turdbot-1.2.4/py/main.py similarity index 100% rename from py/turdbot/turdbot-1.2.4/py/main.py rename to py/turdbottmp/turdbot-1.2.4/py/main.py diff --git a/py/turdbot/turdbot-1.2.4/py/storage.py b/py/turdbottmp/turdbot-1.2.4/py/storage.py similarity index 100% rename from py/turdbot/turdbot-1.2.4/py/storage.py rename to py/turdbottmp/turdbot-1.2.4/py/storage.py diff --git a/py/turdbot/turdbot-1.2.4/py/version.py b/py/turdbottmp/turdbot-1.2.4/py/version.py similarity index 100% rename from py/turdbot/turdbot-1.2.4/py/version.py rename to py/turdbottmp/turdbot-1.2.4/py/version.py diff --git a/py/version.py b/py/version.py index e51fbfb..057892e 100644 --- a/py/version.py +++ b/py/version.py @@ -3,8 +3,8 @@ import subprocess def remote(): try: process = subprocess.Popen(["lastversion", "ionburger/turdbot"],stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - return (process.communicate()[0]) + return (process.communicate()[0]).strip("\n") except: return 0 def local(): - return open("VERSION","r").read() \ No newline at end of file + return open("VERSION","r").read().strip("\n") \ No newline at end of file