Title: [266478] trunk/Tools
Revision
266478
Author
jbed...@apple.com
Date
2020-09-02 12:15:43 -0700 (Wed, 02 Sep 2020)

Log Message

[webkitcorepy] Add NoAction class
https://bugs.webkit.org/show_bug.cgi?id=216079
<rdar://problem/68216301>

Reviewed by Dewei Zhu.

This is an argparse action we've duplicated in a few Internal scripts, it should
be in a shared library.

* Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py: Bump version.
* Scripts/libraries/webkitcorepy/webkitcorepy/arguments.py: Added.
(NoAction): argparse action supporting a binary flag.

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/ChangeLog (266477 => 266478)


--- trunk/Tools/ChangeLog	2020-09-02 18:44:31 UTC (rev 266477)
+++ trunk/Tools/ChangeLog	2020-09-02 19:15:43 UTC (rev 266478)
@@ -1,3 +1,18 @@
+2020-09-02  Jonathan Bedard  <jbed...@apple.com>
+
+        [webkitcorepy] Add NoAction class
+        https://bugs.webkit.org/show_bug.cgi?id=216079
+        <rdar://problem/68216301>
+
+        Reviewed by Dewei Zhu.
+
+        This is an argparse action we've duplicated in a few Internal scripts, it should
+        be in a shared library.
+
+        * Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py: Bump version.
+        * Scripts/libraries/webkitcorepy/webkitcorepy/arguments.py: Added.
+        (NoAction): argparse action supporting a binary flag.
+
 2020-09-02  Aditya Keerthi  <akeer...@apple.com>
 
         [macOS] Update date picker when the inner control is edited

Modified: trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py (266477 => 266478)


--- trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py	2020-09-02 18:44:31 UTC (rev 266477)
+++ trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py	2020-09-02 19:15:43 UTC (rev 266478)
@@ -35,7 +35,7 @@
 from webkitcorepy.subprocess_utils import TimeoutExpired, CompletedProcess, run
 from webkitcorepy.output_capture import LoggerCapture, OutputCapture, OutputDuplicate
 
-version = Version(0, 4, 3)
+version = Version(0, 4, 4)
 
 from webkitcorepy.autoinstall import Package, AutoInstall
 if sys.version_info > (3, 0):

Added: trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/arguments.py (0 => 266478)


--- trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/arguments.py	                        (rev 0)
+++ trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/arguments.py	2020-09-02 19:15:43 UTC (rev 266478)
@@ -0,0 +1,31 @@
+# Copyright (C) 2020 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import argparse
+
+
+class NoAction(argparse.Action):
+    def __init__(self, option_strings, dest, **kwargs):
+        super(NoAction, self).__init__(option_strings, dest, nargs=0, **kwargs)
+
+    def __call__(self, parser, namespace, values, option_string=None):
+        setattr(namespace, self.dest, False if option_string.startswith('--no') else True)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to