From: <pat...@us...> - 2010-03-06 16:31:58
|
Revision: 642 http://xml-cppdom.svn.sourceforge.net/xml-cppdom/?rev=642&view=rev Author: patrickh Date: 2010-03-06 16:31:51 +0000 (Sat, 06 Mar 2010) Log Message: ----------- Import Revision 406 of SConsAddons. Revision Links: -------------- http://xml-cppdom.svn.sourceforge.net/xml-cppdom/?rev=406&view=rev Added Paths: ----------- vendor/ vendor/scons-addons/ vendor/scons-addons/current/ vendor/scons-addons/current/AUTHORS vendor/scons-addons/current/COPYING vendor/scons-addons/current/ChangeLog vendor/scons-addons/current/README vendor/scons-addons/current/TODO vendor/scons-addons/current/src/ vendor/scons-addons/current/src/SConsAddons/ vendor/scons-addons/current/src/SConsAddons/AutoDist.py vendor/scons-addons/current/src/SConsAddons/Builders.py vendor/scons-addons/current/src/SConsAddons/EnvironmentBuilder.py vendor/scons-addons/current/src/SConsAddons/Options/ vendor/scons-addons/current/src/SConsAddons/Options/Boost.py vendor/scons-addons/current/src/SConsAddons/Options/Cal3D.py vendor/scons-addons/current/src/SConsAddons/Options/CppDom.py vendor/scons-addons/current/src/SConsAddons/Options/CppUnit.py vendor/scons-addons/current/src/SConsAddons/Options/FlagPollBasedOption.py vendor/scons-addons/current/src/SConsAddons/Options/GMTL.py vendor/scons-addons/current/src/SConsAddons/Options/OSG.py vendor/scons-addons/current/src/SConsAddons/Options/OpenSG.py vendor/scons-addons/current/src/SConsAddons/Options/OpenSG2.py vendor/scons-addons/current/src/SConsAddons/Options/Options.py vendor/scons-addons/current/src/SConsAddons/Options/OptionsTest.py vendor/scons-addons/current/src/SConsAddons/Options/Plexus.py vendor/scons-addons/current/src/SConsAddons/Options/PyJuggler.py vendor/scons-addons/current/src/SConsAddons/Options/Pyste.py vendor/scons-addons/current/src/SConsAddons/Options/SDL.py vendor/scons-addons/current/src/SConsAddons/Options/VRJuggler/ vendor/scons-addons/current/src/SConsAddons/Options/VRJuggler/JugglerCommon.py vendor/scons-addons/current/src/SConsAddons/Options/VRJuggler/VRJ.py vendor/scons-addons/current/src/SConsAddons/Options/VRJuggler/Vapor.py vendor/scons-addons/current/src/SConsAddons/Options/VRJuggler/__init__.py vendor/scons-addons/current/src/SConsAddons/Options/VTK.py vendor/scons-addons/current/src/SConsAddons/Options/WxWidgets.py vendor/scons-addons/current/src/SConsAddons/Options/Xerces.py vendor/scons-addons/current/src/SConsAddons/Options/Zipios.py vendor/scons-addons/current/src/SConsAddons/Options/__init__.py vendor/scons-addons/current/src/SConsAddons/Util.py vendor/scons-addons/current/src/SConsAddons/Variants.py vendor/scons-addons/current/src/SConsAddons/__init__.py vendor/scons-addons/current/templates/ vendor/scons-addons/current/templates/__init__.py vendor/scons-addons/current/templates/code.py Added: vendor/scons-addons/current/AUTHORS =================================================================== --- vendor/scons-addons/current/AUTHORS (rev 0) +++ vendor/scons-addons/current/AUTHORS 2010-03-06 16:31:51 UTC (rev 642) @@ -0,0 +1,4 @@ +Allen Bierbaum <al...@vr...> +Josh Brown <br...@ia...> +Ben Scott <bs...@vr...> + Added: vendor/scons-addons/current/COPYING =================================================================== --- vendor/scons-addons/current/COPYING (rev 0) +++ vendor/scons-addons/current/COPYING 2010-03-06 16:31:51 UTC (rev 642) @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. Added: vendor/scons-addons/current/ChangeLog =================================================================== --- vendor/scons-addons/current/ChangeLog (rev 0) +++ vendor/scons-addons/current/ChangeLog 2010-03-06 16:31:51 UTC (rev 642) @@ -0,0 +1,78 @@ +DATE AUTHOR CHANGE +---------- ------------ ------------------------------------------------------- +2006-07-05 allenb Significant refactoring of Options code. + Options object interface is not simplified and more + flexible for adding options to environments. + Add ListOption, SeparatorOption. + NEW VERSION: 0.1.0 +2006-07-02 allenb Added BooleanOption. +2005-08-18 allenb Pyste Option: Added cache environment flag and param. +2005-08-18 allenb OpenSG Options: + - Minimize calls to osg-config + - Capture defines + - Add flag for putting options in cpppath +2005-07-30 allenb Make OpenSG option smarter about handling opts + and libs. Delay calling osg-config until necessary. +2005-05-13 allenb Added a couple of globs to utils to test out. +2005-04-14 allenb Moved over to subversion. +2004-11-17 allenb Added utility method to get a relative path + from a known path and base directory. +2004-11-10 allenb Refactored AutoDist to make better use of FileBundles. + Now packages can have multiple file bundles and + files bundles can have their own install prefix. + Fix relative path handling with FileBundles. +2004-09-24 allenb Updated Boost python to get more info from python + about current version, libs, etc. This allows building + with 2.2 or 2.3 (or future versions hopefully). +2004-05-31 allenb Added option to updateEnv for boost and vapor options + to explicitly tell it to update CPPPATH with include + paths. +2004-04-16 allenb Removed auto-creation of install alias in AutoDist. + This was causing problems when multiple packages + install to the same prefix. +2004-04-14 allenb Added RPM packager. +2004-04-14 allenb Added support for packagers. +2004-04-13 allenb Refactor AutoDist to make it handle files and prefixes + better. +2004-03-25 allenb Require param to boost option stating wether to use + debug and multi-threaded libraries. This should help + avoid problems that occur if you just let the defaults + get used. +2004-03-09 allenb Updated pyste builder to scons 0.95 +2004-03-06 allenb Updated the autodist factory methods for libs and + programs to use the package environment by default. +2004-03-06 allenb Add smarter search for boost include path. +2004-02-27 allenb Added OpenSG option set. +2004-02-25 allenb Updated Options code so options with multiple keys + could have help text per option. + Fixed boost option to work with the new boost build. +2003-12-30 allenb Fixed problem with boost/filesystem/operations.hpp in + Boost options class. +2003-12-22 allenb Added FileBundle object for installing sets of files + within a package. + NEW VERSION: 0.0.10 +2003-11-20 allenb Added new util methods for getting paths in SConscripts + NEW VERSION: 0.0.9 +2003-11-19 allenb Fixed bug in pyste option when script does not exist. +2003-11-10 allenb Added builder for package config scripts. +2003-11-10 allenb Removed global Prefix() method replacing it with + storing the prefix in the autodist package instead. +2003-10-?? allenb Added support for Pyste +2003-09-09 allenb Added install prefixes to all AutoDist packages. + NEW VERSION 0.0.8 +2003-09-09 allenb Added isBuilt interface. + Fixed bug that prevented libraries from building in + build directories + NEW VERSION 0.0.7 + allenb major refactoring of system + NEW VERSION 0.0.6 + NEW VERSION 0.0.5 + NEW VERSION 0.0.4 + NEW VERSION 0.0.3 + NEW VERSION 0.0.2 +2003-08-22 allenb Initial version + NEW VERSION 0.0.1 +2003-08-22 allenb Added initial implementation of Options addon. + NEW VERSION 0.1.0 + + Added: vendor/scons-addons/current/README =================================================================== --- vendor/scons-addons/current/README (rev 0) +++ vendor/scons-addons/current/README 2010-03-06 16:31:51 UTC (rev 642) @@ -0,0 +1,81 @@ +o------------------------------------------------------------------------------o +|Scons-addons +| +o------------------------------------------------------------------------------o + +o------------------------------------------------------------------------------o +| What is it? +o------------------------------------------------------------------------------o + +This project is a collection of addons for the scons build system. + +See: http://www.scons.org + +o------------------------------------------------------------------------------o +| Why does this project exist? Why not just put this all in SCons? +o------------------------------------------------------------------------------o +There are two answers for this question: + +First, this allows for a place to test new addon capabilities that *may* end up +in scons in the long term for all I know. + +Second, SCons doesn't have to be a kitchen sink of everything under the sun. +Many things can be written as addons to SCons that are distributed and used +separately. That is where this project comes in. + +o------------------------------------------------------------------------------o +| Requirements +o------------------------------------------------------------------------------o + +We generally require the latest released version of scons. Some addons may require the CVS version though. + +o------------------------------------------------------------------------------o +| Installation +o------------------------------------------------------------------------------o + +To install system-wide: +cd scons-addons/src +cp -r SconsAddons /path/to/python/lib/site-packages/ + +If you do not want scons-addons installed in a standard location for python files you +will need to set your PYTHONPATH variable to reflect where it is installed at. +For example: + +(bash) +export PYTHONPATH=/home/username/scons-addons/src + +(csh based shells) +setenv PYTHONPATH /home/username/scons-addons/src + +o------------------------------------------------------------------------------o +| Documentation +o------------------------------------------------------------------------------o + +o------------------------------------------------------------------------------o +| License: GPL +o------------------------------------------------------------------------------o + +This file is part of scons-addons. + +Scons-addons is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +Scons-addons is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with scons-addons; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +o------------------------------------------------------------------------------o +| Questions +o------------------------------------------------------------------------------o + + Please feel free to email comments, questions, suggestions, etc to + + sco...@re... Property changes on: vendor/scons-addons/current/README ___________________________________________________________________ Added: svn:eol-style + native Added: vendor/scons-addons/current/TODO =================================================================== --- vendor/scons-addons/current/TODO (rev 0) +++ vendor/scons-addons/current/TODO 2010-03-06 16:31:51 UTC (rev 642) @@ -0,0 +1,7 @@ +- Option handling must be improved + +There is a problem with the way options and build environments interact in scons-addons. For example consider how an option should validate and set itself if we are using debug runtimes and compile flags vs. using optimized run-times. + +We do not have a good way to take this into account to know what the correct way to use this is. + +Release. Added: vendor/scons-addons/current/src/SConsAddons/AutoDist.py =================================================================== --- vendor/scons-addons/current/src/SConsAddons/AutoDist.py (rev 0) +++ vendor/scons-addons/current/src/SConsAddons/AutoDist.py 2010-03-06 16:31:51 UTC (rev 642) @@ -0,0 +1,1160 @@ +""" +AutoDist + +Automatic distribution builder and packager for SCons. + +""" +############################################################## autodist-cpr beg +# +# AutoDist - Automatic distribution builder and packager for +# SCons-based builds +# AutoDist is (C) Copyright 2002 by Ben Scott +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the +# Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# +# ----------------------------------------------------------------- +# File: $RCSfile$ +# Date modified: $Date: 2009-03-12 16:51:31 -0500 (Thu, 12 Mar 2009) $ +# Version: $Revision: 401 $ +# ----------------------------------------------------------------- +############################################################## autodist-cpr end + +__version__ = '0.2.1' +__author__ = 'Ben Scott and Allen Bierbaum' + + +import os +from os import path +import stat +import re + +import SCons.Defaults +import SCons.Environment +import SCons.Node.FS +import SCons.Util +import types +import re +import time +import glob +import shutil +import SConsAddons.Util as sca_util + +pj = os.path.join + + +# SCons shorthand mappings +Action = SCons.Action.Action +Builder = SCons.Builder.Builder +Environment = SCons.Environment.Environment +File = SCons.Node.FS.default_fs.File +Value = SCons.Node.Python.Value + +config_script_contents = "" + +class InstallableFile: + """ Class to wrap any installable file. ex. progs, libs, headers, docs, etc """ + def __init__(self, fileNode, prefix=""): + """ fileNode - The scons node for the file. + prefix - The prefix to use for the file (munus the package/bundle prefix) + """ + assert isinstance(fileNode, SCons.Node.Node), "Installable file called with non file node: [%s]"%str(fileNode) + self.fileNode = fileNode + self.prefix = prefix + + def __str__(self): + """ an installable file's string representation is its prefix/name.""" + if prefix: + return path.join(prefix, str(fileNode)) + else: + return str(fileNode) + + def getFileNode(self): + return self.fileNode + + def getPrefix(self): + return self.prefix + + +class Header(InstallableFile): + """ This class is meant to wrap a header file to install. """ + def __init__(self, fileNode, prefix=""): + InstallableFile.__init__(self, fileNode, prefix) + + +class FileBundle: + """ Wrapper class for a group of files to bundle together to install, archive, etc. + + This class provides a method to hold a group of files together with their destination + structure information. Then it can be used to call install builders to setup an + install where needed. + + One area of note is prefix handling. To allow maximum flexibility there are + several prefixes used. + + When built, a prefix is passed as a base prefix (build_prefix) + The file bundle has a prefix (bundle_prefix). + Each bundled file has a prefix (file.prefix added when files is added). + If path to the added file has a prefix it is added on as well. + + Final file location: build.prefix/bundle.prefix/passed_prefix/file.prefix/file.name + """ + + def __init__(self, bundlePrefix=""): + """ + Construct file bundle object. + """ + self.files = [] # Installable files of class InstallableFile + self.bundlePrefix = bundlePrefix + self.built = False + + def addFiles(self, files, prefix = "", useRelPath=True): + """ + Add these files to the list of installable files. + The list can either be string file names or File() nodes. + files - List of files to add to bundle. + prefix - A common prefix to use for all installed files (beyond the bundle prefix) + useRelPath - If true, append the relative path in the file to + the prefix to get the real full install path. + """ + if not SCons.Util.is_List(files): + files = [files] + + for f in files: # For all files + local_dir_prefix = "" + # If we are a string filename create file object + if not isinstance(f, SCons.Node.FS.Base): + f = File(f) + if useRelPath: + local_dir_prefix = str(f.dir) + install_file = InstallableFile(f, pj(prefix, local_dir_prefix)) + self.files.append(install_file) # Append it on + + def getFiles(self): + return self.files + + def buildInstall(self, env=None, installPrefix="", ignoreBuilt=False): + """ + Calls install builder to setup the installation of the packaged files. + Installs all files using the env environment under prefix. + NOTE: file is installed into: installPrefix/bundle.prefix/passed_prefix/file.prefix/file.name + + NOTE: Whatever the current directly is when this is called is the directory + used for the builder command associated with this assembly. + + Returns list of the Install() targets. + ifgnoreBuilt - If true, just rebuild for the given environment and don't test/set the built flag. + """ + if not ignoreBuilt: + assert not self.built + self.built = True + + # Clone the base environment if we have one + if env: + env = env.Clone() + else: + env = Environment() + + ret_targets = [] + + # Install the files from the bundle + common_prefix = pj(installPrefix, self.bundlePrefix) + name = common_prefix + if hasattr(self,"name"): + name = self.name + #print "FileBundle-[%s]: buildInstall: "%name + + for f in self.files: + fnode = f.getFileNode() + target_dir = path.join(installPrefix, self.bundlePrefix, f.getPrefix()) + #print " file:[%s] --> target dir: [%s]"%(str(fnode),target_dir) + inst_tgt = env.Install(target_dir, fnode) + ret_targets.append(inst_tgt) + + return ret_targets + + +# ############################################################################ # +# ASSEMBLIES +# ############################################################################ # +class _Assembly: + """ Base class for all assembly types that can be managed by a package. + This is an abstract type that provides common functionality and interface for all assemblies. + """ + def __init__(self, pkg, baseEnv, prefix=""): + """ + Constructs a new Assembly object with the given name within the given + environment. + """ + self.package = pkg # The package object we belong to + self.built = False; # Flag set once we have been built + self.installPrefix = prefix; # Default install prefix + + # Clone the base environment if we have one + if baseEnv: + self.env = baseEnv.Clone() + else: + self.env = Environment() + + def setInstallPrefix(self, prefix): + self.installPrefix = prefix + + def getInstallPrefix(self): + return self.installPrefix + + def isBuilt(self): + return self.built + + def getEnv(self): + return self.env + + def build(self): + """ + Sets up the build targets for this assembly. + May only be called once. + NOTE: Whatever the current directly is when this is called is the directory + used for the builder command associated with this assembly. + """ + + # Now actually do the build + self._buildImpl() + self.built = True; + + + +class FileBundleAssembly(_Assembly): + """ Wrapper class for a group of files to manage in an assembly for packaging. + + One area of note is prefix handling. To allow maximum flexibility there + are several used prefixes. + + The file bundle has a prefix (this is relative to the package prefix). + Each bundled file has a prefix (added when files is added). + If path to the added file has a prefix it is added on as well. + + Final file location: package.prefix/filebundle.prefix/added.prefix/file.prefix/file_name + """ + + def __init__(self, pkg, baseEnv, prefix=""): + """ + Construct file bundle object. + prefix - Prefix to install the files (relative to package) + pkg - The package this bundle is a part of + baseEnv - The environment that this bundle should be included in + """ + print "WARNING: Usage of FileBundleAssembly is deprecated." + _Assembly.__init__(self, pkg, baseEnv, prefix) + + self.files = [] # Installable files of class InstallableFile + self.built = False # Flag set once we have been built + + def addFiles(self, files, prefix = None): + """ + Add these files to the list of installable files. They will be installed as: + package.prefix/self.prefix/prefix/file_prefix. The list must come + in as strings as they are processed through File(). + files - List of filenames (file nodes should also work) + """ + if not SCons.Util.is_List(files): + files = [files] + + for fn in files: # For all filenames + local_dir_prefix = "" + if not isinstance(fn, SCons.Node.FS.Base): # If we are a string filename, then get our local prefix + local_dir_prefix = os.path.dirname(fn) + f = InstallableFile( File(fn), pj(prefix, local_dir_prefix)) # Create new installable file + self.files.append(f) # Append it on + + def getInstallableFiles(self): + return self.files + + def isBuilt(self): + return self.built; + + def build(self): + """ + Sets up the build and install targets for this file bundle. + May only be called once. + NOTE: Whatever the current directly is when this is called is the directory + used for the builder command associated with this assembly. + """ + # Add files to the package file bundle + fb = self.package.createFileBundle() + + for f in self.files: + fnode = f.getFileNode() + fb.addFiles(fnode, f.getPrefix()) + + self.built = True; + + + +class _CodeAssembly(_Assembly): + """ + Base type for assemblys that are based on "code". + + This "abstract" class provides common functionality for Program, + StaticLibrary, and SharedLibrary. You don't want to instantiate this class + directly. It is meant to be private. + """ + + def __init__(self, filename, pkg, baseEnv, prefix=""): + """ + Constructs a new Assembly object with the given name within the given + environment. + """ + _Assembly.__init__(self, pkg, baseEnv, prefix) + + assert isinstance(filename, str), "Passed a filename that is not a string. %s"%filename + self.fileNode = File(filename) + self.sources = [] + self.includes = [] + self.libs = [] + self.libpaths = [] + self.headers = [] + self.targets = [] + + def getTargets(self): + return self.targets + + def addSources(self, sources): + """ + Adds the given list of source files into this assembly. The list must come + in as strings as they are processed through File(). + """ + # Use File() to figure out the absolute path to the file + srcs = map(File, sources) + # Add these sources into the mix + self.sources.extend(srcs) + + def addHeaders(self, headers, prefix = None): + """ + Adds the given list of distribution header files into this assembly. These + headers will be installed to self.package.prefix/include/prefix/file_prefix. The list must come + in as strings as they are processed through File(). + """ + for fn in headers: # For all filenames in headers + hdr = Header( File(fn), prefix) # Create new header rep + self.headers.append(hdr) # Append it on + + def addIncludes(self, includes): + """ + Adds in the given list of include directories that this assembly will use + while compiling. + """ + self.includes.extend(includes) + + def addLibs(self, libs): + """ + Adds in the given list of libraries directories that this assembly will + link with. + """ + self.libs.extend(libs) + + def addLibPaths(self, libpaths): + """ + Adds in the given list of library directories that this assembly will use + to find libraries while linking. + """ + self.libpaths.extend(libpaths) + + def getHeaders(self): + return self.headers + + def getSources(self): + return self.sources + + def isBuilt(self): + return self.built; + + def getFilename(self): + return str(self.fileNode) + + def getAbsFilePath(self): + return self.fileNode.get_abspath() + + def build(self): + """ + Sets up the build and install targets for this assembly. + May only be called once. + NOTE: Whatever the current directly is when this is called is the directory + used for the builder command associated with this assembly. + """ + # Setup the environment for the build + self.env.Append(CPPPATH = self.includes, + LIBPATH = self.libpaths, + LIBS = self.libs) + + # Now actually do the build + self._buildImpl() + self.built = True; + + +class Library(_CodeAssembly): + """ + This "abstract" class provides common functionality for StaticLibrary and + SharedLibrary. You don't want to instantiate this class directly. It is + meant to be private. + """ + + def __init__(self, libname, pkg, baseEnv, builderNames, installPrefix): + """ + Creates a new library builder for a library of the given name. + pkg - The package we are a part of + baseEnv - The base environemnt to use + builderNames - The names of the builders to use for building the libary: ex. 'SharedLibrary' + installPrefix - Prefix (relative to the standard install path) to install this library + """ + _CodeAssembly.__init__(self, libname, pkg, baseEnv, installPrefix) + + if type(builderNames) is types.StringType: + self.builder_names = [ builderNames ] + else: + self.builder_names = builderNames + + def _buildImpl(self): + """ + Sets up the build dependencies and the install. + """ + + fb = self.package.createFileBundle() + + # Setup build and install for each built library + # Use get_abspath() with fileNode so we get the path into the build_dir and not src dir + # Only build libraries if we have sources + if len(self.sources) > 0: + for lib_builder in self.builder_names: + lib_filepath = self.fileNode.get_abspath() + lib = self.env.__dict__[lib_builder](lib_filepath, self.sources) + self.targets = lib + + # Lib to file bundle + fb.addFiles(lib, self.installPrefix, False) + + # Install the headers in the source list + for h in self.headers: + headerNode = h.getFileNode() + fb.addFiles(headerNode, pj('include', h.getPrefix()) ) + + +class LoadableModule(Library): + """ Sets up Library assembly with 'LoadableModule' builder.""" + def __init__(self, libname, pkg, baseEnv = None, installPrefix='lib'): + Library.__init__(self, libname, pkg, baseEnv, 'LoadableModule', installPrefix) + +class SharedLibrary(Library): + """ Sets up Library assembly with 'SharedLibrary' builder.""" + def __init__(self, libname, pkg, baseEnv = None, installPrefix='lib'): + Library.__init__(self, libname, pkg, baseEnv, 'SharedLibrary', installPrefix) + +class StaticLibrary(Library): + """ Sets up Library assembly with 'StaticLibrary' builder """ + def __init__(self, libname, pkg, baseEnv = None, installPrefix='lib'): + Library.__init__(self, libname, pkg, baseEnv, 'StaticLibrary', installPrefix) + +class StaticAndSharedLibrary(Library): + """ Sets up Library assembly with both 'StaticLibrary' and 'SharedLibrary' builders. """ + def __init__(self, libname, pkg, baseEnv = None, installPrefix='lib'): + Library.__init__(self, libname, pkg, baseEnv, ['StaticLibrary', 'SharedLibrary'], installPrefix) + + +class Program(_CodeAssembly): + """ + This object knows how to build (and install) an executable program from a + given set of sources. + """ + def __init__(self, progname, pkg, baseEnv = None, installPrefix='bin', + isAppBundle=False, resources=[], infoPlist='', pkgInfo=''): + """ + Creates a new program builder for a program of the given name. + """ + _CodeAssembly.__init__(self, progname, pkg, baseEnv, installPrefix) + #Variables for Darwin only build + if not SCons.Util.is_List(resources): + self.resources = [resources] + else: + self.resources = resources + + self.infoPlist = infoPlist + self.isAppBundle = isAppBundle + self.pkgInfo = pkgInfo + + def _buildImpl(self): + """ + Sets up the build dependencies and the install. + """ + # Build rule + prog = self.env.Program(self.fileNode, source = self.sources) + + self.targets = prog + + # Add executable to file bundle + fb = self.package.createFileBundle() + + if sca_util.GetPlatform() == 'darwin' and self.isAppBundle: + # create prefix beyond <prefix>/bin + appBundlePre = pj(self.installPrefix, self.fileNode.rstr() + '.app', 'Contents') + # install Info.plist + fb.addFiles(self.infoPlist, appBundlePre, False) + # install PkgInfo + fb.addFiles(self.pkgInfo, appBundlePre, False) + # install actual exectuable file + fb.addFiles(prog, pj(appBundlePre,'MacOS') , False) + # install resource files + for res in self.resources: + fb.addFiles(res, pj(appBundlePre,'Resources'), False) + else: + fb.addFiles(prog, self.installPrefix, False) + + # Install the binary + #inst_prefix = self.package.prefix + #if self.installPrefix: + # inst_prefix = pj(inst_prefix, self.installPrefix) + #self.env.Install(inst_prefix, prog) + + +class Package: + """ + A package defines a collection of distributables including programs and + libraries. The Package class provides the ability to build, install, and + package up distributions of your project. + + A package object provides an interface to add libraries, programs, headers, + and support files to a single unit that can be installed. It also shares + an environment across all these different units to build. + + The package contains assemblies (objects that encapsulate things to build) + and a FileBundle (which holds all the files that could be installed or handled). + + When assemblies are built, they should add any installable files to the package file bundle. + """ + + def __init__(self, name, version, prefix='/usr/local', baseEnv = None, description= None): + """ + Creates a new package with the given name and version, where version is in + the form of <major>.<minor>.<patch> (e.g 1.12.0) + """ + self.name = name + self.prefix = prefix + self.assemblies = [] + self.fileBundles = [FileBundle(),] # File bundle for all files + self.extra_dist = [] + self.description = description + self.packagers = [] + self.distDir = "dist" # Path to the dist directory to use + + if not self.description: + self.description = self.name + " Package" + + if baseEnv: + self.env = baseEnv.Clone() + else: + self.env = Environment() + + if type(version) is types.TupleType: + (self.version_major, self.version_minor, self.version_patch) = version; + else: + re_matches = re.match(r'^(\d+)\.(\d+)\.(\d+)$', version) + self.version_major = int(re_matches.group(1)) + self.version_minor = int(re_matches.group(2)) + self.version_patch = int(re_matches.group(3)) + + def getName(self): + return self.name + + def getVersionMajor(self): + return self.version_major + + def getVersionMinor(self): + return self.version_minor + + def getVersionPatch(self): + return self.version_patch + + def getFullVersion(self): + return ".".join( (str(self.version_major), str(self.version_minor), str(self.version_patch)) ) + + def getAssemblies(self): + return self.assemblies + + def getExtraDist(self): + return self.extra_dist + + def getFileBundles(self): + return self.fileBundles + + def getEnv(self): + " Get the common pakcage environment. " + return self.env + + def setDistDir(self, path): + " Set the prefix for distribution/packaged files. " + self.distDir = path + + def getDistDir(self): + return self.distDir + + def addPackager(self, packager): + " Add a new packager. Sets the packager to point to this package. " + packager.setPackage(self) + self.packagers.append(packager) + + # ###### Assembly factory methods ####### # + def createLoadableModule(self, name, baseEnv = None, installPrefix='lib'): + """ + Creates a new shared library of the given name as a part of this package. + The library will be built within the given environment. + """ + if not baseEnv: + baseEnv = self.env + lib = LoadableModule(name, self, baseEnv, installPrefix) + self.assemblies.append(lib) + return lib + + def createSharedLibrary(self, name, baseEnv = None, installPrefix='lib'): + """ + Creates a new shared library of the given name as a part of this package. + The library will be built within the given environment. + """ + if not baseEnv: + baseEnv = self.env + lib = SharedLibrary(name, self, baseEnv, installPrefix) + self.assemblies.append(lib) + return lib + + def createStaticLibrary(self, name, baseEnv = None, installPrefix='lib'): + """ + Creates a new static library of the given name as a part of this package. + The library will be built within the given environment. + """ + if not baseEnv: + baseEnv = self.env + lib = StaticLibrary(name, self, baseEnv, installPrefix) + self.assemblies.append(lib) + return lib + + def createStaticAndSharedLibrary(self, name, baseEnv = None, installPrefix='lib'): + """ + Creates new static and shared library of the given name as a part of this package. + The library will be built within the given environment. + """ + if not baseEnv: + baseEnv = self.env + lib = StaticAndSharedLibrary(name, self, baseEnv, installPrefix) + self.assemblies.append(lib) + return lib + + def createProgram(self, name, baseEnv = None, installPrefix='bin', + isAppBundle=False, resources=[], infoPlist='', pkgInfo=''): + """ + Creates a new executable program of the given name as a part of this + package. The program will be built within the given environment. + """ + if not baseEnv: + baseEnv = self.env + prog = Program(name, self, baseEnv, installPrefix, isAppBundle, + resources, infoPlist, pkgInfo) + self.assemblies.append(prog) + return prog + + def createFileBundleAssembly(self, prefix, baseEnv = None): + """ Creates a new FileBundle object as part of this package. """ + bundle = FileBundleAssembly(pkg = self, baseEnv = baseEnv, prefix=prefix) + self.assemblies.append(bundle) + return bundle + + def createFileBundle(self, bundlePrefix=""): + """ Creates a new file bundle to use with this package. """ + fb = FileBundle(bundlePrefix) + self.fileBundles.append(fb) + return fb + + def createConfigAction(self, target, source, env): + """ Called as action of config script builder """ + global config_script_contents + + new_contents = config_script_contents + value_dict = source[0].value # Get dictionary from the value node + + all_lib_names = [os.path.basename(l.getAbsFilePath()) for l in self.assemblies if isinstance(l,Library)] + lib_names = [] + for l in all_lib_names: + if not lib_names.count(l): + lib_names.append(l) + inc_paths = [pj(self.prefix,'include'),] + cflags = " ".join(["-I"+p for p in inc_paths]) + if value_dict["extraCflags"] != None: + cflags = cflags + " " + value_dict["extraCflags"] + lib_paths = [pj(self.prefix,'lib'),] + if value_dict["extraIncPaths"] != None: + cflags = cflags + " ".join([" -I"+l for l in value_dict["extraIncPaths"]]) + + # Extend varDict with local settings + varDict = {} + if value_dict["varDict"] != None: + varDict = value_dict["varDict"] + + varDict["Libs"] = " ".join(["-L"+l for l in lib_paths]) + if value_dict["extraLibPath"] != None: + varDict["Libs"] += " " + " ".join(["-L"+l for l in value_dict["extraLibPath"]]) + if len(lib_names): + varDict["Libs"] += " " + " ".join(["-l"+l for l in lib_names]) + if value_dict["extraLibs"]!=None: + varDict["Libs"] = varDict["Libs"] + " " + " ".join(["-l"+l for l in value_dict["extraLibs"]]) + varDict["Cflags"] = cflags + varDict["Version"] = self.getFullVersion() + varDict["Name"] = self.name + varDict["Description"] = self.description + varDict["Prefix"] = self.prefix + + # Create the new content + txt = "# config script generated for %s at %s\n" % (self.name, time.asctime()) + txt = txt + '# values: %s\n'%(source[0].get_contents(),) + + for k,v in value_dict["varDict"].items(): + if SCons.Util.is_String(v): + txt = txt + 'vars["%s"] = "%s"\n' % (k,v) + else: + txt = txt + 'vars["%s"] = %s\n' % (k,v) + + # Find and replace the replacable content + cut_re = re.compile(r'(?<=# -- BEGIN CUT --\n).*?(?=# -- END CUT --)', re.DOTALL) + new_contents = cut_re.sub(txt,config_script_contents) + + # Create and write out the new file (setting it executable) + fname = str(target[0]) + f = open(str(target[0]), 'w') + f.write(new_contents) + f.close() + os.chmod(fname, stat.S_IREAD|stat.S_IEXEC|stat.S_IWUSR) # Set the file options + + return 0 # Successful build + + def createConfigScript(self, name, installDir='bin', varDict = None, + extraIncPaths=None, extraLibs=None, extraLibPaths=None, extraCflags=None): + """ Adds a config script to the given package installation. + varDict - Dictionary of extra variables to define. + """ + + if not self.env['BUILDERS'].has_key("PackageConfigScript"): + cfg_builder = Builder(action = Action(self.createConfigAction, + lambda t,s,e: "Create config script for %s package: %s"%(self.name, t[0])) ) + self.env.Append(BUILDERS = {"PackageConfigScript" : cfg_builder}) + + value_dict = {} + value_dict["prefix"] = self.prefix + value_dict["extraIncPaths"] = extraIncPaths + value_dict["extraLibs"] = extraLibs + value_dict["extraLibPath"] = extraLibPaths + value_dict["extraCflags"] = extraCflags + + value_dict["varDict"] = varDict + self.env.PackageConfigScript(target = pj(installDir, name), source = Value(value_dict)) + + # May need to delay doing this until a later build stage so that all libs, headers, etc are + # setup and ready to go in this package. + + + def addExtraDist(self, files,... [truncated message content] |