Merge pull request #1184 from jp9000/pluginstyles

CI: Include style plugins when packaging on OSX
This commit is contained in:
Colin Edwards 2018-02-06 10:02:00 -06:00 committed by GitHub
commit 4bd4b6bab5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,22 +1,22 @@
#!/usr/bin/env python
candidate_paths = "bin obs-plugins data".split()
plist_path = "../cmake/osxbundle/Info.plist"
icon_path = "../cmake/osxbundle/obs.icns"
run_path = "../cmake/osxbundle/obslaunch.sh"
#not copied
blacklist = """/usr /System""".split()
#copied
whitelist = """/usr/local""".split()
#
#
#
from sys import argv
from glob import glob
from subprocess import check_output, call
@ -33,7 +33,7 @@ def _str_to_bool(s):
raise ValueError('Need bool; got %r' % s)
return {'true': True, 'false': False}[s.lower()]
def add_boolean_argument(parser, name, default=False):
def add_boolean_argument(parser, name, default=False):
"""Add a boolean argument to an ArgumentParser instance."""
group = parser.add_mutually_exclusive_group()
group.add_argument(
@ -58,14 +58,14 @@ def cmd(cmd):
return subprocess.check_output(shlex.split(cmd)).rstrip('\r\n')
LibTarget = namedtuple("LibTarget", ("path", "external", "copy_as"))
inspect = list()
inspected = set()
build_path = args.dir
build_path = build_path.replace("\\ ", " ")
def add(name, external=False, copy_as=None):
if external and copy_as is None:
copy_as = name.split("/")[-1]
@ -93,7 +93,7 @@ for i in candidate_paths:
rel_path = path[len(build_path)+1:]
print(repr(path), repr(rel_path))
add(rel_path)
def add_plugins(path, replace):
for img in glob(path.replace(
"lib/QtCore.framework/Versions/5/QtCore",
@ -114,13 +114,14 @@ while inspect:
continue
out = check_output("{0}otool -L '{1}'".format(args.prefix, path), shell=True,
universal_newlines=True)
if "QtCore" in path:
add_plugins(path, "platforms")
add_plugins(path, "imageformats")
add_plugins(path, "accessible")
add_plugins(path, "styles")
for line in out.split("\n")[1:]:
new = line.strip().split(" (")[0]
if '@' in new and "sparkle.framework" in new.lower():
@ -216,7 +217,7 @@ for path, external, copy_as in inspected:
print(filename)
rpath = "-add_rpath '@loader_path/{}/'".format(ospath.relpath("bin/", ospath.dirname(filename)))
filename = prefix + filename
cmd = "{0}install_name_tool {1} {2} {3} '{4}'".format(args.prefix, changes, id_, rpath, filename)
call(cmd, shell=True)