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

Unified 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.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/libadblockplus/clear_dependencies.py
diff --git a/third_party/libadblockplus/clear_dependencies.py b/third_party/libadblockplus/clear_dependencies.py
new file mode 100644
index 0000000000000000000000000000000000000000..ef95356e340775c2c6d3b897a0f3246aac29a0ec
--- /dev/null
+++ b/third_party/libadblockplus/clear_dependencies.py
@@ -0,0 +1,43 @@
+import sys
+import os
+import shutil
+
+def clear_deps():
+ cwd = os.getcwd()
+ libadblockplus = os.path.join(cwd, 'src', 'third_party', 'libadblockplus')
+ libadblockplus_third_party = os.path.join(libadblockplus, 'third_party')
+
+ # Back-up needed files
+ print('Back-uping')
+
+ # v8_gyp_launcher
+ v8_gyp_launcher_src = os.path.join(libadblockplus_third_party, 'v8_gyp_launcher')
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
+ v8_gyp_launcher_dst = os.path.join(libadblockplus, 'v8_gyp_launcher.bak')
+ shutil.move(v8_gyp_launcher_src, v8_gyp_launcher_dst)
+
+ # detect_v8_host_arch.py
+ detect_v8_host_arch_src = os.path.join(libadblockplus_third_party, 'detect_v8_host_arch.py')
+ detect_v8_host_arch_dst = os.path.join(libadblockplus, 'detect_v8_host_arch.py.bak')
+ shutil.move(detect_v8_host_arch_src, detect_v8_host_arch_dst)
+
+ print('Deleting %s' % libadblockplus_third_party)
+ shutil.rmtree(libadblockplus_third_party)
+
+ # Restore from back-up
+ print('Restoring')
+
+ os.mkdir(libadblockplus_third_party)
+ shutil.move(v8_gyp_launcher_dst, v8_gyp_launcher_src)
+ shutil.move(detect_v8_host_arch_dst, detect_v8_host_arch_src)
+
+ return 0
+
+def main(argv):
+ return clear_deps();
+
+if '__main__' == __name__:
+ try:
+ sys.exit(main(sys.argv[1:]))
+ except KeyboardInterrupt:
+ sys.stderr.write('interrupted\n')
+ sys.exit(1)

Powered by Google App Engine
This is Rietveld