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).
This commit is contained in:
parent
f8120f7e0f
commit
71941ce580
1 changed files with 18 additions and 1 deletions
|
@ -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("-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("-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("-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")
|
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()
|
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]
|
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:
|
for p in config.add_resources:
|
||||||
if verbose >= 3:
|
if verbose >= 3:
|
||||||
|
@ -590,7 +600,14 @@ if config.plugins:
|
||||||
if len(config.add_qt_tr) == 0:
|
if len(config.add_qt_tr) == 0:
|
||||||
add_qt_tr = []
|
add_qt_tr = []
|
||||||
else:
|
else:
|
||||||
|
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")
|
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(",")]
|
add_qt_tr = ["qt_%s.qm" % lng for lng in config.add_qt_tr[0].split(",")]
|
||||||
for lng_file in add_qt_tr:
|
for lng_file in add_qt_tr:
|
||||||
p = os.path.join(qt_tr_dir, lng_file)
|
p = os.path.join(qt_tr_dir, lng_file)
|
||||||
|
|
Loading…
Reference in a new issue