From 94cf95019e557519ae5ffaeaaf1f91889e50ba46 Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Tue, 5 May 2020 06:37:22 -0400 Subject: [PATCH] classes.info: Handle missing PyQt5 Certain environments (e.g. Sphinx doc builds in CI tasks) may import classes.info but not have PyQt5 available. --- src/classes/info.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/classes/info.py b/src/classes/info.py index 1adf24d493..1d62d086e4 100644 --- a/src/classes/info.py +++ b/src/classes/info.py @@ -28,8 +28,6 @@ import os from time import strftime -from PyQt5.QtCore import QDir - VERSION = "2.5.1-dev2" MINIMUM_LIBOPENSHOT_VERSION = "0.2.5" DATE = "20200228000000" @@ -98,11 +96,18 @@ print("Loading translations from: {}".format(language_path)) # Compile language list from :/locale resource -langdir = QDir(language_path) -langs = langdir.entryList(['OpenShot.*.qm'], QDir.NoDotAndDotDot | QDir.Files, - sort=QDir.Name) -for trpath in langs: - SUPPORTED_LANGUAGES.append(trpath.split('.')[1]) +try: + from PyQt5.QtCore import QDir + langdir = QDir(language_path) + langs = langdir.entryList( + ['OpenShot.*.qm'], + QDir.NoDotAndDotDot | QDir.Files, + sort=QDir.Name) + for trpath in langs: + SUPPORTED_LANGUAGES.append(trpath.split('.')[1]) +except ImportError: + # Fail gracefully if we're running without PyQt5 (e.g. CI tasks) + pass SETUP = { "name": NAME,