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: Formatted with respect to eyeo python code style and tested with flake8 Created Jan. 16, 2018, 8:37 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..363c1567dd8a94df689299f1f5e1ff179d094acd
--- /dev/null
+++ b/third_party/libadblockplus/clear_dependencies.py
@@ -0,0 +1,49 @@
+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
sergei 2018/01/16 11:51:00 If we removed only libadblockplus/third_party/v8 t
+ print('Back-uping')
+
+ # v8_gyp_launcher
+ v8_gyp_launcher_src = os.path.join(
+ libadblockplus_third_party, 'v8_gyp_launcher')
+ 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 {}'.format(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