From 7db0fcdafb52db1f9e3f0ae5b68794c6827e0930 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Thu, 30 Jul 2015 11:06:18 +0200 Subject: [PATCH] Move Botsbuildbots to contrib Closes #678. Signed-off-by: Gergely Nagy --- hy/contrib/botsbuildbots.hy | 33 +++++++++++++++++++++ hy/core/language.hy | 5 +--- hy/core/macros.hy | 13 -------- tests/__init__.py | 1 + tests/native_tests/contrib/botsbuildbots.hy | 5 ++++ tests/native_tests/native_macros.hy | 3 -- 6 files changed, 40 insertions(+), 20 deletions(-) create mode 100644 hy/contrib/botsbuildbots.hy create mode 100644 tests/native_tests/contrib/botsbuildbots.hy diff --git a/hy/contrib/botsbuildbots.hy b/hy/contrib/botsbuildbots.hy new file mode 100644 index 0000000..77742bd --- /dev/null +++ b/hy/contrib/botsbuildbots.hy @@ -0,0 +1,33 @@ +;; Copyright (c) 2014, 2015 Gergely Nagy + +;; Permission is hereby granted, free of charge, to any person obtaining a +;; copy of this software and associated documentation files (the "Software"), +;; to deal in the Software without restriction, including without limitation +;; the rights to use, copy, modify, merge, publish, distribute, sublicense, +;; and/or sell copies of the Software, and to permit persons to whom the +;; Software is furnished to do so, subject to the following conditions: + +;; The above copyright notice and this permission notice shall be included in +;; all copies or substantial portions of the Software. + +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +;; THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +;; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +;; DEALINGS IN THE SOFTWARE. + +(defun Botsbuildbots () (Botsbuildbots)) + +(defmacro Botsbuildbots [] + "Build bots, repeatedly.^W^W^WPrint the AUTHORS, forever." + `(try + (do + (import [requests]) + + (let [[r (requests.get + "https://raw.githubusercontent.com/hylang/hy/master/AUTHORS")]] + (repeat r.text))) + (catch [e ImportError] + (repeat "Botsbuildbots requires `requests' to function.")))) diff --git a/hy/core/language.hy b/hy/core/language.hy index d70e84b..8557760 100644 --- a/hy/core/language.hy +++ b/hy/core/language.hy @@ -391,8 +391,6 @@ (read :from-file (StringIO input))) -(defun Botsbuildbots () (Botsbuildbots)) - (defn zipwith [func &rest lists] "Zip the contents of several lists and map a function to the result" (do @@ -425,8 +423,7 @@ (hyify (. value __name__)) (catch [] (string value)))))) -(def *exports* '[Botsbuildbots - butlast calling-module-name coll? cons cons? cycle +(def *exports* '[butlast calling-module-name coll? cons cons? cycle dec distinct disassemble drop drop-last drop-while empty? even? every? first filter filterfalse flatten float? fraction gensym identity inc input instance? integer integer? integer-char? diff --git a/hy/core/macros.hy b/hy/core/macros.hy index 014920c..b0c06db 100644 --- a/hy/core/macros.hy +++ b/hy/core/macros.hy @@ -220,19 +220,6 @@ `(setv ~name ~main))) ret)) -(defmacro Botsbuildbots [] - "Build bots, repeatedly.^W^W^WPrint the AUTHORS, forever." - `(try - (do - (import [requests]) - - (let [[r (requests.get - "https://raw.githubusercontent.com/hylang/hy/master/AUTHORS")]] - (repeat r.text))) - (catch [e ImportError] - (repeat "Botsbuildbots requires `requests' to function.")))) - - (defreader @ [expr] (let [[decorators (slice expr nil -1)] [fndef (get expr -1)]] diff --git a/tests/__init__.py b/tests/__init__.py index 291a850..9580680 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -20,6 +20,7 @@ from .native_tests.contrib.meth import * # noqa from .native_tests.contrib.walk import * # noqa from .native_tests.contrib.multi import * # noqa from .native_tests.contrib.curry import * # noqa +from .native_tests.contrib.botsbuildbots import * # noqa if PY3: from .native_tests.py3_only_tests import * # noqa diff --git a/tests/native_tests/contrib/botsbuildbots.hy b/tests/native_tests/contrib/botsbuildbots.hy new file mode 100644 index 0000000..7fc0d7b --- /dev/null +++ b/tests/native_tests/contrib/botsbuildbots.hy @@ -0,0 +1,5 @@ +(import [hy.contrib.botsbuildbots [*]]) +(require hy.contrib.botsbuildbots) + +(defn test-botsbuildbots [] + (assert (> (len (first (Botsbuildbots))) 50))) diff --git a/tests/native_tests/native_macros.hy b/tests/native_tests/native_macros.hy index 018e019..5ad2df2 100644 --- a/tests/native_tests/native_macros.hy +++ b/tests/native_tests/native_macros.hy @@ -257,9 +257,6 @@ (yield 4)))) (assert (= (list (yield-from-test)) [0 1 2 1 2 3 4]))) -(defn test-botsbuildbots [] - (assert (> (len (first (Botsbuildbots))) 50))) - (defn test-defmain [] "NATIVE: make sure defmain is clean"