]> khamidou — GitHub mirrors - electron.git/commitdiff
Add action to copy chromedriver.
authorCheng Zhao <zcbenz@gmail.com>
Fri, 12 Sep 2014 13:48:45 +0000 (21:48 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Fri, 12 Sep 2014 13:48:45 +0000 (21:48 +0800)
atom.gyp
tools/copy_binary.py [new file with mode: 0755]

index b725bad156e77467b15ebf0a0cf109f77d67b952..4bb3de978ce1aa85678bc42d556d83de6c1239b0 100644 (file)
--- a/atom.gyp
+++ b/atom.gyp
         }],  # OS=="linux"
       ],
     },  # target <(project_name>_dump_symbols
+    {
+      'target_name': 'copy_chromedriver',
+      'type': 'none',
+      'actions': [
+        {
+          'action_name': 'Copy ChromeDriver Binary',
+          'variables': {
+            'conditions': [
+              ['OS=="win"', {
+                'chromedriver_binary': 'chromedriver.exe',
+              },{
+                'chromedriver_binary': 'chromedriver',
+              }],
+            ],
+          },
+          'inputs': [
+            '<(libchromiumcontent_library_dir)/<(chromedriver_binary)',
+          ],
+          'outputs': [
+            '<(PRODUCT_DIR)/<(chromedriver_binary)',
+          ],
+          'action': [
+            'python',
+            'tools/copy_binary.py',
+            '<@(_inputs)',
+            '<@(_outputs)',
+          ],
+        }
+      ],
+    },  # copy_chromedriver
   ],
   'conditions': [
     ['OS=="mac"', {
diff --git a/tools/copy_binary.py b/tools/copy_binary.py
new file mode 100755 (executable)
index 0000000..a21b652
--- /dev/null
@@ -0,0 +1,12 @@
+#!/usr/bin/env python
+
+import os
+import shutil
+import stat
+import sys
+
+src = sys.argv[1]
+dist = sys.argv[2]
+
+shutil.copyfile(src, dist)
+os.chmod(dist, os.stat(dist).st_mode | stat.S_IEXEC)