| OLD | NEW |
| (Empty) |
| 1 #!/usr/local/evn python | |
| 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | |
| 3 # for details. All rights reserved. Use of this source code is governed by a | |
| 4 # BSD-style license that can be found in the LICENSE file. | |
| 5 | |
| 6 # This is a first stab at creating a Firefox extension which can run Dart | |
| 7 # code by using frog's in-browser compilation. This is a minimal attempt, | |
| 8 # with a UI that needs a total gutting, but it gets things start in Firefox. | |
| 9 # Over time, I hope that Dart in FF becomes a really nice development path. | |
| 10 | |
| 11 # This script first calls copy_libs.py to get the libs staged correctly. | |
| 12 | |
| 13 import os | |
| 14 import shutil | |
| 15 import fileinput | |
| 16 import re | |
| 17 import subprocess | |
| 18 import sys | |
| 19 | |
| 20 TIP_PATH = os.path.dirname(os.path.abspath(__file__)) | |
| 21 FROG_PATH = os.path.dirname(TIP_PATH) | |
| 22 LIB_PATH = os.path.join(FROG_PATH, 'lib') | |
| 23 FFTIP_PATH = os.path.join(TIP_PATH, 'fftip') | |
| 24 FFTIP_CONTENT_PATH = os.path.join(FFTIP_PATH, 'chrome', 'content') | |
| 25 FFTIP_LIB_PATH = os.path.join(FFTIP_CONTENT_PATH, 'lib') | |
| 26 FFTIP_XPI = os.path.join(TIP_PATH, 'fftip.xpi') | |
| 27 | |
| 28 def main(): | |
| 29 subprocess.call([sys.executable, './copy_libs.py']) | |
| 30 if (os.path.exists(FFTIP_LIB_PATH)): | |
| 31 shutil.rmtree(FFTIP_LIB_PATH) | |
| 32 if (os.path.exists(FFTIP_XPI)): | |
| 33 os.remove(FFTIP_XPI) | |
| 34 shutil.copytree(LIB_PATH, FFTIP_LIB_PATH, | |
| 35 ignore=shutil.ignore_patterns('.svn')) | |
| 36 | |
| 37 for file in os.listdir(TIP_PATH): | |
| 38 if (file.endswith('.css') or file.endswith('.gif') or | |
| 39 file.endswith('.html') or file.endswith('.js')): | |
| 40 shutil.copy(file, FFTIP_CONTENT_PATH) | |
| 41 | |
| 42 os.system('cd %s; zip --exclude=*/.svn* -r %s *' % (FFTIP_PATH, FFTIP_XPI)) | |
| 43 print('Generated Firefox extension at %s' % FFTIP_XPI) | |
| 44 | |
| 45 if __name__ == '__main__': | |
| 46 sys.exit(main()) | |
| OLD | NEW |