aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/package_commands.py
diff options
context:
space:
mode:
authorConnor Brewster <connor.brewster@eagles.oc.edu>2016-07-01 21:26:12 -0600
committerConnor Brewster <connor.brewster@eagles.oc.edu>2016-08-19 18:55:27 -0500
commitfe61124c15736922c842dc6377d064ae468dc3da (patch)
tree0d500ae70289102c14149bd68b196e9dd0cb4fa6 /python/servo/package_commands.py
parent609d47b44fdd31b712100839e1d4c5db15dbafcd (diff)
downloadservo-fe61124c15736922c842dc6377d064ae468dc3da.tar.gz
servo-fe61124c15736922c842dc6377d064ae468dc3da.zip
Add servo version to mac about servo window.
Diffstat (limited to 'python/servo/package_commands.py')
-rw-r--r--python/servo/package_commands.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/python/servo/package_commands.py b/python/servo/package_commands.py
index 314d1ceaf34..5b1a75b6301 100644
--- a/python/servo/package_commands.py
+++ b/python/servo/package_commands.py
@@ -16,6 +16,7 @@ sys.path.append(path.join(path.dirname(sys.argv[0]), "components", "style", "pro
import os
import shutil
import subprocess
+import mako.template
from mach.registrar import Registrar
from datetime import datetime
@@ -174,6 +175,25 @@ class PackageCommands(CommandBase):
print("Finding dylibs and relinking")
copy_dependencies(dir_to_app + '/Contents/MacOS/servo', dir_to_app + '/Contents/MacOS/')
+ print("Adding version to Credits.rtf")
+ version_command = [binary_path, '--version']
+ p = subprocess.Popen(version_command,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ universal_newlines=True)
+ version, stderr = p.communicate()
+ if p.returncode != 0:
+ raise Exception("Error occurred when getting Servo version: " + stderr)
+ version = "Nightly version: " + version
+
+ template_path = os.path.join(dir_to_resources, 'Credits.rtf.mako')
+ credits_path = os.path.join(dir_to_resources, 'Credits.rtf')
+ with open(template_path) as template_file:
+ template = mako.template.Template(template_file.read())
+ with open(credits_path, "w") as credits_file:
+ credits_file.write(template.render(version=version))
+ delete(template_path)
+
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))