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: Created Jan. 16, 2018, 5:29 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 def clear_deps():
6 cwd = os.getcwd()
7 libadblockplus = os.path.join(cwd, 'src', 'third_party', 'libadblockplus')
8 libadblockplus_third_party = os.path.join(libadblockplus, 'third_party')
9
10 # Back-up needed files
11 print('Back-uping')
12
13 # v8_gyp_launcher
14 v8_gyp_launcher_src = os.path.join(libadblockplus_third_party, 'v8_gyp_launche r')
shoniko 2018/01/16 07:14:14 Nit: We usually rely on PEP-8 for Python style gui
anton 2018/01/16 07:18:36 Thanks for letting me know. Should we use Chromium
15 v8_gyp_launcher_dst = os.path.join(libadblockplus, 'v8_gyp_launcher.bak')
16 shutil.move(v8_gyp_launcher_src, v8_gyp_launcher_dst)
17
18 # detect_v8_host_arch.py
19 detect_v8_host_arch_src = os.path.join(libadblockplus_third_party, 'detect_v8_ host_arch.py')
20 detect_v8_host_arch_dst = os.path.join(libadblockplus, 'detect_v8_host_arch.py .bak')
21 shutil.move(detect_v8_host_arch_src, detect_v8_host_arch_dst)
22
23 print('Deleting %s' % libadblockplus_third_party)
24 shutil.rmtree(libadblockplus_third_party)
25
26 # Restore from back-up
27 print('Restoring')
28
29 os.mkdir(libadblockplus_third_party)
30 shutil.move(v8_gyp_launcher_dst, v8_gyp_launcher_src)
31 shutil.move(detect_v8_host_arch_dst, detect_v8_host_arch_src)
32
33 return 0
34
35 def main(argv):
36 return clear_deps();
37
38 if '__main__' == __name__:
39 try:
40 sys.exit(main(sys.argv[1:]))
41 except KeyboardInterrupt:
42 sys.stderr.write('interrupted\n')
43 sys.exit(1)
OLDNEW

Powered by Google App Engine
This is Rietveld