Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: third_party/libadblockplus/clear_dependencies.py

Issue 29670555: Issue 6264 - Can't prepare libadblockplus dependencies (Closed)
Patch Set: Formatted with respect to eyeo python code style and tested with flake8 Created Jan. 16, 2018, 8:37 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 import sys
2 import os
3 import shutil
4
5
6 def clear_deps():
7 cwd = os.getcwd()
8 libadblockplus = os.path.join(cwd, 'src', 'third_party', 'libadblockplus')
9 libadblockplus_third_party = os.path.join(libadblockplus, 'third_party')
10
11 # Back-up needed files
sergei 2018/01/16 11:51:00 If we removed only libadblockplus/third_party/v8 t
12 print('Back-uping')
13
14 # v8_gyp_launcher
15 v8_gyp_launcher_src = os.path.join(
16 libadblockplus_third_party, 'v8_gyp_launcher')
17 v8_gyp_launcher_dst = os.path.join(libadblockplus, 'v8_gyp_launcher.bak')
18 shutil.move(v8_gyp_launcher_src, v8_gyp_launcher_dst)
19
20 # detect_v8_host_arch.py
21 detect_v8_host_arch_src = os.path.join(
22 libadblockplus_third_party, 'detect_v8_host_arch.py')
23 detect_v8_host_arch_dst = os.path.join(
24 libadblockplus, 'detect_v8_host_arch.py.bak')
25 shutil.move(detect_v8_host_arch_src, detect_v8_host_arch_dst)
26
27 print('Deleting {}'.format(libadblockplus_third_party))
28 shutil.rmtree(libadblockplus_third_party)
29
30 # Restore from back-up
31 print('Restoring')
32
33 os.mkdir(libadblockplus_third_party)
34 shutil.move(v8_gyp_launcher_dst, v8_gyp_launcher_src)
35 shutil.move(detect_v8_host_arch_dst, detect_v8_host_arch_src)
36
37 return 0
38
39
40 def main(argv):
41 return clear_deps()
42
43
44 if '__main__' == __name__:
45 try:
46 sys.exit(main(sys.argv[1:]))
47 except KeyboardInterrupt:
48 sys.stderr.write('interrupted\n')
49 sys.exit(1)
OLDNEW

Powered by Google App Engine
This is Rietveld