From 71941ce580cac1f727bf19ba3226ca55e27d29fe Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Mon, 4 Aug 2014 14:37:33 -0400 Subject: [PATCH] build: teach macdeploy the -translations-dir argument, for use with static qt When QT is linked statically, macdeploy can't infer its paths. While plugins and frameworks don't need to be packaged, translations still do (for now). --- contrib/macdeploy/macdeployqtplus | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/contrib/macdeploy/macdeployqtplus b/contrib/macdeploy/macdeployqtplus index eece81dd3d..23b57a76b3 100755 --- a/contrib/macdeploy/macdeployqtplus +++ b/contrib/macdeploy/macdeployqtplus @@ -449,6 +449,7 @@ ap.add_argument("-sign", dest="sign", action="store_true", default=False, help=" ap.add_argument("-dmg", nargs="?", const="", metavar="basename", help="create a .dmg disk image; if basename is not specified, a camel-cased version of the app name is used") ap.add_argument("-fancy", nargs=1, metavar="plist", default=[], help="make a fancy looking disk image using the given plist file with instructions; requires -dmg to work") ap.add_argument("-add-qt-tr", nargs=1, metavar="languages", default=[], help="add Qt translation files to the bundle's ressources; the language list must be separated with commas, not with whitespace") +ap.add_argument("-translations-dir", nargs=1, metavar="path", default=None, help="Path to Qt's translation files") ap.add_argument("-add-resources", nargs="+", metavar="path", default=[], help="list of additional files or folders to be copied into the bundle's resources; must be the last argument") config = ap.parse_args() @@ -467,6 +468,15 @@ if not os.path.exists(app_bundle): app_bundle_name = os.path.splitext(os.path.basename(app_bundle))[0] # ------------------------------------------------ +translations_dir = None +if config.translations_dir and config.translations_dir[0]: + if os.path.exists(config.translations_dir[0]): + translations_dir = config.translations_dir[0] + else: + if verbose >= 1: + sys.stderr.write("Error: Could not find translation dir \"%s\"\n" % (translations_dir)) + sys.exit(1) +# ------------------------------------------------ for p in config.add_resources: if verbose >= 3: @@ -590,7 +600,14 @@ if config.plugins: if len(config.add_qt_tr) == 0: add_qt_tr = [] else: - qt_tr_dir = os.path.join(deploymentInfo.qtPath, "translations") + if translations_dir is not None: + qt_tr_dir = translations_dir + else: + if deploymentInfo.qtPath is not None: + qt_tr_dir = os.path.join(deploymentInfo.qtPath, "translations") + else: + sys.stderr.write("Error: Could not find Qt translation path\n") + sys.exit(1) add_qt_tr = ["qt_%s.qm" % lng for lng in config.add_qt_tr[0].split(",")] for lng_file in add_qt_tr: p = os.path.join(qt_tr_dir, lng_file)