00001 #! /usr/bin/env python -m 00002 # -*- coding: utf-8 -*- 00003 # _____ 00004 # / _ \ 00005 # / _/ \ \ 00006 # / / \_/ \ 00007 # / \_/ _ \ ___ _ ___ ___ ____ ____ ___ _____ _ _ 00008 # \ / \_/ \ / / _\| | | __| / _ \ | ┌┐ \ | ┌┐ \ / _ \ |_ _|| | | | 00009 # \ \_/ \_/ / | | | | | └─┐| |_| || └┘ / | └┘_/| |_| | | | | └─┘ | 00010 # \ \_/ / | |_ | |_ | ┌─┘| _ || |\ \ | | | _ | | | | ┌─┐ | 00011 # \_____/ \___/|___||___||_| |_||_| \_\|_| |_| |_| |_| |_| |_| 00012 # ROBOTICS™ 00013 # 00014 # File: horizon/__main__.py 00015 # Desc: Horizon Python Module Script 00016 # Auth: Malcolm Robert 00017 # 00018 # Copyright © 2010 Clearpath Robotics, Inc. 00019 # All Rights Reserved 00020 # 00021 # Redistribution and use in source and binary forms, with or without 00022 # modification, are permitted provided that the following conditions are met: 00023 # * Redistributions of source code must retain the above copyright 00024 # notice, this list of conditions and the following disclaimer. 00025 # * Redistributions in binary form must reproduce the above copyright 00026 # notice, this list of conditions and the following disclaimer in the 00027 # documentation and/or other materials provided with the distribution. 00028 # * Neither the name of Clearpath Robotics, Inc. nor the 00029 # names of its contributors may be used to endorse or promote products 00030 # derived from this software without specific prior written permission. 00031 # 00032 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00033 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00034 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00035 # ARE DISCLAIMED. IN NO EVENT SHALL CLEARPATH ROBOTICS, INC. BE LIABLE FOR ANY 00036 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00037 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00038 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00039 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00040 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00041 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00042 # 00043 # Please send comments, questions, or patches to code@clearpathrobotics.com 00044 # 00045 00046 00047 00048 00049 ################################################################################ 00050 # Module 00051 00052 00053 00054 ## @package clearpath.horizon.__main__ 00055 # Horizon Python Module Script 00056 # 00057 # Python Script for the Horizon Python Module. 00058 # 00059 # @author Malcolm Robert 00060 # @date 07/04/10 00061 # @version 1.0 00062 # 00063 # @section USE 00064 # 00065 # This module, the main script for the clearpath.horizon package, provides 00066 # absolutely no functionality; it just outputs what scripts within the 00067 # clearpath.horizon package can be run. 00068 # 00069 # This script is executed by running 00070 # 'python -m clearpath.horizon' for Python 2.7+ and Python 3.1+ or 00071 # 'python -m clearpath.horizon.__main__' for Python 2.6- and Python 3.0. 00072 # 00073 # @section HISTORY 00074 # 00075 # Version 1.0 00076 # - Initial Creation 00077 # - Python 2.5+ & 3.x compatible 00078 # 00079 # @section License 00080 # @copydoc public_license 00081 # 00082 """Python Script for the Horizon Python Module. 00083 00084 Copyright © 2010 Clearpath Robotics, Inc. 00085 All rights reserved 00086 00087 Created: 07/04/10 00088 Author: Malcolm Robert 00089 Version: 1.0 00090 """ 00091 00092 00093 # A note on comments: 00094 # To take advantage of the superior Doxygen documentation generator, 00095 # Doxygen comments (first line ##, following lines #) are used. 00096 # It is still important to provide Python __doc__ strings for use with help() 00097 # and pydoc, however, they (except for module) are also grabbed by Doxygen. 00098 # To fix this, the custom Doxygen tag @pydoc has been added to separate 00099 # __doc__ strings from being included in the last Doxygen tag. 00100 # @pydoc must be the last Doxygen tag before """doc string""" 00101 # Additionally, the custom Doxygen tag @req has been added to specify 00102 # required modules that do not come with the standard Python distribution. 00103 # Both custom tags are aliases to @par. 00104 00105 00106 # Required Python Modules 00107 import sys # Python Interpreter Functionality 00108 00109 00110 # Module Support 00111 ## Module Version 00112 __version__ = "1.0" 00113 """Module Version""" 00114 ## SVN Code Revision 00115 __revision__ = "$Revision: 235 $" 00116 """ SVN Code Revision""" 00117 00118 00119 00120 00121 ################################################################################ 00122 # Script Listing 00123 00124 00125 00126 ## List Available Scripts 00127 # 00128 # Main Program for Clearpath Robotics, Inc. Horizon package 00129 # - Prints the list of scripts to stdout 00130 # 00131 # @pydoc 00132 def __main(): 00133 """List Available Scripts.""" 00134 00135 # Print the tree list 00136 print ("The package clearpath.horizon is a module and NOT a script.\n" 00137 "For a command-line interface demo of Horizon, run:"\ 00138 "\n python -m clearpath.horizon.demo\n"\ 00139 "For Horizon message forwarding, run:\n"\ 00140 " python -m clearpath.horizon.forward") 00141 00142 # Exit the program 00143 sys.exit(0); 00144 00145 00146 00147 00148 ################################################################################ 00149 # Script 00150 00151 00152 00153 # Check if run as a script 00154 if __name__ == "__main__": 00155 00156 # Run the main method 00157 __main() 00158 00159 # Exit Bad - Should not reach so if it does: error 00160 sys.exit(1)