|
@@ -15,11 +15,12 @@ SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
|
|
def main():
|
|
|
args = parse_args()
|
|
|
|
|
|
- initial_app_path = os.path.join(os.path.abspath(args.source_root), args.build_dir)
|
|
|
+ source_root = os.path.abspath(args.source_root)
|
|
|
+ initial_app_path = os.path.join(source_root, args.build_dir)
|
|
|
app_path = create_app_copy(initial_app_path)
|
|
|
|
|
|
# Those are the same in the original app and its copy.
|
|
|
- # So it is ok to retrieve them from the original build dir and use in the copy.
|
|
|
+ # So it is ok to get them from the original build dir and use in the copy.
|
|
|
product_name = gn(initial_app_path).args().get_string('electron_product_name')
|
|
|
project_name = gn(initial_app_path).args().get_string('electron_project_name')
|
|
|
|
|
@@ -39,7 +40,7 @@ def main():
|
|
|
ffmpeg_name = 'libffmpeg.so'
|
|
|
|
|
|
# Copy ffmpeg without proprietary codecs into app.
|
|
|
- ffmpeg_lib_path = os.path.join(os.path.abspath(args.source_root), args.ffmpeg_path, ffmpeg_name)
|
|
|
+ ffmpeg_lib_path = os.path.join(source_root, args.ffmpeg_path, ffmpeg_name)
|
|
|
shutil.copy(ffmpeg_lib_path, ffmpeg_app_path)
|
|
|
|
|
|
returncode = 0
|
|
@@ -60,10 +61,12 @@ def main():
|
|
|
# Create copy of app to install ffmpeg library without proprietary codecs into
|
|
|
def create_app_copy(initial_app_path):
|
|
|
app_path = os.path.join(os.path.dirname(initial_app_path),
|
|
|
- os.path.basename(initial_app_path) + '-no-proprietary-codecs')
|
|
|
+ os.path.basename(initial_app_path)
|
|
|
+ + '-no-proprietary-codecs')
|
|
|
|
|
|
if sys.platform == 'darwin':
|
|
|
- product_name = gn(initial_app_path).args().get_string('electron_product_name')
|
|
|
+ product_name = gn(initial_app_path).args().get_string(
|
|
|
+ 'electron_product_name')
|
|
|
app_name = '{0}.app'.format(product_name)
|
|
|
initial_app_path = os.path.join(initial_app_path, app_name)
|
|
|
app_path = os.path.join(app_path, app_name)
|
|
@@ -75,14 +78,16 @@ def create_app_copy(initial_app_path):
|
|
|
def parse_args():
|
|
|
parser = argparse.ArgumentParser(description='Test non-proprietary ffmpeg')
|
|
|
parser.add_argument('-b', '--build-dir',
|
|
|
- help='Path to an Electron build folder. Relative to the --source-root.',
|
|
|
+ help='Path to an Electron build folder. \
|
|
|
+ Relative to the --source-root.',
|
|
|
default=None,
|
|
|
required=True)
|
|
|
parser.add_argument('--source-root',
|
|
|
default=SOURCE_ROOT,
|
|
|
required=False)
|
|
|
parser.add_argument('--ffmpeg-path',
|
|
|
- help='Path to a folder with a ffmpeg lib. Relative to the --source-root.',
|
|
|
+ help='Path to a folder with a ffmpeg lib. \
|
|
|
+ Relative to the --source-root.',
|
|
|
default=None,
|
|
|
required=True)
|
|
|
return parser.parse_args()
|