summaryrefslogtreecommitdiffstats
path: root/build/linux
diff options
context:
space:
mode:
authorsschmitz@chromium.org <sschmitz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-22 03:49:20 +0000
committersschmitz@chromium.org <sschmitz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-22 03:49:20 +0000
commitbd29cddcdd473be5a35c97c9240116c51fc6dbfb (patch)
tree8844129f9d4df526a93e2ed935d44854dd0edd41 /build/linux
parent673db3e4dd66607d3caf2a4ad3d4e3b2f5a5148a (diff)
downloadchromium_src-bd29cddcdd473be5a35c97c9240116c51fc6dbfb.zip
chromium_src-bd29cddcdd473be5a35c97c9240116c51fc6dbfb.tar.gz
chromium_src-bd29cddcdd473be5a35c97c9240116c51fc6dbfb.tar.bz2
Installing ChromeOS font on developer Linux machine
Added call to a new script in: build/install-build-deps.sh to download and install the ChromeOS default font (Noto Sans UI). The installation is in: /usr/local/share/fonts. ChromeOS on Linux will use the font if present. The installation creates (or recreates) a subdir: "chromeos". In it it creates a .stamp file which is used to avoid re-installation if it is already up to date. It also creates a README file. BUG=148945 TEST=manual; One way to test is to instrument the file: src/ui/gfx/platform_font_pango.cc to log default_font_->GetFontName(); in ctor PlatformFontPango::PlatformFontPango() Expect: W/out font installation: DejaVu Sans With font installation: Noto Sans UI Review URL: https://chromiumcodereview.appspot.com/12313039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184006 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/linux')
-rwxr-xr-xbuild/linux/install-chromeos-fonts.py71
1 files changed, 71 insertions, 0 deletions
diff --git a/build/linux/install-chromeos-fonts.py b/build/linux/install-chromeos-fonts.py
new file mode 100755
index 0000000..bb5f3c9
--- /dev/null
+++ b/build/linux/install-chromeos-fonts.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Script to install the Chrome OS fonts on Linux.
+# This script can be run manually (as root), but is also run as part
+# install-build-deps.sh.
+
+import os
+import shutil
+import subprocess
+import sys
+
+URL_PREFIX = 'https://commondatastorage.googleapis.com'
+URL_DIR = 'chromeos-localmirror/distfiles'
+URL_FILE = 'notofonts-20121206.tar.gz'
+FONTS_DIR = '/usr/local/share/fonts'
+
+# The URL matches the URL in the ebuild script in chromiumos. See:
+# /path/to/chromiumos/src/
+# third_party/chromiumos-overlay/media-fonts/notofonts/
+# notofonts-20121206.ebuild
+
+def main(args):
+ if not sys.platform.startswith('linux'):
+ print "Error: %s must be run on Linux." % __file__
+ return 1
+
+ if os.getuid() != 0:
+ print "Error: %s must be run as root." % __file__
+ return 1
+
+ if not os.path.isdir(FONTS_DIR):
+ print "Error: Destination directory does not exist: %s" % FONTS_DIR
+ return 1
+
+ dest_dir = os.path.join(FONTS_DIR, 'chromeos')
+
+ url = "%s/%s/%s" % (URL_PREFIX, URL_DIR, URL_FILE)
+
+ stamp = os.path.join(dest_dir, ".stamp")
+ if os.path.exists(stamp):
+ with open(stamp) as s:
+ if s.read() == url:
+ print "Chrome OS fonts already up-to-date in %s." % dest_dir
+ return 0
+
+ if os.path.isdir(dest_dir):
+ shutil.rmtree(dest_dir)
+ os.mkdir(dest_dir);
+
+ print "Installing Chrome OS fonts to %s." % dest_dir
+ tarball = os.path.join(dest_dir, URL_FILE)
+ subprocess.check_call(['curl', '-L', url, '-o', tarball])
+ subprocess.check_call(['tar', 'xf', tarball, '-C', dest_dir])
+ os.remove(tarball)
+
+ readme = os.path.join(dest_dir, "README")
+ with open(readme, 'w') as s:
+ s.write("This directory and its contents are auto-generated.\n")
+ s.write("It may be deleted and recreated. Do not modify.\n")
+ s.write("Script: %s\n" % __file__)
+
+ with open(stamp, 'w') as s:
+ s.write(url)
+
+ return 0
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:]))