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

@@ -11,14 +11,27 @@ logger = logging.getLogger()
def launch_url(url):
if subprocess.run(['which', 'xdg-open'], capture_output=True).returncode == 0:
subprocess.run(['xdg-open', url]) # linux
elif subprocess.run(['which', 'open'], capture_output=True).returncode == 0:
subprocess.run(['open', url]) # macos
elif subprocess.run(['which', 'start'], capture_output=True).returncode == 0:
subprocess.run(['start', url]) # windows - need to validate this works
logger = logging.getLogger(__name__)
if shutil.which('xdg-open'):
opener = 'xdg-open'
elif shutil.which('open'):
opener = 'open'
elif shutil.which('cmd'):
opener = 'start'
else:
logger.error(f"No valid launchers found to launch url: {url}")
error_message = f"No valid launchers found to launch URL: {url}"
logger.error(error_message)
raise OSError(error_message)
try:
if opener == 'start':
# For Windows, use 'cmd /c start'
subprocess.run(['cmd', '/c', 'start', url], shell=False)
else:
subprocess.run([opener, url])
except Exception as e:
logger.error(f"Failed to launch URL: {url}. Error: {e}")
def file_exists_in_mounts(filepath):