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 -->
This commit is contained in:
bors-servo 2016-08-19 19:45:00 -05:00 committed by GitHub
commit 5a5c16776c
2 changed files with 27 additions and 0 deletions

View file

@ -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))

View file

@ -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}}