mirror of
https://github.com/servo/servo.git
synced 2025-06-19 14:48:59 +01:00
Package: Simplify getting browserhtml path
This commit is contained in:
parent
63a4bf74b0
commit
456900b4ef
1 changed files with 13 additions and 16 deletions
|
@ -123,6 +123,13 @@ def change_prefs(resources_path, platform):
|
|||
delete(package_prefs_path)
|
||||
|
||||
|
||||
def get_browserhtml_path(binary_path):
|
||||
browserhtml_path = find_dep_path_newest('browserhtml', binary_path)
|
||||
if browserhtml_path:
|
||||
return path.join(browserhtml_path, "out")
|
||||
sys.exit("Could not find browserhtml package; perhaps you haven't built Servo.")
|
||||
|
||||
|
||||
@CommandProvider
|
||||
class PackageCommands(CommandBase):
|
||||
@Command('package',
|
||||
|
@ -179,14 +186,11 @@ class PackageCommands(CommandBase):
|
|||
if path.exists(dir_to_dmg):
|
||||
print("Cleaning up from previous packaging")
|
||||
delete(dir_to_dmg)
|
||||
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.")
|
||||
return 1
|
||||
browserhtml_path = get_browserhtml_path(binary_path)
|
||||
|
||||
print("Copying files")
|
||||
shutil.copytree(path.join(dir_to_root, 'resources'), dir_to_resources)
|
||||
shutil.copytree(browserhtml_path, path.join(dir_to_resources, path.basename(browserhtml_path)))
|
||||
shutil.copytree(browserhtml_path, path.join(dir_to_resources, 'browserhtml'))
|
||||
shutil.copy2(path.join(dir_to_root, 'Info.plist'), path.join(dir_to_app, 'Contents', 'Info.plist'))
|
||||
|
||||
content_dir = path.join(dir_to_app, 'Contents', 'MacOS')
|
||||
|
@ -218,7 +222,7 @@ class PackageCommands(CommandBase):
|
|||
delete(template_path)
|
||||
|
||||
print("Writing run-servo")
|
||||
bhtml_path = path.join('${0%/*}', '..', 'Resources', path.basename(browserhtml_path), 'out', 'index.html')
|
||||
bhtml_path = path.join('${0%/*}', '..', 'Resources', 'browserhtml', 'index.html')
|
||||
runservo = os.open(
|
||||
path.join(content_dir, 'run-servo'),
|
||||
os.O_WRONLY | os.O_CREAT,
|
||||
|
@ -270,11 +274,7 @@ class PackageCommands(CommandBase):
|
|||
print("Cleaning up from previous packaging")
|
||||
delete(dir_to_msi)
|
||||
os.makedirs(dir_to_msi)
|
||||
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.")
|
||||
return 1
|
||||
browserhtml_path = path.join(browserhtml_path, "out")
|
||||
browserhtml_path = get_browserhtml_path(binary_path)
|
||||
|
||||
print("Copying files")
|
||||
dir_to_resources = path.join(dir_to_msi, 'resources')
|
||||
|
@ -310,10 +310,7 @@ class PackageCommands(CommandBase):
|
|||
print("Packaged Servo into {}".format(msi_path))
|
||||
else:
|
||||
dir_to_temp = path.join(path.dirname(binary_path), 'packaging-temp')
|
||||
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.")
|
||||
return 1
|
||||
browserhtml_path = get_browserhtml_path(binary_path)
|
||||
if path.exists(dir_to_temp):
|
||||
# TODO(aneeshusa): lock dir_to_temp to prevent simultaneous builds
|
||||
print("Cleaning up from previous packaging")
|
||||
|
@ -329,7 +326,7 @@ class PackageCommands(CommandBase):
|
|||
|
||||
print("Writing runservo.sh")
|
||||
servo_args = ['-b',
|
||||
path.join('./browserhtml', 'out', 'index.html')]
|
||||
path.join('./browserhtml', 'index.html')]
|
||||
|
||||
runservo = os.open(path.join(dir_to_temp, 'runservo.sh'), os.O_WRONLY | os.O_CREAT, int("0755", 8))
|
||||
os.write(runservo, "#!/usr/bin/env sh\n./servo " + ' '.join(servo_args))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue