changeset 460:6547b28d9983

documentation & release fixes
author Louis Opter <kalessin@kalessin.fr>
date Sat, 28 May 2016 18:42:04 -0700
parents c6515904f07f
children b19134003e8f
files add_make_release.patch white_colors_clarifications.patch
diffstat 2 files changed, 109 insertions(+), 84 deletions(-) [+]
line wrap: on
line diff
--- a/add_make_release.patch	Mon May 23 01:29:51 2016 -0700
+++ b/add_make_release.patch	Sat May 28 18:42:04 2016 -0700
@@ -27,23 +27,22 @@
  ENABLE_TESTING()
  
  ### Platform checks ############################################################
-@@ -26,6 +22,15 @@
+@@ -26,6 +22,14 @@
  FIND_PACKAGE(Endian REQUIRED)
  FIND_PACKAGE(Sphinx)
  
-+IF (CMAKE_BUILD_TYPE MATCHES RELEASE)
-+  FIND_PACKAGE(Gzip)
-+  FIND_PACKAGE(Hg)
-+  FIND_PACKAGE(PythonInterp 3.3) # >= 3.3 for os.replace
-+  FIND_PACKAGE(BsdTar)
-+  FIND_PACKAGE(Virtualenv)
-+  FIND_PACKAGE(Xz)
-+ENDIF ()
++# Release tools:
++FIND_PACKAGE(Gzip)
++FIND_PACKAGE(Hg)
++FIND_PACKAGE(PythonInterp 3.3) # >= 3.3 for os.replace
++FIND_PACKAGE(BsdTar)
++FIND_PACKAGE(Virtualenv)
++FIND_PACKAGE(Xz)
 +
  INCLUDE(CheckFunctionExists)
  INCLUDE(CheckVariableExists)
  INCLUDE(TestBigEndian)
-@@ -92,9 +97,7 @@
+@@ -92,9 +96,7 @@
  
  # 2.8.11 is the first version with TARGET_INCLUDE_DIRECTORIES:
  IF (CMAKE_VERSION VERSION_GREATER 2.8.10)
@@ -54,7 +53,7 @@
      ADD_SUBDIRECTORY(tests)
  ELSE ()
      MESSAGE(
-@@ -105,9 +108,14 @@
+@@ -105,7 +107,34 @@
  ENDIF ()
  
  IF (SPHINX_FOUND)
@@ -62,13 +61,33 @@
      ADD_SUBDIRECTORY(docs)
 +ELSE ()
 +    MESSAGE(STATUS "Shpinx wasn't found, docs generation disabled")
++ENDIF ()
++
++IF (
++    PYTHONINTERP_FOUND
++    AND PYTHON_VERSION_MAJOR EQUAL 3
++    AND PYTHON_VERSION_MINOR GREATER 2
++    AND VIRTUALENV_FOUND
++    AND HG_FOUND
++    AND BSDTAR_FOUND
++    AND GZIP_FOUND
++    AND XZ_FOUND
++)
++    MESSAGE(
++        STATUS
++        "Python >= 3.3, virtualenv, bsdtar, gzip, xz, and mercurial (hg) "
++        "found, release commands enabled"
++    )
++    ADD_SUBDIRECTORY(dist)
++ELSE ()
++    MESSAGE(
++        STATUS
++        "Python >= 3.3 and/or virtualenv, bsdtar, gzip, xz, mercurial (hg) "
++        "weren't found, release commands disabled"
++    )
  ENDIF ()
  
-+ADD_SUBDIRECTORY(dist)
-+
  INSTALL(
-     FILES COPYING README.rst docs/protocol.rst
-     DESTINATION share/doc/lightsd
 diff --git a/CMakeScripts/FindBsdTar.cmake b/CMakeScripts/FindBsdTar.cmake
 new file mode 100644
 --- /dev/null
@@ -142,77 +161,54 @@
 new file mode 100644
 --- /dev/null
 +++ b/dist/CMakeLists.txt
-@@ -0,0 +1,70 @@
-+IF (
-+    PYTHONINTERP_FOUND
-+    AND PYTHON_VERSION_MAJOR EQUAL 3
-+    AND PYTHON_VERSION_MINOR GREATER 2 # os.replace
-+    AND VIRTUALENV_FOUND
-+    AND HG_FOUND
-+    AND BSDTAR_FOUND
-+    AND GZIP_FOUND
-+    AND XZ_FOUND
+@@ -0,0 +1,47 @@
++SET(VENV_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/py-env")
++SET(VENV_PYTHON "${VENV_DIRECTORY}/bin/python")
++SET(VENV_STAMP "${VENV_DIRECTORY}/stamp")
++SET(PIP_REQUIREMENTS "${CMAKE_CURRENT_SOURCE_DIR}/requirements-release.txt")
++
++CONFIGURE_FILE(release.py.in "${CMAKE_CURRENT_BINARY_DIR}/release.py" @ONLY)
++
++ADD_CUSTOM_COMMAND(
++    OUTPUT "${VENV_STAMP}"
++    COMMAND "${VIRTUALENV_EXECUTABLE}" -q -p "${PYTHON_EXECUTABLE}" "${VENV_DIRECTORY}"
++    COMMAND "${VENV_DIRECTORY}/bin/pip" -q install -r "${PIP_REQUIREMENTS}"
++    COMMAND "${CMAKE_COMMAND}" -E touch "${VENV_STAMP}"
++    DEPENDS "${PIP_REQUIREMENTS}"
++    COMMENT "Setting up a Python virtualenv at ${VENV_DIRECTORY} for the release script"
++    VERBATIM
 +)
-+    MESSAGE(
-+        STATUS
-+        "Python >= 3.3, virtualenv, bsdtar, gzip, xz, and mercurial (hg) "
-+        "found, release commands enabled"
-+    )
 +
-+    SET(VENV_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/py-env")
-+    SET(VENV_PYTHON "${VENV_DIRECTORY}/bin/python")
-+    SET(VENV_STAMP "${VENV_DIRECTORY}/stamp")
-+    SET(PIP_REQUIREMENTS "${CMAKE_CURRENT_SOURCE_DIR}/requirements-release.txt")
-+
-+    CONFIGURE_FILE(release.py.in "${CMAKE_CURRENT_BINARY_DIR}/release.py" @ONLY)
-+
-+    ADD_CUSTOM_COMMAND(
-+        OUTPUT "${VENV_STAMP}"
-+        COMMAND "${VIRTUALENV_EXECUTABLE}" -q -p "${PYTHON_EXECUTABLE}" "${VENV_DIRECTORY}"
-+        COMMAND "${VENV_DIRECTORY}/bin/pip" -q install -r "${PIP_REQUIREMENTS}"
-+        COMMAND "${CMAKE_COMMAND}" -E touch "${VENV_STAMP}"
-+        DEPENDS "${PIP_REQUIREMENTS}"
-+        COMMENT "Setting up a Python virtualenv at ${VENV_DIRECTORY} for the release script"
++SET(
++    RELEASE_COMMANDS
++    release
++    pre_release
++    package_release
++    release_new_tag
++    release_docs
++    release_debuild
++)
++FOREACH (TARGET ${RELEASE_COMMANDS})
++    ADD_CUSTOM_TARGET(
++        ${TARGET}
++        COMMAND "${VENV_PYTHON}" "${CMAKE_CURRENT_BINARY_DIR}/release.py" "${TARGET}"
++        DEPENDS "${VENV_STAMP}"
 +        VERBATIM
 +    )
++ENDFOREACH ()
 +
-+    SET(
-+        RELEASE_COMMANDS
-+        release
-+        pre_release
-+        package_release
-+        release_new_tag
-+        release_docs
-+        release_debuild
-+    )
-+    FOREACH (TARGET ${RELEASE_COMMANDS})
-+        ADD_CUSTOM_TARGET(
-+            ${TARGET}
-+            COMMAND "${VENV_PYTHON}" "${CMAKE_CURRENT_BINARY_DIR}/release.py" "${TARGET}"
-+            DEPENDS "${VENV_STAMP}"
-+            VERBATIM
-+        )
-+    ENDFOREACH ()
++ADD_DEPENDENCIES(release_docs docs)
 +
-+    ADD_DEPENDENCIES(release_docs docs)
-+
-+    SET(
-+        EXTRA_OUTPUT
-+        "${CMAKE_CURRENT_BINARY_DIR}/debuild" # release_debuild
-+        "${CMAKE_CURRENT_BINARY_DIR}/lightsd-${LIGHTSD_VERSION}.tar" # release_new_tag
-+        "${VENV_DIRECTORY}"
-+        "${VENV_STAMP}"
-+    )
-+    SET_DIRECTORY_PROPERTIES(
-+        PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${EXTRA_OUTPUT}"
-+    )
-+ELSE ()
-+    MESSAGE(
-+        STATUS
-+        "Python >= 3.3 and/or virtualenv, bsdtar, gzip, xz, mercurial (hg) "
-+        "weren't found, release commands disabled"
-+    )
-+ENDIF ()
++SET(
++    EXTRA_OUTPUT
++    "${CMAKE_CURRENT_BINARY_DIR}/debuild" # release_debuild
++    "${CMAKE_CURRENT_BINARY_DIR}/lightsd-${LIGHTSD_VERSION}.tar" # release_new_tag
++    "${VENV_DIRECTORY}"
++    "${VENV_STAMP}"
++)
++SET_DIRECTORY_PROPERTIES(
++    PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${EXTRA_OUTPUT}"
++)
 diff --git a/dist/dpkg/.hgtags b/dist/dpkg/.hgtags
 new file mode 100644
 --- /dev/null
--- a/white_colors_clarifications.patch	Mon May 23 01:29:51 2016 -0700
+++ b/white_colors_clarifications.patch	Sat May 28 18:42:04 2016 -0700
@@ -1,9 +1,11 @@
 # HG changeset patch
-# Parent  f4967b5e7623d6ac8706a2474f8a54d5cbe27354
-Improve the docs for set_light_from_hsbk and set_waveform
+# Parent  6b4f3d5c20f291c5fe0f908810931bd7a92ac228
+Improve the protocol docs a bit
 
 Go beyond just saying what the parameters are and clarify whites vs
-colors.
+colors in set_light_from_hsbk and set_waveform.
+
+Clarify the example client a bit and fix a typo.
 
 Closes GH-9.
 
@@ -43,7 +45,7 @@
  
     +---------------+-----------------------------------------------------------+
     | ``SAW``       | Should be 0.5.                                            |
-@@ -111,14 +121,15 @@
+@@ -111,18 +121,20 @@
     targeted bulb, the list is not in any specific order. Each dict has the
     following fields:
  
@@ -64,3 +66,30 @@
  
     .. note::
  
+-      Use :func:`tag` instead set_label to give a common name to multiple bulbs.
++      Use :func:`tag` instead of :func:`set_label` to give a common name to
++      multiple bulbs.
+ 
+ .. function:: tag(target, label)
+ 
+@@ -227,13 +239,16 @@
+    while True:
+        # Read a chunk of data, and accumulate it in the response buffer:
+        response += lightsd_socket.recv(READ_SIZE)
++       # Try to load the received the data, we ignore encoding and parsing
++       # errors since we only wanna know if the received data is complete:
+        try:
+-           # Try to load the received the data, we ignore encoding errors
+-           # since we only wanna know if the received data is complete.
+            json.loads(response.decode(ENCODING, "ignore"))
+-           break  # Decoding was successful, we have received everything.
++           # Decoding and JSON parsing were successful, we have received
++           # everything:
++           break 
+        except Exception:
+-           continue  # Decoding failed, data must be missing.
++           # Decoding or parsing failed, data must be missing, try again:
++           continue
+ 
+    response = response.decode(ENCODING, "surrogateescape")
+    print(json.loads(response))