aboutsummaryrefslogtreecommitdiffhomepage
path: root/gn/ar.py
diff options
context:
space:
mode:
Diffstat (limited to 'gn/ar.py')
-rw-r--r--gn/ar.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/gn/ar.py b/gn/ar.py
new file mode 100644
index 0000000000..dc3ae8d948
--- /dev/null
+++ b/gn/ar.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+#
+# Copyright 2016 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import subprocess
+import sys
+
+# Equivalent to: rm -f $2 && $1 rcs $2 @$3
+
+ar, output, rspfile = sys.argv[1:]
+
+if os.path.exists(output):
+ os.remove(output)
+sys.exit(subprocess.call([ar, "rcs", output, "@" + rspfile]))