mirror of
https://github.com/servo/servo.git
synced 2025-06-20 15:18:58 +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)
|
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
|
@CommandProvider
|
||||||
class PackageCommands(CommandBase):
|
class PackageCommands(CommandBase):
|
||||||
@Command('package',
|
@Command('package',
|
||||||
|
@ -179,14 +186,11 @@ class PackageCommands(CommandBase):
|
||||||
if path.exists(dir_to_dmg):
|
if path.exists(dir_to_dmg):
|
||||||
print("Cleaning up from previous packaging")
|
print("Cleaning up from previous packaging")
|
||||||
delete(dir_to_dmg)
|
delete(dir_to_dmg)
|
||||||
browserhtml_path = find_dep_path_newest('browserhtml', binary_path)
|
browserhtml_path = get_browserhtml_path(binary_path)
|
||||||
if browserhtml_path is None:
|
|
||||||
print("Could not find browserhtml package; perhaps you haven't built Servo.")
|
|
||||||
return 1
|
|
||||||
|
|
||||||
print("Copying files")
|
print("Copying files")
|
||||||
shutil.copytree(path.join(dir_to_root, 'resources'), dir_to_resources)
|
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'))
|
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')
|
content_dir = path.join(dir_to_app, 'Contents', 'MacOS')
|
||||||
|
@ -218,7 +222,7 @@ class PackageCommands(CommandBase):
|
||||||
delete(template_path)
|
delete(template_path)
|
||||||
|
|
||||||
print("Writing run-servo")
|
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(
|
runservo = os.open(
|
||||||
path.join(content_dir, 'run-servo'),
|
path.join(content_dir, 'run-servo'),
|
||||||
os.O_WRONLY | os.O_CREAT,
|
os.O_WRONLY | os.O_CREAT,
|
||||||
|
@ -270,11 +274,7 @@ class PackageCommands(CommandBase):
|
||||||
print("Cleaning up from previous packaging")
|
print("Cleaning up from previous packaging")
|
||||||
delete(dir_to_msi)
|
delete(dir_to_msi)
|
||||||
os.makedirs(dir_to_msi)
|
os.makedirs(dir_to_msi)
|
||||||
browserhtml_path = find_dep_path_newest('browserhtml', binary_path)
|
browserhtml_path = get_browserhtml_path(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")
|
|
||||||
|
|
||||||
print("Copying files")
|
print("Copying files")
|
||||||
dir_to_resources = path.join(dir_to_msi, 'resources')
|
dir_to_resources = path.join(dir_to_msi, 'resources')
|
||||||
|
@ -310,10 +310,7 @@ class PackageCommands(CommandBase):
|
||||||
print("Packaged Servo into {}".format(msi_path))
|
print("Packaged Servo into {}".format(msi_path))
|
||||||
else:
|
else:
|
||||||
dir_to_temp = path.join(path.dirname(binary_path), 'packaging-temp')
|
dir_to_temp = path.join(path.dirname(binary_path), 'packaging-temp')
|
||||||
browserhtml_path = find_dep_path_newest('browserhtml', binary_path)
|
browserhtml_path = get_browserhtml_path(binary_path)
|
||||||
if browserhtml_path is None:
|
|
||||||
print("Could not find browserhtml package; perhaps you haven't built Servo.")
|
|
||||||
return 1
|
|
||||||
if path.exists(dir_to_temp):
|
if path.exists(dir_to_temp):
|
||||||
# TODO(aneeshusa): lock dir_to_temp to prevent simultaneous builds
|
# TODO(aneeshusa): lock dir_to_temp to prevent simultaneous builds
|
||||||
print("Cleaning up from previous packaging")
|
print("Cleaning up from previous packaging")
|
||||||
|
@ -329,7 +326,7 @@ class PackageCommands(CommandBase):
|
||||||
|
|
||||||
print("Writing runservo.sh")
|
print("Writing runservo.sh")
|
||||||
servo_args = ['-b',
|
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))
|
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))
|
os.write(runservo, "#!/usr/bin/env sh\n./servo " + ' '.join(servo_args))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue