Pylint cleanup (#74)

* Misc fixes

* Misc cleanup

* Add all_versions to blender_downloader.py

* More cleanup

* Fix issue with status not reporting engine info

* Misc fixes

* Misc cleanup

* Add all_versions to blender_downloader.py

* More cleanup

* Fix issue with status not reporting engine info
This commit is contained in:
2024-01-28 10:30:57 -06:00
committed by GitHub
parent d673d7d4bf
commit 9757ba9276
14 changed files with 79 additions and 57 deletions

View File

@@ -1,5 +1,6 @@
import logging
import re
import threading
import requests
@@ -15,6 +16,7 @@ supported_formats = ['.zip', '.tar.xz', '.dmg']
class BlenderDownloader(EngineDownloader):
engine = Blender
@staticmethod
@@ -79,6 +81,31 @@ class BlenderDownloader(EngineDownloader):
return lts_versions
@classmethod
def all_versions(cls, system_os=None, cpu=None):
majors = cls.__get_major_versions()
all_versions = []
threads = []
results = [[] for _ in majors]
def thread_function(major_version, index, system_os, cpu):
results[index] = cls.__get_minor_versions(major_version, system_os, cpu)
for i, m in enumerate(majors):
thread = threading.Thread(target=thread_function, args=(m, i, system_os, cpu))
threads.append(thread)
thread.start()
# Wait for all threads to complete
for thread in threads:
thread.join()
# Extend all_versions with the results from each thread
for result in results:
all_versions.extend(result)
return all_versions
@classmethod
def find_most_recent_version(cls, system_os=None, cpu=None, lts_only=False):
try:
@@ -108,8 +135,6 @@ class BlenderDownloader(EngineDownloader):
major_version = '.'.join(version.split('.')[:2])
minor_versions = [x for x in cls.__get_minor_versions(major_version, system_os, cpu) if
x['version'] == version]
# we get the URL instead of calculating it ourselves. May change this
cls.download_and_extract_app(remote_url=minor_versions[0]['url'], download_location=download_location,
timeout=timeout)
except IndexError: