diff options
Diffstat (limited to 'python/servo/package_commands.py')
-rw-r--r-- | python/servo/package_commands.py | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/python/servo/package_commands.py b/python/servo/package_commands.py index 1bd91e6eae1..fd7520fb10b 100644 --- a/python/servo/package_commands.py +++ b/python/servo/package_commands.py @@ -16,7 +16,6 @@ sys.path.append(path.join(path.dirname(sys.argv[0]), "components", "style", "pro import os import shutil import subprocess -import tarfile from mach.registrar import Registrar from datetime import datetime @@ -29,7 +28,14 @@ from mach.decorators import ( from mako.template import Template -from servo.command_base import CommandBase, cd, BuildNotFound, is_macosx, is_windows +from servo.command_base import ( + archive_deterministically, + BuildNotFound, + cd, + CommandBase, + is_macosx, + is_windows, +) from servo.post_build_commands import find_dep_path_newest @@ -146,7 +152,7 @@ class PackageCommands(CommandBase): print("Writing run-servo") bhtml_path = path.join('${0%/*}/../Resources', browserhtml_path.split('/')[-1], 'out', 'index.html') runservo = os.open(dir_to_app + '/Contents/MacOS/run-servo', os.O_WRONLY | os.O_CREAT, int("0755", 8)) - os.write(runservo, '#!/bin/bash\nexec ${0%/*}/servo ' + bhtml_path) + os.write(runservo, '#!/bin/bash\nexec ${0%/*}/servo -M -S ' + bhtml_path) os.close(runservo) print("Creating dmg") @@ -205,7 +211,10 @@ class PackageCommands(CommandBase): else: dir_to_package = '/'.join(binary_path.split('/')[:-1]) dir_to_root = '/'.join(binary_path.split('/')[:-3]) - shutil.copytree(dir_to_root + '/resources', dir_to_package + '/resources') + resources_dir = dir_to_package + '/resources' + if os.path.exists(resources_dir): + delete(resources_dir) + shutil.copytree(dir_to_root + '/resources', resources_dir) browserhtml_path = find_dep_path_newest('browserhtml', binary_path) if browserhtml_path is None: print("Could not find browserhtml package; perhaps you haven't built Servo.") @@ -220,7 +229,7 @@ class PackageCommands(CommandBase): delete(dir_to_package + '/build/' + f) print("Writing runservo.sh") # TODO: deduplicate this arg list from post_build_commands - servo_args = ['-w', '-b', + servo_args = ['-w', '-b', '-M', '-S', '--pref', 'dom.mozbrowser.enabled', '--pref', 'dom.forcetouch.enabled', '--pref', 'shell.builtin-key-shortcuts.enabled=false', @@ -234,9 +243,9 @@ class PackageCommands(CommandBase): time = datetime.utcnow().replace(microsecond=0).isoformat() time = time.replace(':', "-") tar_path += time + "-servo-tech-demo.tar.gz" - with tarfile.open(tar_path, "w:gz") as tar: - # arcname is to add by relative rather than absolute path - tar.add(dir_to_package, arcname='servo/') + + archive_deterministically(dir_to_package, tar_path, prepend_path='servo/') + print("Packaged Servo into " + tar_path) @Command('install', |