| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 # Script to install the Chrome OS fonts on Linux. | 6 # Script to install the Chrome OS fonts on Linux. |
| 7 # This script can be run manually (as root), but is also run as part | 7 # This script can be run manually (as root), but is also run as part |
| 8 # install-build-deps.sh. | 8 # install-build-deps.sh. |
| 9 | 9 |
| 10 import os | 10 import os |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 if not os.path.isdir(FONTS_DIR): | 41 if not os.path.isdir(FONTS_DIR): |
| 42 print "Error: Destination directory does not exist: %s" % FONTS_DIR | 42 print "Error: Destination directory does not exist: %s" % FONTS_DIR |
| 43 return 1 | 43 return 1 |
| 44 | 44 |
| 45 dest_dir = os.path.join(FONTS_DIR, 'chromeos') | 45 dest_dir = os.path.join(FONTS_DIR, 'chromeos') |
| 46 | 46 |
| 47 stamp = os.path.join(dest_dir, ".stamp02") | 47 stamp = os.path.join(dest_dir, ".stamp02") |
| 48 if os.path.exists(stamp): | 48 if os.path.exists(stamp): |
| 49 with open(stamp) as s: | 49 with open(stamp) as s: |
| 50 if s.read() == '\n'.join(URLS): | 50 if s.read() == '\n'.join(URLS): |
| 51 print "Chrome OS fonts already up-to-date in %s." % dest_dir | 51 print "Chrome OS fonts already up to date in %s." % dest_dir |
| 52 return 0 | 52 return 0 |
| 53 | 53 |
| 54 if os.path.isdir(dest_dir): | 54 if os.path.isdir(dest_dir): |
| 55 shutil.rmtree(dest_dir) | 55 shutil.rmtree(dest_dir) |
| 56 os.mkdir(dest_dir) | 56 os.mkdir(dest_dir) |
| 57 os.chmod(dest_dir, 0755) | 57 os.chmod(dest_dir, 0755) |
| 58 | 58 |
| 59 print "Installing Chrome OS fonts to %s." % dest_dir | 59 print "Installing Chrome OS fonts to %s." % dest_dir |
| 60 for url in URLS: | 60 for url in URLS: |
| 61 tarball = os.path.join(dest_dir, os.path.basename(url)) | 61 tarball = os.path.join(dest_dir, os.path.basename(url)) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 76 for base, dirs, files in os.walk(dest_dir): | 76 for base, dirs, files in os.walk(dest_dir): |
| 77 for dir in dirs: | 77 for dir in dirs: |
| 78 os.chmod(os.path.join(base, dir), 0755) | 78 os.chmod(os.path.join(base, dir), 0755) |
| 79 for file in files: | 79 for file in files: |
| 80 os.chmod(os.path.join(base, file), 0644) | 80 os.chmod(os.path.join(base, file), 0644) |
| 81 | 81 |
| 82 return 0 | 82 return 0 |
| 83 | 83 |
| 84 if __name__ == '__main__': | 84 if __name__ == '__main__': |
| 85 sys.exit(main(sys.argv[1:])) | 85 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |