Skip to content

Commit

Permalink
classes.info: Handle missing PyQt5
Browse files Browse the repository at this point in the history
Certain environments (e.g. Sphinx doc builds in CI tasks) may
import classes.info but not have PyQt5 available.
  • Loading branch information
ferdnyc committed May 5, 2020
1 parent e0d3776 commit 94cf950
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/classes/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 94cf950

Please sign in to comment.