Skip to content

Commit

Permalink
Add servo version to mac about servo window.
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrewster committed Aug 19, 2016
1 parent 609d47b commit fe61124
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
20 changes: 20 additions & 0 deletions python/servo/package_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import os
import shutil
import subprocess
import mako.template

from mach.registrar import Registrar
from datetime import datetime
Expand Down Expand Up @@ -174,6 +175,25 @@ def package(self, release=False, dev=False, android=None, debug=False, debugger=
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))
Expand Down
7 changes: 7 additions & 0 deletions resources/Credits.rtf.mako
Original file line number Diff line number Diff line change
@@ -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}}

0 comments on commit fe61124

Please sign in to comment.