OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 import shutil | |
7 import sys | |
8 | |
9 THIRD_PARTY_DIR = sys.path[0] + '/../../../../../third_party/' | |
Aaron Boodman
2012/06/02 07:50:22
Not sure if this will work on Windows. Use os.join
cduvall
2012/06/02 19:12:05
Done.
| |
10 LOCAL_THIRD_PARTY_DIR = sys.path[0] + '/third_party/' | |
Aaron Boodman
2012/06/02 07:50:22
For added safety, do a sanity check that third_par
cduvall
2012/06/02 19:12:05
sys.path[0] allows this to work when run from any
Aaron Boodman
2012/06/03 05:43:14
Ah, my mistake. I guess the check is not necessary
| |
11 | |
12 def main(): | |
13 shutil.rmtree(LOCAL_THIRD_PARTY_DIR, True) | |
14 shutil.copytree(THIRD_PARTY_DIR + 'handlebar', | |
15 LOCAL_THIRD_PARTY_DIR + 'handlebar') | |
16 with open(LOCAL_THIRD_PARTY_DIR + '__init__.py', 'w') as f: | |
17 f.write('\n') | |
Aaron Boodman
2012/06/02 07:50:22
You can just do os.utime(path).
cduvall
2012/06/02 19:12:05
Done.
| |
18 shutil.copy(LOCAL_THIRD_PARTY_DIR + '__init__.py', | |
19 LOCAL_THIRD_PARTY_DIR + 'handlebar') | |
20 with open(LOCAL_THIRD_PARTY_DIR + 'handlebar/__init__.py', 'a') as f: | |
21 f.write('\nfrom handlebar import Handlebar\n') | |
Aaron Boodman
2012/06/02 07:50:22
I think it would be less surprising to just import
cduvall
2012/06/02 19:12:05
This import is needed to access the class (I think
| |
22 | |
23 if __name__ == '__main__': | |
24 main() | |
OLD | NEW |