aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-08-19 19:45:00 -0500
committerGitHub <noreply@github.com>2016-08-19 19:45:00 -0500
commit5a5c16776c738fc31bd93c8c45297b53087f9d20 (patch)
treecc5c26c3465ce4baacd1640d538506143cc1d94d
parent28767cdb6725be83dcf50b9682a49de01229a287 (diff)
parentfe61124c15736922c842dc6377d064ae468dc3da (diff)
downloadservo-5a5c16776c738fc31bd93c8c45297b53087f9d20.tar.gz
servo-5a5c16776c738fc31bd93c8c45297b53087f9d20.zip
Auto merge of #12250 - ConnorGBrewster:mac_about_version, r=larsbergstrom
Add servo version to mac about servo window. <!-- Please describe your changes on the following line: --> <img width="396" alt="screen shot 2016-07-04 at 8 43 44 pm" src="https://cloud.githubusercontent.com/assets/9086315/16572663/30a6dd6c-4228-11e6-9098-68c49900b14e.png"> cc @aneeshusa --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes are a temporary solution for #12052 (github issue number if applicable). <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12250) <!-- Reviewable:end -->
-rw-r--r--python/servo/package_commands.py20
-rw-r--r--resources/Credits.rtf.mako7
2 files changed, 27 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))
diff --git a/resources/Credits.rtf.mako b/resources/Credits.rtf.mako
new file mode 100644
index 00000000000..1ab6ddd5528
--- /dev/null
+++ b/resources/Credits.rtf.mako
@@ -0,0 +1,7 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1404\cocoasubrtf460
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\vieww12000\viewh15840\viewkind0
+\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\qc\partightenfactor0
+
+\f0\fs24 \cf0 ${version}}