New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
having some issue with update ? please help #129
Comments
after commenting out the update line from python code it works fine # Check for updates
# if not args.skip_update:
# try:
# local_files_path = current_wd + os.sep
# branch = 'main'
# url = f'https://api.github.com/repos/t3l3machus/Villain/git/trees/{branch}?recursive=1'
# raw_url = f'https://raw.githubusercontent.com/t3l3machus/Villain/{branch}/'
# Loading.active = True
# loading_animation = Thread(target = Loading.animate, args = (f'[{INFO}] Checking for updates',), name = 'loading_animation', daemon = True).start()
# def get_local_file_hash(filename):
# try:
# with open(local_files_path + filename, 'rb') as f:
# data = f.read()
# return md5(data).hexdigest()
# except FileNotFoundError:
# return False
# def update_file(filename, data):
# try:
# with open(local_files_path + filename, 'wb') as f:
# f.write(data)
# return True
# except:
# return False
# try:
# response = requests_get(url = url, timeout=(5, 27))
# response.raise_for_status() # raises stored HTTPError, if one occurred
# res_status_code = response.status_code
# #except requests.exceptions.HTTPError as e:
# #print(f'\r[{ERR}] Failed to fetch latest version data: {e}')
# except Exception as e:
# res_status_code = -1
# Loading.stop()
# print(f'\r[{ERR}] Failed to fetch latest version data: {e}')
# if res_status_code == 200:
# files = [file['path'] for file in response.json()['tree'] if file['type'] == 'blob']
# update_consent = False
# for filename in files:
# file_data = requests_get(url = raw_url + filename, timeout=(5, 27))
# latest_signature = md5(file_data.content).hexdigest()
# local_signature = get_local_file_hash(filename)
# if not local_signature or (local_signature != latest_signature):
# Loading.stop()
# if not update_consent:
# consent = input(f'\r[{INFO}] Updates detected. Would you like to proceed? [y/n]: ').lower().strip()
# if consent in ['y', 'yes']:
# update_consent = True
# Loading.active = True
# loading_animation = Thread(target = Loading.animate, args = (f'[{INFO}] Updating',), name = 'loading_animation', daemon = True).start()
# else:
# break
# if update_consent:
# updated = update_file(filename, file_data.content)
# if not updated:
# Loading.stop()
# print(f'\r[{ERR}] Error while updating files. Installation may be corrupt. Consider reinstalling Villain.')
# exit(1)
# if update_consent:
# Loading.stop()
# print(f'\r[{INFO}] Update completed!')
# os.execv(sys.executable, ['python3'] + sys.argv + ['-q'] + ['-s'])
# else:
# Loading.stop(print_nl = True)
# else:
# Loading.stop(print_nl = True)
# except KeyboardInterrupt:
# Loading.stop(print_nl = True)
# pass |
Hey, you can use |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: