OLD | NEW |
| (Empty) |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 import os.path | |
6 import shutil | |
7 import sys | |
8 | |
9 # Ensures that the current version matches the last-produced version, which is | |
10 # stored in the version_file. If it does not, then the framework_root_dir is | |
11 # obliterated. | |
12 # Usage: python prepare_framework_version.py out/obj/version_file \ | |
13 # out/Framework.framework \ | |
14 # 'A' | |
15 | |
16 def PrepareFrameworkVersion(version_file, framework_root_dir, version): | |
17 try: | |
18 with open(version_file, 'r') as f: | |
19 current_version = f.read() | |
20 if current_version == version: | |
21 return | |
22 except IOError: | |
23 pass | |
24 | |
25 if os.path.exists(framework_root_dir): | |
26 shutil.rmtree(framework_root_dir) | |
27 | |
28 f = open(version_file, 'w+') | |
29 f.write(version) | |
30 f.close() | |
31 | |
32 | |
33 if __name__ == '__main__': | |
34 PrepareFrameworkVersion(sys.argv[1], sys.argv[2], sys.argv[3]) | |
OLD | NEW |