pax_global_header 0000666 0000000 0000000 00000000064 12343514423 0014513 g ustar 00root root 0000000 0000000 52 comment=191adddb3876ab389c0c856e1c03874bf70f8ee4
cxxtest-4.4/ 0000775 0000000 0000000 00000000000 12343514423 0013064 5 ustar 00root root 0000000 0000000 cxxtest-4.4/.gitignore 0000664 0000000 0000000 00000000130 12343514423 0015046 0 ustar 00root root 0000000 0000000 __pycache__
*.pyc
*.bak
.*
guide.epub
guide.pdf
guide.html
parsetab.py
TEST-cxxtest.xml
cxxtest-4.4/COPYING 0000664 0000000 0000000 00000016743 12343514423 0014132 0 ustar 00root root 0000000 0000000 GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser 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
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
cxxtest-4.4/README 0000664 0000000 0000000 00000001663 12343514423 0013752 0 ustar 00root root 0000000 0000000 Overview
--------
CxxTest is a unit testing framework for C++ that is similar in
spirit to JUnit, CppUnit, and xUnit. CxxTest is easy to use because
it does not require precompiling a CxxTest testing library, it
employs no advanced features of C++ (e.g. RTTI) and it supports a
very flexible form of test discovery.
CxxTest is available under the GNU Lesser General Public Licence (LGPL).
A user guide can be downloaded from http://cxxtest.com.
A Simple Example
----------------
1. Create a test suite header file:
MyTestSuite.h:
#include
class MyTestSuite : public CxxTest::TestSuite
{
public:
void testAddition( void )
{
TS_ASSERT( 1 + 1 > 1 );
TS_ASSERT_EQUALS( 1 + 1, 2 );
}
};
2. Generate the tests file:
# cxxtestgen --error-printer -o tests.cpp MyTestSuite.h
3. Compile and run!
# g++ -o main tests.cpp
# ./main
Running cxxtest tests (1 test).OK!
cxxtest-4.4/Versions 0000664 0000000 0000000 00000015265 12343514423 0014630 0 ustar 00root root 0000000 0000000
CxxTest Releases
----------------
* Version 4.4 (2014-06-03)
- Fixed compilation error on Windows (MSVC) in XmlFormatter.h (#86)
- Fix to ensure that tearDown() is called (#89)
- Add option run test with a user defined command in scons (#91)
- Use a Python path relative to the cxxtestgen script (#88)
- Add defensive guard in ErrorFormatter.h (#96)
- Fixed bug with "None" appearing in CXXTEST_CPPATH (#99)
- Added CXXTEST_LIBPATH to properly use shared libraries (#100)
- Added guards when XmlFormatter.h data is not initialize (#87)
* Version 4.3 (2013-07-05)
- Changes to assess code coverage of the cxxtestgen command
- Standardizing C++ file formats (using astyle)
- Bug fixes that led to the test runner hanging
- Adding special assertions for floating point values
- Added date to XML output
- Added support for comparison of C strings
* Version 4.2.1 (2013-03-22)
- Fixing documentation of LGPL version
* Version 4.2 (2013-03-16)
- Changes to support test fixtures in namespaces
- Adding logic to support test skipping
- Change to create self-contained HTML documentation
- Fixed inheritance issue in GlobalFixture (#69)
- Update LGPL version
- Changes to try/catch to avoid ambiguities withn catching std::exception (#53)
- Fixed TS_ASSERT_DELTA to work on integer types (#65)
- Changed output format to print world-name (#70)
* Version 4.1 (2012-11-30)
- Added absolute paths to resolve bug when relative path links are provided.
- Bug fix when files contain unicode characters
- Fix for --no-static-init: Changed how non-static tests are created
- Updated user guide to include SCons build system
- Closing out Tigris and SourceForge tickets
- Added valgrind tests.
* Version 4.0.3 (2012-01-07)
- Adding support for Python 2.4 - 3.2
- Various cleanup of CxxTest root directory
- Adding patch that allows the cxxtestgen script to be used when symlinked.
* Version 4.0.2 (2012-01-02)
- Bug fix to enable installation of cxxtestgen without the 'setuptools' package
* Version 4.0.1 (2012-01-01)
- Documentation updates
- Bug fix for installation of cxxtestgen script
* Version 4.0 (2011-12-28)
- Perl is no longer used to support CxxTest scripts. Python is now the only scripting language used by CxxTest.
- The testing scripts have been rewritten using the PyUnit framework.
- The installation process for CxxTest now leverages and integrates with the system Python installation.
- A more comprehensive C++ parser is now available, which supports testing of templates.
- The CxxTest GUI is no longer supported.
- The <> and <> macros have the same behavior now.
- CxxTest runners now have a command-line interface that facilitates interactive use of the test runner.
- A new user guide is now available in PDF, HTML and Ebook formats.
* Version 3.10.1 (2004-12-01)
- Improved support for VC7
- Fixed clash with some versions of STL
* Version 3.10.0 (2004-11-20)
- Added mock framework for global functions
- Added TS_ASSERT_THROWS_ASSERT and TS_ASSERT_THROWS_EQUALS
- Added CXXTEST_ENUM_TRAITS
- Improved support for STL classes (vector, map etc.)
- Added support for Digital Mars compiler
- Reduced root/part compilation time and binary size
- Support C++-style commenting of tests
* Version 3.9.1 (2004-01-19)
- Fixed small bug with runner exit code
- Embedded test suites are now deprecated
* Version 3.9.0 (2004-01-17)
- Added TS_TRACE
- Added --no-static-init
- CxxTest::setAbortTestOnFail() works even without --abort-on-fail
* Version 3.8.5 (2004-01-08)
- Added --no-eh
- Added CxxTest::setAbortTestOnFail() and CXXTEST_DEFAULT_ABORT
- Added CxxTest::setMaxDumpSize()
- Added StdioFilePrinter
* Version 3.8.4 (2003-12-31)
- Split distribution into cxxtest and cxxtest-selftest
- Added `sample/msvc/FixFiles.bat'
* Version 3.8.3 (2003-12-24)
- Added TS_ASSERT_PREDICATE
- Template files can now specify where to insert the preamble
- Added a sample Visual Studio workspace in `sample/msvc'
- Can compile in MSVC with warning level 4
- Changed output format slightly
* Version 3.8.1 (2003-12-21)
- Fixed small bug when using multiple --part files.
- Fixed X11 GUI crash when there's no X server.
- Added GlobalFixture::setUpWorld()/tearDownWorld()
- Added leaveOnly(), activateAllTests() and `sample/only.tpl'
- Should now run without warnings on Sun compiler.
* Version 3.8.0 (2003-12-13)
- Fixed bug where `Root.cpp' needed exception handling
- Added TS_ASSERT_RELATION
- TSM_ macros now also tell you what went wrong
- Renamed Win32Gui::free() to avoid clashes
- Now compatible with more versions of Borland compiler
- Improved the documentation
* Version 3.7.1 (2003-09-29)
- Added --version
- Compiles with even more exotic g++ warnings
- Win32 Gui compiles with UNICODE
- Should compile on some more platforms (Sun Forte, HP aCC)
* Version 3.7.0 (2003-09-20)
- Added TS_ASSERT_LESS_THAN_EQUALS
- Minor cleanups
* Version 3.6.1 (2003-09-15)
- Improved QT GUI
- Improved portability some more
* Version 3.6.0 (2003-09-04)
- Added --longlong
- Some portability improvements
* Version 3.5.1 (2003-09-03)
- Major internal rewrite of macros
- Added TS_ASSERT_SAME_DATA
- Added --include option
- Added --part and --root to enable splitting the test runner
- Added global fixtures
- Enhanced Win32 GUI with timers, -keep and -title
- Now compiles with strict warnings
* Version 3.1.1 (2003-08-27)
- Fixed small bug in TS_ASSERT_THROWS_*()
* Version 3.1.0 (2003-08-23)
- Default ValueTraits now dumps value as hex bytes
- Fixed double invocation bug (e.g. TS_FAIL(functionWithSideEffects()))
- TS_ASSERT_THROWS*() are now "abort on fail"-friendly
- Win32 GUI now supports Windows 98 and doesn't need comctl32.lib
* Version 3.0.1 (2003-08-07)
- Added simple GUI for X11, Win32 and Qt
- Added TS_WARN() macro
- Removed --exit-code
- Improved samples
- Improved support for older (pre-std::) compilers
- Made a PDF version of the User's Guide
* Version 2.8.4 (2003-07-21)
- Now supports g++-3.3
- Added --have-eh
- Fixed bug in numberToString()
* Version 2.8.3 (2003-06-30)
- Fixed bugs in cxxtestgen.pl
- Fixed warning for some compilers in ErrorPrinter/StdioPrinter
- Thanks Martin Jost for pointing out these problems!
* Version 2.8.2 (2003-06-10)
- Fixed bug when using CXXTEST_ABORT_TEST_ON_FAIL without standard library
- Added CXXTEST_USER_TRAITS
- Added --abort-on-fail
* Version 2.8.1 (2003-01-16)
- Fixed charToString() for negative chars
* Version 2.8.0 (2003-01-13)
- Added CXXTEST_ABORT_TEST_ON_FAIL for xUnit-like behaviour
- Added `sample/winddk'
- Improved ValueTraits
- Improved output formatter
- Started version history
* Version 2.7.0 (2002-09-29)
- Added embedded test suites
- Major internal improvements
cxxtest-4.4/admin/ 0000775 0000000 0000000 00000000000 12343514423 0014154 5 ustar 00root root 0000000 0000000 cxxtest-4.4/admin/announcement 0000664 0000000 0000000 00000002046 12343514423 0016573 0 ustar 00root root 0000000 0000000 We are pleased to announce the updated release of CxxTest 4.4. CxxTest is a unit testing framework for C++ that is similar in spirit to JUnit, CppUnit, and xUnit. CxxTest is easy to use because it does not require precompiling a CxxTest testing library, it employs no advanced features of C++ (e.g. RTTI) and it supports a very flexible form of test discovery.
This release includes a variety of bug fixes:
- Fixed compilation error on Windows (MSVC) in XmlFormatter.h (#86)
- Fix to ensure that tearDown() is called (#89)
- Add option run test with a user defined command in scons (#91)
- Use a Python path relative to the cxxtestgen script (#88)
- Add defensive guard in ErrorFormatter.h (#96)
- Fixed bug with "None" appearing in CXXTEST_CPPATH (#99)
- Added CXXTEST_LIBPATH to properly use shared libraries (#100)
- Added guards when XmlFormatter.h data is not initialize (#87)
See the CxxTest Home Page (http://cxxtest.com) for documentation and download instructions.
Enjoy!
CxxTest Developer Team
cxxtest-developers@googlegroups.com
cxxtest-4.4/admin/cloudbees_cxxtest 0000664 0000000 0000000 00000002172 12343514423 0017630 0 ustar 00root root 0000000 0000000 #!/bin/bash
export PATH=$WORKSPACE/vpython/bin:$PATH
g++ --version
# Setup virtual Python environment
\rm -Rf vpython
python cxxtest/admin/virtualenv.py vpython
#vpy/scripts/vpy_install
vpython/bin/easy_install nose
vpython/bin/easy_install unittest2
vpython/bin/easy_install ply
vpython/bin/easy_install ordereddict
vpython/bin/easy_install gcovr
vpython/bin/easy_install pyutilib.th
cd cxxtest/python
../../vpython/bin/python setup.py install
# Cleanup test directory
cd ../test
make clean
cd ../..
# Run tests
#export CXXTEST_GCOV_FLAGS='-fprofile-arcs -ftest-coverage'
vpython/bin/nosetests --verbosity=2 --with-xunit --xunit-file=$WORKSPACE/TEST-cxxtest.xml -w $WORKSPACE/cxxtest/test
# Generate code coverage
#cd cxxtest
#../vpython/bin/gcovr -v -r $WORKSPACE/cxxtest -x -o $WORKSPACE/cxxtest/test/coverage.xml --gcov-filter '.*#test#(\.\.|\^)#cxxtest#.*gcov'
echo "DONE"
# Cleanup old gcov files
cd $WORKSPACE
#\rm -f *.gcov cxxtest/*.gcov doc/*.gcov doc/examples/*.gcov
#\rm -f *.gcno cxxtest/*.gcno doc/*.gcno doc/examples/*.gcno
#\rm -f *.gcda cxxtest/*.gcda doc/*.gcda doc/examples/*.gcda
cd $WORKSPACE/cxxtest/test
make clean
cxxtest-4.4/admin/cxxtest.spec 0000664 0000000 0000000 00000001701 12343514423 0016531 0 ustar 00root root 0000000 0000000 Name: cxxtest
Summary: CxxTest Testing Framework for C++
Version: %{version}
Release: 1
Copyright: LGPL
Group: Development/C++
Source: cxxtest-%{version}.tar.gz
BuildRoot: /tmp/cxxtest-build
BuildArch: noarch
Prefix: /usr
%description
CxxTest is a unit testing framework for C++ that is similar in
spirit to JUnit, CppUnit, and xUnit. CxxTest is easy to use because
it does not require precompiling a CxxTest testing library, it
employs no advanced features of C++ (e.g. RTTI) and it supports a
very flexible form of test discovery.
%prep
%setup -n cxxtest
%build
%install
install -m 755 -d $RPM_BUILD_ROOT/usr/bin $RPM_BUILD_ROOT/usr/include/cxxtest
install -m 755 bin/cxxtestgen $RPM_BUILD_ROOT/usr/bin/
install -m 644 cxxtest/* $RPM_BUILD_ROOT/usr/include/cxxtest/
%clean
rm -rf $RPM_BUILD_ROOT
%files
%attr(-, root, root) %doc README
%attr(-, root, root) %doc sample
%attr(-, root, root) /usr/include/cxxtest
%attr(-, root, root) /usr/bin/cxxtestgen
cxxtest-4.4/admin/jenkins_cxxtest 0000775 0000000 0000000 00000004510 12343514423 0017325 0 ustar 00root root 0000000 0000000 #!/bin/bash
if test -z "$WORKSPACE"; then
echo "ERROR: \$WORKSPACE not defined"
exit 1
fi
export PATH="$WORKSPACE/vpython/bin:$PATH"
if test -n "$1"; then
PYTHON="$1"
else
PYTHON=python
fi
echo
echo "Building on `hostname`:"
echo
echo " Workspace: ${WORKSPACE}"
echo
echo " Package: ${PACKAGE}"
echo
echo " Environment:"
/usr/bin/env 2>&1 | sort | sed 's/^/ /'
echo
echo " Python:"
${PYTHON} -c 'import sys; sys.stdout.write(sys.version+"\n")' 2>&1 \
| sed 's/^/ /'
PYTHON_VER=`${PYTHON} -c 'import sys; sys.stdout.write(str(sys.version_info[0]))'`
echo
# The following executables are required (missing app yields build failure)
for app in gcc; do
which $app || exit 1
echo " $app:"
$app --version 2>&1 | grep -v '^$' | sed 's/^/ /' || exit 1
echo
done
# Setup virtual Python environment
\rm -Rf vpython
tmp=2.6
if [ "yes" = "$(echo | awk "($PYTHON_VER < $tmp) { print \"yes\"; }")" ]; then
"$PYTHON" "$WORKSPACE"/cxxtest/admin/virtualenv_1.7.py "$WORKSPACE"/vpython || exit 1
else
"$PYTHON" "$WORKSPACE"/cxxtest/admin/virtualenv.py "$WORKSPACE"/vpython || exit 1
fi
vpython/bin/easy_install nose
if test "$PYTHON_VER" -gt 2; then
vpython/bin/easy_install unittest2py3k
#vpython/bin/pip install unittest2py3k
else
vpython/bin/easy_install unittest2
fi
vpython/bin/easy_install ply
vpython/bin/easy_install ordereddict
vpython/bin/easy_install gcovr
vpython/bin/easy_install coverage
vpython/bin/easy_install pyutilib.th
cd "$WORKSPACE"/cxxtest/python
"$WORKSPACE"/vpython/bin/python setup.py develop
# Cleanup test directories
cd "$WORKSPACE"/cxxtest/test
make clean
cd "$WORKSPACE"/cxxtest/doc
make clean
cd "$WORKSPACE"
# Run tests
export CXXTEST_GCOV_FLAGS='-fprofile-arcs -ftest-coverage'
vpython/bin/nosetests --verbosity=2 -w "$WORKSPACE"/cxxtest \
--with-coverage --with-xunit --xunit-file="$WORKSPACE"/TEST-cxxtest.xml \
|| echo "(INFO) nosetests returned non-zero return code"
# Generate Python code coverage
vpython/bin/coverage xml --omit="$WORKSPACE/vpython/lib/*,$WORKSPACE/cxxtest/test/*,$WORKSPACE/cxxtest/doc/examples/*" -o $WORKSPACE/cxxtest/test/coverage.xml
# Generate C++ code coverage
cd "$WORKSPACE"/cxxtest
"$WORKSPACE"/vpython/bin/gcovr -v -d -r "$WORKSPACE"/cxxtest \
-x -o "$WORKSPACE"/cxxtest/coverage.xml \
--gcov-filter '.*#test#(\.\.|\^)#cxxtest#.*gcov'
echo "DONE"
cxxtest-4.4/admin/virtualenv.py 0000775 0000000 0000000 00000340505 12343514423 0016737 0 ustar 00root root 0000000 0000000 #!/usr/bin/env python
"""Create a "virtual" Python installation
"""
# If you change the version here, change it in setup.py
# and docs/conf.py as well.
__version__ = "1.9.1" # following best practices
virtualenv_version = __version__ # legacy, again
import base64
import sys
import os
import codecs
import optparse
import re
import shutil
import logging
import tempfile
import zlib
import errno
import glob
import distutils.sysconfig
from distutils.util import strtobool
import struct
import subprocess
if sys.version_info < (2, 5):
print('ERROR: %s' % sys.exc_info()[1])
print('ERROR: this script requires Python 2.5 or greater.')
sys.exit(101)
try:
set
except NameError:
from sets import Set as set
try:
basestring
except NameError:
basestring = str
try:
import ConfigParser
except ImportError:
import configparser as ConfigParser
join = os.path.join
py_version = 'python%s.%s' % (sys.version_info[0], sys.version_info[1])
is_jython = sys.platform.startswith('java')
is_pypy = hasattr(sys, 'pypy_version_info')
is_win = (sys.platform == 'win32')
is_cygwin = (sys.platform == 'cygwin')
is_darwin = (sys.platform == 'darwin')
abiflags = getattr(sys, 'abiflags', '')
user_dir = os.path.expanduser('~')
if is_win:
default_storage_dir = os.path.join(user_dir, 'virtualenv')
else:
default_storage_dir = os.path.join(user_dir, '.virtualenv')
default_config_file = os.path.join(default_storage_dir, 'virtualenv.ini')
if is_pypy:
expected_exe = 'pypy'
elif is_jython:
expected_exe = 'jython'
else:
expected_exe = 'python'
REQUIRED_MODULES = ['os', 'posix', 'posixpath', 'nt', 'ntpath', 'genericpath',
'fnmatch', 'locale', 'encodings', 'codecs',
'stat', 'UserDict', 'readline', 'copy_reg', 'types',
're', 'sre', 'sre_parse', 'sre_constants', 'sre_compile',
'zlib']
REQUIRED_FILES = ['lib-dynload', 'config']
majver, minver = sys.version_info[:2]
if majver == 2:
if minver >= 6:
REQUIRED_MODULES.extend(['warnings', 'linecache', '_abcoll', 'abc'])
if minver >= 7:
REQUIRED_MODULES.extend(['_weakrefset'])
if minver <= 3:
REQUIRED_MODULES.extend(['sets', '__future__'])
elif majver == 3:
# Some extra modules are needed for Python 3, but different ones
# for different versions.
REQUIRED_MODULES.extend(['_abcoll', 'warnings', 'linecache', 'abc', 'io',
'_weakrefset', 'copyreg', 'tempfile', 'random',
'__future__', 'collections', 'keyword', 'tarfile',
'shutil', 'struct', 'copy', 'tokenize', 'token',
'functools', 'heapq', 'bisect', 'weakref',
'reprlib'])
if minver >= 2:
REQUIRED_FILES[-1] = 'config-%s' % majver
if minver == 3:
import sysconfig
platdir = sysconfig.get_config_var('PLATDIR')
REQUIRED_FILES.append(platdir)
# The whole list of 3.3 modules is reproduced below - the current
# uncommented ones are required for 3.3 as of now, but more may be
# added as 3.3 development continues.
REQUIRED_MODULES.extend([
#"aifc",
#"antigravity",
#"argparse",
#"ast",
#"asynchat",
#"asyncore",
"base64",
#"bdb",
#"binhex",
#"bisect",
#"calendar",
#"cgi",
#"cgitb",
#"chunk",
#"cmd",
#"codeop",
#"code",
#"colorsys",
#"_compat_pickle",
#"compileall",
#"concurrent",
#"configparser",
#"contextlib",
#"cProfile",
#"crypt",
#"csv",
#"ctypes",
#"curses",
#"datetime",
#"dbm",
#"decimal",
#"difflib",
#"dis",
#"doctest",
#"dummy_threading",
"_dummy_thread",
#"email",
#"filecmp",
#"fileinput",
#"formatter",
#"fractions",
#"ftplib",
#"functools",
#"getopt",
#"getpass",
#"gettext",
#"glob",
#"gzip",
"hashlib",
#"heapq",
"hmac",
#"html",
#"http",
#"idlelib",
#"imaplib",
#"imghdr",
"imp",
"importlib",
#"inspect",
#"json",
#"lib2to3",
#"logging",
#"macpath",
#"macurl2path",
#"mailbox",
#"mailcap",
#"_markupbase",
#"mimetypes",
#"modulefinder",
#"multiprocessing",
#"netrc",
#"nntplib",
#"nturl2path",
#"numbers",
#"opcode",
#"optparse",
#"os2emxpath",
#"pdb",
#"pickle",
#"pickletools",
#"pipes",
#"pkgutil",
#"platform",
#"plat-linux2",
#"plistlib",
#"poplib",
#"pprint",
#"profile",
#"pstats",
#"pty",
#"pyclbr",
#"py_compile",
#"pydoc_data",
#"pydoc",
#"_pyio",
#"queue",
#"quopri",
#"reprlib",
"rlcompleter",
#"runpy",
#"sched",
#"shelve",
#"shlex",
#"smtpd",
#"smtplib",
#"sndhdr",
#"socket",
#"socketserver",
#"sqlite3",
#"ssl",
#"stringprep",
#"string",
#"_strptime",
#"subprocess",
#"sunau",
#"symbol",
#"symtable",
#"sysconfig",
#"tabnanny",
#"telnetlib",
#"test",
#"textwrap",
#"this",
#"_threading_local",
#"threading",
#"timeit",
#"tkinter",
#"tokenize",
#"token",
#"traceback",
#"trace",
#"tty",
#"turtledemo",
#"turtle",
#"unittest",
#"urllib",
#"uuid",
#"uu",
#"wave",
#"weakref",
#"webbrowser",
#"wsgiref",
#"xdrlib",
#"xml",
#"xmlrpc",
#"zipfile",
])
if is_pypy:
# these are needed to correctly display the exceptions that may happen
# during the bootstrap
REQUIRED_MODULES.extend(['traceback', 'linecache'])
class Logger(object):
"""
Logging object for use in command-line script. Allows ranges of
levels, to avoid some redundancy of displayed information.
"""
DEBUG = logging.DEBUG
INFO = logging.INFO
NOTIFY = (logging.INFO+logging.WARN)/2
WARN = WARNING = logging.WARN
ERROR = logging.ERROR
FATAL = logging.FATAL
LEVELS = [DEBUG, INFO, NOTIFY, WARN, ERROR, FATAL]
def __init__(self, consumers):
self.consumers = consumers
self.indent = 0
self.in_progress = None
self.in_progress_hanging = False
def debug(self, msg, *args, **kw):
self.log(self.DEBUG, msg, *args, **kw)
def info(self, msg, *args, **kw):
self.log(self.INFO, msg, *args, **kw)
def notify(self, msg, *args, **kw):
self.log(self.NOTIFY, msg, *args, **kw)
def warn(self, msg, *args, **kw):
self.log(self.WARN, msg, *args, **kw)
def error(self, msg, *args, **kw):
self.log(self.ERROR, msg, *args, **kw)
def fatal(self, msg, *args, **kw):
self.log(self.FATAL, msg, *args, **kw)
def log(self, level, msg, *args, **kw):
if args:
if kw:
raise TypeError(
"You may give positional or keyword arguments, not both")
args = args or kw
rendered = None
for consumer_level, consumer in self.consumers:
if self.level_matches(level, consumer_level):
if (self.in_progress_hanging
and consumer in (sys.stdout, sys.stderr)):
self.in_progress_hanging = False
sys.stdout.write('\n')
sys.stdout.flush()
if rendered is None:
if args:
rendered = msg % args
else:
rendered = msg
rendered = ' '*self.indent + rendered
if hasattr(consumer, 'write'):
consumer.write(rendered+'\n')
else:
consumer(rendered)
def start_progress(self, msg):
assert not self.in_progress, (
"Tried to start_progress(%r) while in_progress %r"
% (msg, self.in_progress))
if self.level_matches(self.NOTIFY, self._stdout_level()):
sys.stdout.write(msg)
sys.stdout.flush()
self.in_progress_hanging = True
else:
self.in_progress_hanging = False
self.in_progress = msg
def end_progress(self, msg='done.'):
assert self.in_progress, (
"Tried to end_progress without start_progress")
if self.stdout_level_matches(self.NOTIFY):
if not self.in_progress_hanging:
# Some message has been printed out since start_progress
sys.stdout.write('...' + self.in_progress + msg + '\n')
sys.stdout.flush()
else:
sys.stdout.write(msg + '\n')
sys.stdout.flush()
self.in_progress = None
self.in_progress_hanging = False
def show_progress(self):
"""If we are in a progress scope, and no log messages have been
shown, write out another '.'"""
if self.in_progress_hanging:
sys.stdout.write('.')
sys.stdout.flush()
def stdout_level_matches(self, level):
"""Returns true if a message at this level will go to stdout"""
return self.level_matches(level, self._stdout_level())
def _stdout_level(self):
"""Returns the level that stdout runs at"""
for level, consumer in self.consumers:
if consumer is sys.stdout:
return level
return self.FATAL
def level_matches(self, level, consumer_level):
"""
>>> l = Logger([])
>>> l.level_matches(3, 4)
False
>>> l.level_matches(3, 2)
True
>>> l.level_matches(slice(None, 3), 3)
False
>>> l.level_matches(slice(None, 3), 2)
True
>>> l.level_matches(slice(1, 3), 1)
True
>>> l.level_matches(slice(2, 3), 1)
False
"""
if isinstance(level, slice):
start, stop = level.start, level.stop
if start is not None and start > consumer_level:
return False
if stop is not None and stop <= consumer_level:
return False
return True
else:
return level >= consumer_level
#@classmethod
def level_for_integer(cls, level):
levels = cls.LEVELS
if level < 0:
return levels[0]
if level >= len(levels):
return levels[-1]
return levels[level]
level_for_integer = classmethod(level_for_integer)
# create a silent logger just to prevent this from being undefined
# will be overridden with requested verbosity main() is called.
logger = Logger([(Logger.LEVELS[-1], sys.stdout)])
def mkdir(path):
if not os.path.exists(path):
logger.info('Creating %s', path)
os.makedirs(path)
else:
logger.info('Directory %s already exists', path)
def copyfileordir(src, dest):
if os.path.isdir(src):
shutil.copytree(src, dest, True)
else:
shutil.copy2(src, dest)
def copyfile(src, dest, symlink=True):
if not os.path.exists(src):
# Some bad symlink in the src
logger.warn('Cannot find file %s (bad symlink)', src)
return
if os.path.exists(dest):
logger.debug('File %s already exists', dest)
return
if not os.path.exists(os.path.dirname(dest)):
logger.info('Creating parent directories for %s' % os.path.dirname(dest))
os.makedirs(os.path.dirname(dest))
if not os.path.islink(src):
srcpath = os.path.abspath(src)
else:
srcpath = os.readlink(src)
if symlink and hasattr(os, 'symlink') and not is_win:
logger.info('Symlinking %s', dest)
try:
os.symlink(srcpath, dest)
except (OSError, NotImplementedError):
logger.info('Symlinking failed, copying to %s', dest)
copyfileordir(src, dest)
else:
logger.info('Copying to %s', dest)
copyfileordir(src, dest)
def writefile(dest, content, overwrite=True):
if not os.path.exists(dest):
logger.info('Writing %s', dest)
f = open(dest, 'wb')
f.write(content.encode('utf-8'))
f.close()
return
else:
f = open(dest, 'rb')
c = f.read()
f.close()
if c != content.encode("utf-8"):
if not overwrite:
logger.notify('File %s exists with different content; not overwriting', dest)
return
logger.notify('Overwriting %s with new content', dest)
f = open(dest, 'wb')
f.write(content.encode('utf-8'))
f.close()
else:
logger.info('Content %s already in place', dest)
def rmtree(dir):
if os.path.exists(dir):
logger.notify('Deleting tree %s', dir)
shutil.rmtree(dir)
else:
logger.info('Do not need to delete %s; already gone', dir)
def make_exe(fn):
if hasattr(os, 'chmod'):
oldmode = os.stat(fn).st_mode & 0xFFF # 0o7777
newmode = (oldmode | 0x16D) & 0xFFF # 0o555, 0o7777
os.chmod(fn, newmode)
logger.info('Changed mode of %s to %s', fn, oct(newmode))
def _find_file(filename, dirs):
for dir in reversed(dirs):
files = glob.glob(os.path.join(dir, filename))
if files and os.path.isfile(files[0]):
return True, files[0]
return False, filename
def _install_req(py_executable, unzip=False, distribute=False,
search_dirs=None, never_download=False):
if search_dirs is None:
search_dirs = file_search_dirs()
if not distribute:
egg_path = 'setuptools-*-py%s.egg' % sys.version[:3]
found, egg_path = _find_file(egg_path, search_dirs)
project_name = 'setuptools'
bootstrap_script = EZ_SETUP_PY
tgz_path = None
else:
# Look for a distribute egg (these are not distributed by default,
# but can be made available by the user)
egg_path = 'distribute-*-py%s.egg' % sys.version[:3]
found, egg_path = _find_file(egg_path, search_dirs)
project_name = 'distribute'
if found:
tgz_path = None
bootstrap_script = DISTRIBUTE_FROM_EGG_PY
else:
# Fall back to sdist
# NB: egg_path is not None iff tgz_path is None
# iff bootstrap_script is a generic setup script accepting
# the standard arguments.
egg_path = None
tgz_path = 'distribute-*.tar.gz'
found, tgz_path = _find_file(tgz_path, search_dirs)
bootstrap_script = DISTRIBUTE_SETUP_PY
if is_jython and os._name == 'nt':
# Jython's .bat sys.executable can't handle a command line
# argument with newlines
fd, ez_setup = tempfile.mkstemp('.py')
os.write(fd, bootstrap_script)
os.close(fd)
cmd = [py_executable, ez_setup]
else:
cmd = [py_executable, '-c', bootstrap_script]
if unzip and egg_path:
cmd.append('--always-unzip')
env = {}
remove_from_env = ['__PYVENV_LAUNCHER__']
if logger.stdout_level_matches(logger.DEBUG) and egg_path:
cmd.append('-v')
old_chdir = os.getcwd()
if egg_path is not None and os.path.exists(egg_path):
logger.info('Using existing %s egg: %s' % (project_name, egg_path))
cmd.append(egg_path)
if os.environ.get('PYTHONPATH'):
env['PYTHONPATH'] = egg_path + os.path.pathsep + os.environ['PYTHONPATH']
else:
env['PYTHONPATH'] = egg_path
elif tgz_path is not None and os.path.exists(tgz_path):
# Found a tgz source dist, let's chdir
logger.info('Using existing %s egg: %s' % (project_name, tgz_path))
os.chdir(os.path.dirname(tgz_path))
# in this case, we want to be sure that PYTHONPATH is unset (not
# just empty, really unset), else CPython tries to import the
# site.py that it's in virtualenv_support
remove_from_env.append('PYTHONPATH')
elif never_download:
logger.fatal("Can't find any local distributions of %s to install "
"and --never-download is set. Either re-run virtualenv "
"without the --never-download option, or place a %s "
"distribution (%s) in one of these "
"locations: %r" % (project_name, project_name,
egg_path or tgz_path,
search_dirs))
sys.exit(1)
elif egg_path:
logger.info('No %s egg found; downloading' % project_name)
cmd.extend(['--always-copy', '-U', project_name])
else:
logger.info('No %s tgz found; downloading' % project_name)
logger.start_progress('Installing %s...' % project_name)
logger.indent += 2
cwd = None
if project_name == 'distribute':
env['DONT_PATCH_SETUPTOOLS'] = 'true'
def _filter_ez_setup(line):
return filter_ez_setup(line, project_name)
if not os.access(os.getcwd(), os.W_OK):
cwd = tempfile.mkdtemp()
if tgz_path is not None and os.path.exists(tgz_path):
# the current working dir is hostile, let's copy the
# tarball to a temp dir
target = os.path.join(cwd, os.path.split(tgz_path)[-1])
shutil.copy(tgz_path, target)
try:
call_subprocess(cmd, show_stdout=False,
filter_stdout=_filter_ez_setup,
extra_env=env,
remove_from_env=remove_from_env,
cwd=cwd)
finally:
logger.indent -= 2
logger.end_progress()
if cwd is not None:
shutil.rmtree(cwd)
if os.getcwd() != old_chdir:
os.chdir(old_chdir)
if is_jython and os._name == 'nt':
os.remove(ez_setup)
def file_search_dirs():
here = os.path.dirname(os.path.abspath(__file__))
dirs = ['.', here,
join(here, 'virtualenv_support')]
if os.path.splitext(os.path.dirname(__file__))[0] != 'virtualenv':
# Probably some boot script; just in case virtualenv is installed...
try:
import virtualenv
except ImportError:
pass
else:
dirs.append(os.path.join(os.path.dirname(virtualenv.__file__), 'virtualenv_support'))
return [d for d in dirs if os.path.isdir(d)]
def install_setuptools(py_executable, unzip=False,
search_dirs=None, never_download=False):
_install_req(py_executable, unzip,
search_dirs=search_dirs, never_download=never_download)
def install_distribute(py_executable, unzip=False,
search_dirs=None, never_download=False):
_install_req(py_executable, unzip, distribute=True,
search_dirs=search_dirs, never_download=never_download)
_pip_re = re.compile(r'^pip-.*(zip|tar.gz|tar.bz2|tgz|tbz)$', re.I)
def install_pip(py_executable, search_dirs=None, never_download=False):
if search_dirs is None:
search_dirs = file_search_dirs()
filenames = []
for dir in search_dirs:
filenames.extend([join(dir, fn) for fn in os.listdir(dir)
if _pip_re.search(fn)])
filenames = [(os.path.basename(filename).lower(), i, filename) for i, filename in enumerate(filenames)]
filenames.sort()
filenames = [filename for basename, i, filename in filenames]
if not filenames:
filename = 'pip'
else:
filename = filenames[-1]
easy_install_script = 'easy_install'
if is_win:
easy_install_script = 'easy_install-script.py'
# There's two subtle issues here when invoking easy_install.
# 1. On unix-like systems the easy_install script can *only* be executed
# directly if its full filesystem path is no longer than 78 characters.
# 2. A work around to [1] is to use the `python path/to/easy_install foo`
# pattern, but that breaks if the path contains non-ASCII characters, as
# you can't put the file encoding declaration before the shebang line.
# The solution is to use Python's -x flag to skip the first line of the
# script (and any ASCII decoding errors that may have occurred in that line)
cmd = [py_executable, '-x', join(os.path.dirname(py_executable), easy_install_script), filename]
# jython and pypy don't yet support -x
if is_jython or is_pypy:
cmd.remove('-x')
if filename == 'pip':
if never_download:
logger.fatal("Can't find any local distributions of pip to install "
"and --never-download is set. Either re-run virtualenv "
"without the --never-download option, or place a pip "
"source distribution (zip/tar.gz/tar.bz2) in one of these "
"locations: %r" % search_dirs)
sys.exit(1)
logger.info('Installing pip from network...')
else:
logger.info('Installing existing %s distribution: %s' % (
os.path.basename(filename), filename))
logger.start_progress('Installing pip...')
logger.indent += 2
def _filter_setup(line):
return filter_ez_setup(line, 'pip')
try:
call_subprocess(cmd, show_stdout=False,
filter_stdout=_filter_setup)
finally:
logger.indent -= 2
logger.end_progress()
def filter_ez_setup(line, project_name='setuptools'):
if not line.strip():
return Logger.DEBUG
if project_name == 'distribute':
for prefix in ('Extracting', 'Now working', 'Installing', 'Before',
'Scanning', 'Setuptools', 'Egg', 'Already',
'running', 'writing', 'reading', 'installing',
'creating', 'copying', 'byte-compiling', 'removing',
'Processing'):
if line.startswith(prefix):
return Logger.DEBUG
return Logger.DEBUG
for prefix in ['Reading ', 'Best match', 'Processing setuptools',
'Copying setuptools', 'Adding setuptools',
'Installing ', 'Installed ']:
if line.startswith(prefix):
return Logger.DEBUG
return Logger.INFO
class UpdatingDefaultsHelpFormatter(optparse.IndentedHelpFormatter):
"""
Custom help formatter for use in ConfigOptionParser that updates
the defaults before expanding them, allowing them to show up correctly
in the help listing
"""
def expand_default(self, option):
if self.parser is not None:
self.parser.update_defaults(self.parser.defaults)
return optparse.IndentedHelpFormatter.expand_default(self, option)
class ConfigOptionParser(optparse.OptionParser):
"""
Custom option parser which updates its defaults by by checking the
configuration files and environmental variables
"""
def __init__(self, *args, **kwargs):
self.config = ConfigParser.RawConfigParser()
self.files = self.get_config_files()
self.config.read(self.files)
optparse.OptionParser.__init__(self, *args, **kwargs)
def get_config_files(self):
config_file = os.environ.get('VIRTUALENV_CONFIG_FILE', False)
if config_file and os.path.exists(config_file):
return [config_file]
return [default_config_file]
def update_defaults(self, defaults):
"""
Updates the given defaults with values from the config files and
the environ. Does a little special handling for certain types of
options (lists).
"""
# Then go and look for the other sources of configuration:
config = {}
# 1. config files
config.update(dict(self.get_config_section('virtualenv')))
# 2. environmental variables
config.update(dict(self.get_environ_vars()))
# Then set the options with those values
for key, val in config.items():
key = key.replace('_', '-')
if not key.startswith('--'):
key = '--%s' % key # only prefer long opts
option = self.get_option(key)
if option is not None:
# ignore empty values
if not val:
continue
# handle multiline configs
if option.action == 'append':
val = val.split()
else:
option.nargs = 1
if option.action == 'store_false':
val = not strtobool(val)
elif option.action in ('store_true', 'count'):
val = strtobool(val)
try:
val = option.convert_value(key, val)
except optparse.OptionValueError:
e = sys.exc_info()[1]
print("An error occured during configuration: %s" % e)
sys.exit(3)
defaults[option.dest] = val
return defaults
def get_config_section(self, name):
"""
Get a section of a configuration
"""
if self.config.has_section(name):
return self.config.items(name)
return []
def get_environ_vars(self, prefix='VIRTUALENV_'):
"""
Returns a generator with all environmental vars with prefix VIRTUALENV
"""
for key, val in os.environ.items():
if key.startswith(prefix):
yield (key.replace(prefix, '').lower(), val)
def get_default_values(self):
"""
Overridding to make updating the defaults after instantiation of
the option parser possible, update_defaults() does the dirty work.
"""
if not self.process_default_values:
# Old, pre-Optik 1.5 behaviour.
return optparse.Values(self.defaults)
defaults = self.update_defaults(self.defaults.copy()) # ours
for option in self._get_all_options():
default = defaults.get(option.dest)
if isinstance(default, basestring):
opt_str = option.get_opt_string()
defaults[option.dest] = option.check_value(opt_str, default)
return optparse.Values(defaults)
def main():
parser = ConfigOptionParser(
version=virtualenv_version,
usage="%prog [OPTIONS] DEST_DIR",
formatter=UpdatingDefaultsHelpFormatter())
parser.add_option(
'-v', '--verbose',
action='count',
dest='verbose',
default=0,
help="Increase verbosity")
parser.add_option(
'-q', '--quiet',
action='count',
dest='quiet',
default=0,
help='Decrease verbosity')
parser.add_option(
'-p', '--python',
dest='python',
metavar='PYTHON_EXE',
help='The Python interpreter to use, e.g., --python=python2.5 will use the python2.5 '
'interpreter to create the new environment. The default is the interpreter that '
'virtualenv was installed with (%s)' % sys.executable)
parser.add_option(
'--clear',
dest='clear',
action='store_true',
help="Clear out the non-root install and start from scratch")
parser.set_defaults(system_site_packages=False)
parser.add_option(
'--no-site-packages',
dest='system_site_packages',
action='store_false',
help="Don't give access to the global site-packages dir to the "
"virtual environment (default)")
parser.add_option(
'--system-site-packages',
dest='system_site_packages',
action='store_true',
help="Give access to the global site-packages dir to the "
"virtual environment")
parser.add_option(
'--unzip-setuptools',
dest='unzip_setuptools',
action='store_true',
help="Unzip Setuptools or Distribute when installing it")
parser.add_option(
'--relocatable',
dest='relocatable',
action='store_true',
help='Make an EXISTING virtualenv environment relocatable. '
'This fixes up scripts and makes all .pth files relative')
parser.add_option(
'--distribute', '--use-distribute', # the second option is for legacy reasons here. Hi Kenneth!
dest='use_distribute',
action='store_true',
help='Use Distribute instead of Setuptools. Set environ variable '
'VIRTUALENV_DISTRIBUTE to make it the default ')
parser.add_option(
'--no-setuptools',
dest='no_setuptools',
action='store_true',
help='Do not install distribute/setuptools (or pip) '
'in the new virtualenv.')
parser.add_option(
'--no-pip',
dest='no_pip',
action='store_true',
help='Do not install pip in the new virtualenv.')
parser.add_option(
'--setuptools',
dest='use_distribute',
action='store_false',
help='Use Setuptools instead of Distribute. Set environ variable '
'VIRTUALENV_SETUPTOOLS to make it the default ')
# Set this to True to use distribute by default, even in Python 2.
parser.set_defaults(use_distribute=False)
default_search_dirs = file_search_dirs()
parser.add_option(
'--extra-search-dir',
dest="search_dirs",
action="append",
default=default_search_dirs,
help="Directory to look for setuptools/distribute/pip distributions in. "
"You can add any number of additional --extra-search-dir paths.")
parser.add_option(
'--never-download',
dest="never_download",
action="store_true",
help="Never download anything from the network. Instead, virtualenv will fail "
"if local distributions of setuptools/distribute/pip are not present.")
parser.add_option(
'--prompt',
dest='prompt',
help='Provides an alternative prompt prefix for this environment')
if 'extend_parser' in globals():
extend_parser(parser)
options, args = parser.parse_args()
global logger
if 'adjust_options' in globals():
adjust_options(options, args)
verbosity = options.verbose - options.quiet
logger = Logger([(Logger.level_for_integer(2 - verbosity), sys.stdout)])
if options.python and not os.environ.get('VIRTUALENV_INTERPRETER_RUNNING'):
env = os.environ.copy()
interpreter = resolve_interpreter(options.python)
if interpreter == sys.executable:
logger.warn('Already using interpreter %s' % interpreter)
else:
logger.notify('Running virtualenv with interpreter %s' % interpreter)
env['VIRTUALENV_INTERPRETER_RUNNING'] = 'true'
file = __file__
if file.endswith('.pyc'):
file = file[:-1]
popen = subprocess.Popen([interpreter, file] + sys.argv[1:], env=env)
raise SystemExit(popen.wait())
# Force --distribute on Python 3, since setuptools is not available.
if majver > 2:
options.use_distribute = True
if os.environ.get('PYTHONDONTWRITEBYTECODE') and not options.use_distribute:
print(
"The PYTHONDONTWRITEBYTECODE environment variable is "
"not compatible with setuptools. Either use --distribute "
"or unset PYTHONDONTWRITEBYTECODE.")
sys.exit(2)
if not args:
print('You must provide a DEST_DIR')
parser.print_help()
sys.exit(2)
if len(args) > 1:
print('There must be only one argument: DEST_DIR (you gave %s)' % (
' '.join(args)))
parser.print_help()
sys.exit(2)
home_dir = args[0]
if os.environ.get('WORKING_ENV'):
logger.fatal('ERROR: you cannot run virtualenv while in a workingenv')
logger.fatal('Please deactivate your workingenv, then re-run this script')
sys.exit(3)
if 'PYTHONHOME' in os.environ:
logger.warn('PYTHONHOME is set. You *must* activate the virtualenv before using it')
del os.environ['PYTHONHOME']
if options.relocatable:
make_environment_relocatable(home_dir)
return
create_environment(home_dir,
site_packages=options.system_site_packages,
clear=options.clear,
unzip_setuptools=options.unzip_setuptools,
use_distribute=options.use_distribute,
prompt=options.prompt,
search_dirs=options.search_dirs,
never_download=options.never_download,
no_setuptools=options.no_setuptools,
no_pip=options.no_pip)
if 'after_install' in globals():
after_install(options, home_dir)
def call_subprocess(cmd, show_stdout=True,
filter_stdout=None, cwd=None,
raise_on_returncode=True, extra_env=None,
remove_from_env=None):
cmd_parts = []
for part in cmd:
if len(part) > 45:
part = part[:20]+"..."+part[-20:]
if ' ' in part or '\n' in part or '"' in part or "'" in part:
part = '"%s"' % part.replace('"', '\\"')
if hasattr(part, 'decode'):
try:
part = part.decode(sys.getdefaultencoding())
except UnicodeDecodeError:
part = part.decode(sys.getfilesystemencoding())
cmd_parts.append(part)
cmd_desc = ' '.join(cmd_parts)
if show_stdout:
stdout = None
else:
stdout = subprocess.PIPE
logger.debug("Running command %s" % cmd_desc)
if extra_env or remove_from_env:
env = os.environ.copy()
if extra_env:
env.update(extra_env)
if remove_from_env:
for varname in remove_from_env:
env.pop(varname, None)
else:
env = None
try:
proc = subprocess.Popen(
cmd, stderr=subprocess.STDOUT, stdin=None, stdout=stdout,
cwd=cwd, env=env)
except Exception:
e = sys.exc_info()[1]
logger.fatal(
"Error %s while executing command %s" % (e, cmd_desc))
raise
all_output = []
if stdout is not None:
stdout = proc.stdout
encoding = sys.getdefaultencoding()
fs_encoding = sys.getfilesystemencoding()
while 1:
line = stdout.readline()
try:
line = line.decode(encoding)
except UnicodeDecodeError:
line = line.decode(fs_encoding)
if not line:
break
line = line.rstrip()
all_output.append(line)
if filter_stdout:
level = filter_stdout(line)
if isinstance(level, tuple):
level, line = level
logger.log(level, line)
if not logger.stdout_level_matches(level):
logger.show_progress()
else:
logger.info(line)
else:
proc.communicate()
proc.wait()
if proc.returncode:
if raise_on_returncode:
if all_output:
logger.notify('Complete output from command %s:' % cmd_desc)
logger.notify('\n'.join(all_output) + '\n----------------------------------------')
raise OSError(
"Command %s failed with error code %s"
% (cmd_desc, proc.returncode))
else:
logger.warn(
"Command %s had error code %s"
% (cmd_desc, proc.returncode))
def create_environment(home_dir, site_packages=False, clear=False,
unzip_setuptools=False, use_distribute=False,
prompt=None, search_dirs=None, never_download=False,
no_setuptools=False, no_pip=False):
"""
Creates a new environment in ``home_dir``.
If ``site_packages`` is true, then the global ``site-packages/``
directory will be on the path.
If ``clear`` is true (default False) then the environment will
first be cleared.
"""
home_dir, lib_dir, inc_dir, bin_dir = path_locations(home_dir)
py_executable = os.path.abspath(install_python(
home_dir, lib_dir, inc_dir, bin_dir,
site_packages=site_packages, clear=clear))
install_distutils(home_dir)
if not no_setuptools:
if use_distribute:
install_distribute(py_executable, unzip=unzip_setuptools,
search_dirs=search_dirs, never_download=never_download)
else:
install_setuptools(py_executable, unzip=unzip_setuptools,
search_dirs=search_dirs, never_download=never_download)
if not no_pip:
install_pip(py_executable, search_dirs=search_dirs, never_download=never_download)
install_activate(home_dir, bin_dir, prompt)
def is_executable_file(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
def path_locations(home_dir):
"""Return the path locations for the environment (where libraries are,
where scripts go, etc)"""
# XXX: We'd use distutils.sysconfig.get_python_inc/lib but its
# prefix arg is broken: http://bugs.python.org/issue3386
if is_win:
# Windows has lots of problems with executables with spaces in
# the name; this function will remove them (using the ~1
# format):
mkdir(home_dir)
if ' ' in home_dir:
import ctypes
GetShortPathName = ctypes.windll.kernel32.GetShortPathNameW
size = max(len(home_dir)+1, 256)
buf = ctypes.create_unicode_buffer(size)
try:
u = unicode
except NameError:
u = str
ret = GetShortPathName(u(home_dir), buf, size)
if not ret:
print('Error: the path "%s" has a space in it' % home_dir)
print('We could not determine the short pathname for it.')
print('Exiting.')
sys.exit(3)
home_dir = str(buf.value)
lib_dir = join(home_dir, 'Lib')
inc_dir = join(home_dir, 'Include')
bin_dir = join(home_dir, 'Scripts')
if is_jython:
lib_dir = join(home_dir, 'Lib')
inc_dir = join(home_dir, 'Include')
bin_dir = join(home_dir, 'bin')
elif is_pypy:
lib_dir = home_dir
inc_dir = join(home_dir, 'include')
bin_dir = join(home_dir, 'bin')
elif not is_win:
lib_dir = join(home_dir, 'lib', py_version)
multiarch_exec = '/usr/bin/multiarch-platform'
if is_executable_file(multiarch_exec):
# In Mageia (2) and Mandriva distros the include dir must be like:
# virtualenv/include/multiarch-x86_64-linux/python2.7
# instead of being virtualenv/include/python2.7
p = subprocess.Popen(multiarch_exec, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
# stdout.strip is needed to remove newline character
inc_dir = join(home_dir, 'include', stdout.strip(), py_version + abiflags)
else:
inc_dir = join(home_dir, 'include', py_version + abiflags)
bin_dir = join(home_dir, 'bin')
return home_dir, lib_dir, inc_dir, bin_dir
def change_prefix(filename, dst_prefix):
prefixes = [sys.prefix]
if is_darwin:
prefixes.extend((
os.path.join("/Library/Python", sys.version[:3], "site-packages"),
os.path.join(sys.prefix, "Extras", "lib", "python"),
os.path.join("~", "Library", "Python", sys.version[:3], "site-packages"),
# Python 2.6 no-frameworks
os.path.join("~", ".local", "lib","python", sys.version[:3], "site-packages"),
# System Python 2.7 on OSX Mountain Lion
os.path.join("~", "Library", "Python", sys.version[:3], "lib", "python", "site-packages")))
if hasattr(sys, 'real_prefix'):
prefixes.append(sys.real_prefix)
if hasattr(sys, 'base_prefix'):
prefixes.append(sys.base_prefix)
prefixes = list(map(os.path.expanduser, prefixes))
prefixes = list(map(os.path.abspath, prefixes))
# Check longer prefixes first so we don't split in the middle of a filename
prefixes = sorted(prefixes, key=len, reverse=True)
filename = os.path.abspath(filename)
for src_prefix in prefixes:
if filename.startswith(src_prefix):
_, relpath = filename.split(src_prefix, 1)
if src_prefix != os.sep: # sys.prefix == "/"
assert relpath[0] == os.sep
relpath = relpath[1:]
return join(dst_prefix, relpath)
assert False, "Filename %s does not start with any of these prefixes: %s" % \
(filename, prefixes)
def copy_required_modules(dst_prefix):
import imp
# If we are running under -p, we need to remove the current
# directory from sys.path temporarily here, so that we
# definitely get the modules from the site directory of
# the interpreter we are running under, not the one
# virtualenv.py is installed under (which might lead to py2/py3
# incompatibility issues)
_prev_sys_path = sys.path
if os.environ.get('VIRTUALENV_INTERPRETER_RUNNING'):
sys.path = sys.path[1:]
try:
for modname in REQUIRED_MODULES:
if modname in sys.builtin_module_names:
logger.info("Ignoring built-in bootstrap module: %s" % modname)
continue
try:
f, filename, _ = imp.find_module(modname)
except ImportError:
logger.info("Cannot import bootstrap module: %s" % modname)
else:
if f is not None:
f.close()
# special-case custom readline.so on OS X, but not for pypy:
if modname == 'readline' and sys.platform == 'darwin' and not (
is_pypy or filename.endswith(join('lib-dynload', 'readline.so'))):
dst_filename = join(dst_prefix, 'lib', 'python%s' % sys.version[:3], 'readline.so')
else:
dst_filename = change_prefix(filename, dst_prefix)
copyfile(filename, dst_filename)
if filename.endswith('.pyc'):
pyfile = filename[:-1]
if os.path.exists(pyfile):
copyfile(pyfile, dst_filename[:-1])
finally:
sys.path = _prev_sys_path
def subst_path(prefix_path, prefix, home_dir):
prefix_path = os.path.normpath(prefix_path)
prefix = os.path.normpath(prefix)
home_dir = os.path.normpath(home_dir)
if not prefix_path.startswith(prefix):
logger.warn('Path not in prefix %r %r', prefix_path, prefix)
return
return prefix_path.replace(prefix, home_dir, 1)
def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear):
"""Install just the base environment, no distutils patches etc"""
if sys.executable.startswith(bin_dir):
print('Please use the *system* python to run this script')
return
if clear:
rmtree(lib_dir)
## FIXME: why not delete it?
## Maybe it should delete everything with #!/path/to/venv/python in it
logger.notify('Not deleting %s', bin_dir)
if hasattr(sys, 'real_prefix'):
logger.notify('Using real prefix %r' % sys.real_prefix)
prefix = sys.real_prefix
elif hasattr(sys, 'base_prefix'):
logger.notify('Using base prefix %r' % sys.base_prefix)
prefix = sys.base_prefix
else:
prefix = sys.prefix
mkdir(lib_dir)
fix_lib64(lib_dir)
stdlib_dirs = [os.path.dirname(os.__file__)]
if is_win:
stdlib_dirs.append(join(os.path.dirname(stdlib_dirs[0]), 'DLLs'))
elif is_darwin:
stdlib_dirs.append(join(stdlib_dirs[0], 'site-packages'))
if hasattr(os, 'symlink'):
logger.info('Symlinking Python bootstrap modules')
else:
logger.info('Copying Python bootstrap modules')
logger.indent += 2
try:
# copy required files...
for stdlib_dir in stdlib_dirs:
if not os.path.isdir(stdlib_dir):
continue
for fn in os.listdir(stdlib_dir):
bn = os.path.splitext(fn)[0]
if fn != 'site-packages' and bn in REQUIRED_FILES:
copyfile(join(stdlib_dir, fn), join(lib_dir, fn))
# ...and modules
copy_required_modules(home_dir)
finally:
logger.indent -= 2
mkdir(join(lib_dir, 'site-packages'))
import site
site_filename = site.__file__
if site_filename.endswith('.pyc'):
site_filename = site_filename[:-1]
elif site_filename.endswith('$py.class'):
site_filename = site_filename.replace('$py.class', '.py')
site_filename_dst = change_prefix(site_filename, home_dir)
site_dir = os.path.dirname(site_filename_dst)
writefile(site_filename_dst, SITE_PY)
writefile(join(site_dir, 'orig-prefix.txt'), prefix)
site_packages_filename = join(site_dir, 'no-global-site-packages.txt')
if not site_packages:
writefile(site_packages_filename, '')
if is_pypy or is_win:
stdinc_dir = join(prefix, 'include')
else:
stdinc_dir = join(prefix, 'include', py_version + abiflags)
if os.path.exists(stdinc_dir):
copyfile(stdinc_dir, inc_dir)
else:
logger.debug('No include dir %s' % stdinc_dir)
platinc_dir = distutils.sysconfig.get_python_inc(plat_specific=1)
if platinc_dir != stdinc_dir:
platinc_dest = distutils.sysconfig.get_python_inc(
plat_specific=1, prefix=home_dir)
if platinc_dir == platinc_dest:
# Do platinc_dest manually due to a CPython bug;
# not http://bugs.python.org/issue3386 but a close cousin
platinc_dest = subst_path(platinc_dir, prefix, home_dir)
if platinc_dest:
# PyPy's stdinc_dir and prefix are relative to the original binary
# (traversing virtualenvs), whereas the platinc_dir is relative to
# the inner virtualenv and ignores the prefix argument.
# This seems more evolved than designed.
copyfile(platinc_dir, platinc_dest)
# pypy never uses exec_prefix, just ignore it
if sys.exec_prefix != prefix and not is_pypy:
if is_win:
exec_dir = join(sys.exec_prefix, 'lib')
elif is_jython:
exec_dir = join(sys.exec_prefix, 'Lib')
else:
exec_dir = join(sys.exec_prefix, 'lib', py_version)
for fn in os.listdir(exec_dir):
copyfile(join(exec_dir, fn), join(lib_dir, fn))
if is_jython:
# Jython has either jython-dev.jar and javalib/ dir, or just
# jython.jar
for name in 'jython-dev.jar', 'javalib', 'jython.jar':
src = join(prefix, name)
if os.path.exists(src):
copyfile(src, join(home_dir, name))
# XXX: registry should always exist after Jython 2.5rc1
src = join(prefix, 'registry')
if os.path.exists(src):
copyfile(src, join(home_dir, 'registry'), symlink=False)
copyfile(join(prefix, 'cachedir'), join(home_dir, 'cachedir'),
symlink=False)
mkdir(bin_dir)
py_executable = join(bin_dir, os.path.basename(sys.executable))
if 'Python.framework' in prefix:
# OS X framework builds cause validation to break
# https://github.com/pypa/virtualenv/issues/322
if os.environ.get('__PYVENV_LAUNCHER__'):
os.unsetenv('__PYVENV_LAUNCHER__')
if re.search(r'/Python(?:-32|-64)*$', py_executable):
# The name of the python executable is not quite what
# we want, rename it.
py_executable = os.path.join(
os.path.dirname(py_executable), 'python')
logger.notify('New %s executable in %s', expected_exe, py_executable)
pcbuild_dir = os.path.dirname(sys.executable)
pyd_pth = os.path.join(lib_dir, 'site-packages', 'virtualenv_builddir_pyd.pth')
if is_win and os.path.exists(os.path.join(pcbuild_dir, 'build.bat')):
logger.notify('Detected python running from build directory %s', pcbuild_dir)
logger.notify('Writing .pth file linking to build directory for *.pyd files')
writefile(pyd_pth, pcbuild_dir)
else:
pcbuild_dir = None
if os.path.exists(pyd_pth):
logger.info('Deleting %s (not Windows env or not build directory python)' % pyd_pth)
os.unlink(pyd_pth)
if sys.executable != py_executable:
## FIXME: could I just hard link?
executable = sys.executable
shutil.copyfile(executable, py_executable)
make_exe(py_executable)
if is_win or is_cygwin:
pythonw = os.path.join(os.path.dirname(sys.executable), 'pythonw.exe')
if os.path.exists(pythonw):
logger.info('Also created pythonw.exe')
shutil.copyfile(pythonw, os.path.join(os.path.dirname(py_executable), 'pythonw.exe'))
python_d = os.path.join(os.path.dirname(sys.executable), 'python_d.exe')
python_d_dest = os.path.join(os.path.dirname(py_executable), 'python_d.exe')
if os.path.exists(python_d):
logger.info('Also created python_d.exe')
shutil.copyfile(python_d, python_d_dest)
elif os.path.exists(python_d_dest):
logger.info('Removed python_d.exe as it is no longer at the source')
os.unlink(python_d_dest)
# we need to copy the DLL to enforce that windows will load the correct one.
# may not exist if we are cygwin.
py_executable_dll = 'python%s%s.dll' % (
sys.version_info[0], sys.version_info[1])
py_executable_dll_d = 'python%s%s_d.dll' % (
sys.version_info[0], sys.version_info[1])
pythondll = os.path.join(os.path.dirname(sys.executable), py_executable_dll)
pythondll_d = os.path.join(os.path.dirname(sys.executable), py_executable_dll_d)
pythondll_d_dest = os.path.join(os.path.dirname(py_executable), py_executable_dll_d)
if os.path.exists(pythondll):
logger.info('Also created %s' % py_executable_dll)
shutil.copyfile(pythondll, os.path.join(os.path.dirname(py_executable), py_executable_dll))
if os.path.exists(pythondll_d):
logger.info('Also created %s' % py_executable_dll_d)
shutil.copyfile(pythondll_d, pythondll_d_dest)
elif os.path.exists(pythondll_d_dest):
logger.info('Removed %s as the source does not exist' % pythondll_d_dest)
os.unlink(pythondll_d_dest)
if is_pypy:
# make a symlink python --> pypy-c
python_executable = os.path.join(os.path.dirname(py_executable), 'python')
if sys.platform in ('win32', 'cygwin'):
python_executable += '.exe'
logger.info('Also created executable %s' % python_executable)
copyfile(py_executable, python_executable)
if is_win:
for name in 'libexpat.dll', 'libpypy.dll', 'libpypy-c.dll', 'libeay32.dll', 'ssleay32.dll', 'sqlite.dll':
src = join(prefix, name)
if os.path.exists(src):
copyfile(src, join(bin_dir, name))
if os.path.splitext(os.path.basename(py_executable))[0] != expected_exe:
secondary_exe = os.path.join(os.path.dirname(py_executable),
expected_exe)
py_executable_ext = os.path.splitext(py_executable)[1]
if py_executable_ext == '.exe':
# python2.4 gives an extension of '.4' :P
secondary_exe += py_executable_ext
if os.path.exists(secondary_exe):
logger.warn('Not overwriting existing %s script %s (you must use %s)'
% (expected_exe, secondary_exe, py_executable))
else:
logger.notify('Also creating executable in %s' % secondary_exe)
shutil.copyfile(sys.executable, secondary_exe)
make_exe(secondary_exe)
if '.framework' in prefix:
if 'Python.framework' in prefix:
logger.debug('MacOSX Python framework detected')
# Make sure we use the the embedded interpreter inside
# the framework, even if sys.executable points to
# the stub executable in ${sys.prefix}/bin
# See http://groups.google.com/group/python-virtualenv/
# browse_thread/thread/17cab2f85da75951
original_python = os.path.join(
prefix, 'Resources/Python.app/Contents/MacOS/Python')
if 'EPD' in prefix:
logger.debug('EPD framework detected')
original_python = os.path.join(prefix, 'bin/python')
shutil.copy(original_python, py_executable)
# Copy the framework's dylib into the virtual
# environment
virtual_lib = os.path.join(home_dir, '.Python')
if os.path.exists(virtual_lib):
os.unlink(virtual_lib)
copyfile(
os.path.join(prefix, 'Python'),
virtual_lib)
# And then change the install_name of the copied python executable
try:
mach_o_change(py_executable,
os.path.join(prefix, 'Python'),
'@executable_path/../.Python')
except:
e = sys.exc_info()[1]
logger.warn("Could not call mach_o_change: %s. "
"Trying to call install_name_tool instead." % e)
try:
call_subprocess(
["install_name_tool", "-change",
os.path.join(prefix, 'Python'),
'@executable_path/../.Python',
py_executable])
except:
logger.fatal("Could not call install_name_tool -- you must "
"have Apple's development tools installed")
raise
if not is_win:
# Ensure that 'python', 'pythonX' and 'pythonX.Y' all exist
py_exe_version_major = 'python%s' % sys.version_info[0]
py_exe_version_major_minor = 'python%s.%s' % (
sys.version_info[0], sys.version_info[1])
py_exe_no_version = 'python'
required_symlinks = [ py_exe_no_version, py_exe_version_major,
py_exe_version_major_minor ]
py_executable_base = os.path.basename(py_executable)
if py_executable_base in required_symlinks:
# Don't try to symlink to yourself.
required_symlinks.remove(py_executable_base)
for pth in required_symlinks:
full_pth = join(bin_dir, pth)
if os.path.exists(full_pth):
os.unlink(full_pth)
os.symlink(py_executable_base, full_pth)
if is_win and ' ' in py_executable:
# There's a bug with subprocess on Windows when using a first
# argument that has a space in it. Instead we have to quote
# the value:
py_executable = '"%s"' % py_executable
# NOTE: keep this check as one line, cmd.exe doesn't cope with line breaks
cmd = [py_executable, '-c', 'import sys;out=sys.stdout;'
'getattr(out, "buffer", out).write(sys.prefix.encode("utf-8"))']
logger.info('Testing executable with %s %s "%s"' % tuple(cmd))
try:
proc = subprocess.Popen(cmd,
stdout=subprocess.PIPE)
proc_stdout, proc_stderr = proc.communicate()
except OSError:
e = sys.exc_info()[1]
if e.errno == errno.EACCES:
logger.fatal('ERROR: The executable %s could not be run: %s' % (py_executable, e))
sys.exit(100)
else:
raise e
proc_stdout = proc_stdout.strip().decode("utf-8")
proc_stdout = os.path.normcase(os.path.abspath(proc_stdout))
norm_home_dir = os.path.normcase(os.path.abspath(home_dir))
if hasattr(norm_home_dir, 'decode'):
norm_home_dir = norm_home_dir.decode(sys.getfilesystemencoding())
if proc_stdout != norm_home_dir:
logger.fatal(
'ERROR: The executable %s is not functioning' % py_executable)
logger.fatal(
'ERROR: It thinks sys.prefix is %r (should be %r)'
% (proc_stdout, norm_home_dir))
logger.fatal(
'ERROR: virtualenv is not compatible with this system or executable')
if is_win:
logger.fatal(
'Note: some Windows users have reported this error when they '
'installed Python for "Only this user" or have multiple '
'versions of Python installed. Copying the appropriate '
'PythonXX.dll to the virtualenv Scripts/ directory may fix '
'this problem.')
sys.exit(100)
else:
logger.info('Got sys.prefix result: %r' % proc_stdout)
pydistutils = os.path.expanduser('~/.pydistutils.cfg')
if os.path.exists(pydistutils):
logger.notify('Please make sure you remove any previous custom paths from '
'your %s file.' % pydistutils)
## FIXME: really this should be calculated earlier
fix_local_scheme(home_dir)
if site_packages:
if os.path.exists(site_packages_filename):
logger.info('Deleting %s' % site_packages_filename)
os.unlink(site_packages_filename)
return py_executable
def install_activate(home_dir, bin_dir, prompt=None):
home_dir = os.path.abspath(home_dir)
if is_win or is_jython and os._name == 'nt':
files = {
'activate.bat': ACTIVATE_BAT,
'deactivate.bat': DEACTIVATE_BAT,
'activate.ps1': ACTIVATE_PS,
}
# MSYS needs paths of the form /c/path/to/file
drive, tail = os.path.splitdrive(home_dir.replace(os.sep, '/'))
home_dir_msys = (drive and "/%s%s" or "%s%s") % (drive[:1], tail)
# Run-time conditional enables (basic) Cygwin compatibility
home_dir_sh = ("""$(if [ "$OSTYPE" "==" "cygwin" ]; then cygpath -u '%s'; else echo '%s'; fi;)""" %
(home_dir, home_dir_msys))
files['activate'] = ACTIVATE_SH.replace('__VIRTUAL_ENV__', home_dir_sh)
else:
files = {'activate': ACTIVATE_SH}
# suppling activate.fish in addition to, not instead of, the
# bash script support.
files['activate.fish'] = ACTIVATE_FISH
# same for csh/tcsh support...
files['activate.csh'] = ACTIVATE_CSH
files['activate_this.py'] = ACTIVATE_THIS
if hasattr(home_dir, 'decode'):
home_dir = home_dir.decode(sys.getfilesystemencoding())
vname = os.path.basename(home_dir)
for name, content in files.items():
content = content.replace('__VIRTUAL_PROMPT__', prompt or '')
content = content.replace('__VIRTUAL_WINPROMPT__', prompt or '(%s)' % vname)
content = content.replace('__VIRTUAL_ENV__', home_dir)
content = content.replace('__VIRTUAL_NAME__', vname)
content = content.replace('__BIN_NAME__', os.path.basename(bin_dir))
writefile(os.path.join(bin_dir, name), content)
def install_distutils(home_dir):
distutils_path = change_prefix(distutils.__path__[0], home_dir)
mkdir(distutils_path)
## FIXME: maybe this prefix setting should only be put in place if
## there's a local distutils.cfg with a prefix setting?
home_dir = os.path.abspath(home_dir)
## FIXME: this is breaking things, removing for now:
#distutils_cfg = DISTUTILS_CFG + "\n[install]\nprefix=%s\n" % home_dir
writefile(os.path.join(distutils_path, '__init__.py'), DISTUTILS_INIT)
writefile(os.path.join(distutils_path, 'distutils.cfg'), DISTUTILS_CFG, overwrite=False)
def fix_local_scheme(home_dir):
"""
Platforms that use the "posix_local" install scheme (like Ubuntu with
Python 2.7) need to be given an additional "local" location, sigh.
"""
try:
import sysconfig
except ImportError:
pass
else:
if sysconfig._get_default_scheme() == 'posix_local':
local_path = os.path.join(home_dir, 'local')
if not os.path.exists(local_path):
os.mkdir(local_path)
for subdir_name in os.listdir(home_dir):
if subdir_name == 'local':
continue
os.symlink(os.path.abspath(os.path.join(home_dir, subdir_name)), \
os.path.join(local_path, subdir_name))
def fix_lib64(lib_dir):
"""
Some platforms (particularly Gentoo on x64) put things in lib64/pythonX.Y
instead of lib/pythonX.Y. If this is such a platform we'll just create a
symlink so lib64 points to lib
"""
if [p for p in distutils.sysconfig.get_config_vars().values()
if isinstance(p, basestring) and 'lib64' in p]:
logger.debug('This system uses lib64; symlinking lib64 to lib')
assert os.path.basename(lib_dir) == 'python%s' % sys.version[:3], (
"Unexpected python lib dir: %r" % lib_dir)
lib_parent = os.path.dirname(lib_dir)
top_level = os.path.dirname(lib_parent)
lib_dir = os.path.join(top_level, 'lib')
lib64_link = os.path.join(top_level, 'lib64')
assert os.path.basename(lib_parent) == 'lib', (
"Unexpected parent dir: %r" % lib_parent)
if os.path.lexists(lib64_link):
return
os.symlink('lib', lib64_link)
def resolve_interpreter(exe):
"""
If the executable given isn't an absolute path, search $PATH for the interpreter
"""
if os.path.abspath(exe) != exe:
paths = os.environ.get('PATH', '').split(os.pathsep)
for path in paths:
if os.path.exists(os.path.join(path, exe)):
exe = os.path.join(path, exe)
break
if not os.path.exists(exe):
logger.fatal('The executable %s (from --python=%s) does not exist' % (exe, exe))
raise SystemExit(3)
if not is_executable(exe):
logger.fatal('The executable %s (from --python=%s) is not executable' % (exe, exe))
raise SystemExit(3)
return exe
def is_executable(exe):
"""Checks a file is executable"""
return os.access(exe, os.X_OK)
############################################################
## Relocating the environment:
def make_environment_relocatable(home_dir):
"""
Makes the already-existing environment use relative paths, and takes out
the #!-based environment selection in scripts.
"""
home_dir, lib_dir, inc_dir, bin_dir = path_locations(home_dir)
activate_this = os.path.join(bin_dir, 'activate_this.py')
if not os.path.exists(activate_this):
logger.fatal(
'The environment doesn\'t have a file %s -- please re-run virtualenv '
'on this environment to update it' % activate_this)
fixup_scripts(home_dir)
fixup_pth_and_egg_link(home_dir)
## FIXME: need to fix up distutils.cfg
OK_ABS_SCRIPTS = ['python', 'python%s' % sys.version[:3],
'activate', 'activate.bat', 'activate_this.py']
def fixup_scripts(home_dir):
# This is what we expect at the top of scripts:
shebang = '#!%s/bin/python' % os.path.normcase(os.path.abspath(home_dir))
# This is what we'll put:
new_shebang = '#!/usr/bin/env python%s' % sys.version[:3]
if is_win:
bin_suffix = 'Scripts'
else:
bin_suffix = 'bin'
bin_dir = os.path.join(home_dir, bin_suffix)
home_dir, lib_dir, inc_dir, bin_dir = path_locations(home_dir)
for filename in os.listdir(bin_dir):
filename = os.path.join(bin_dir, filename)
if not os.path.isfile(filename):
# ignore subdirs, e.g. .svn ones.
continue
f = open(filename, 'rb')
try:
try:
lines = f.read().decode('utf-8').splitlines()
except UnicodeDecodeError:
# This is probably a binary program instead
# of a script, so just ignore it.
continue
finally:
f.close()
if not lines:
logger.warn('Script %s is an empty file' % filename)
continue
if not lines[0].strip().startswith(shebang):
if os.path.basename(filename) in OK_ABS_SCRIPTS:
logger.debug('Cannot make script %s relative' % filename)
elif lines[0].strip() == new_shebang:
logger.info('Script %s has already been made relative' % filename)
else:
logger.warn('Script %s cannot be made relative (it\'s not a normal script that starts with %s)'
% (filename, shebang))
continue
logger.notify('Making script %s relative' % filename)
script = relative_script([new_shebang] + lines[1:])
f = open(filename, 'wb')
f.write('\n'.join(script).encode('utf-8'))
f.close()
def relative_script(lines):
"Return a script that'll work in a relocatable environment."
activate = "import os; activate_this=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'activate_this.py'); execfile(activate_this, dict(__file__=activate_this)); del os, activate_this"
# Find the last future statement in the script. If we insert the activation
# line before a future statement, Python will raise a SyntaxError.
activate_at = None
for idx, line in reversed(list(enumerate(lines))):
if line.split()[:3] == ['from', '__future__', 'import']:
activate_at = idx + 1
break
if activate_at is None:
# Activate after the shebang.
activate_at = 1
return lines[:activate_at] + ['', activate, ''] + lines[activate_at:]
def fixup_pth_and_egg_link(home_dir, sys_path=None):
"""Makes .pth and .egg-link files use relative paths"""
home_dir = os.path.normcase(os.path.abspath(home_dir))
if sys_path is None:
sys_path = sys.path
for path in sys_path:
if not path:
path = '.'
if not os.path.isdir(path):
continue
path = os.path.normcase(os.path.abspath(path))
if not path.startswith(home_dir):
logger.debug('Skipping system (non-environment) directory %s' % path)
continue
for filename in os.listdir(path):
filename = os.path.join(path, filename)
if filename.endswith('.pth'):
if not os.access(filename, os.W_OK):
logger.warn('Cannot write .pth file %s, skipping' % filename)
else:
fixup_pth_file(filename)
if filename.endswith('.egg-link'):
if not os.access(filename, os.W_OK):
logger.warn('Cannot write .egg-link file %s, skipping' % filename)
else:
fixup_egg_link(filename)
def fixup_pth_file(filename):
lines = []
prev_lines = []
f = open(filename)
prev_lines = f.readlines()
f.close()
for line in prev_lines:
line = line.strip()
if (not line or line.startswith('#') or line.startswith('import ')
or os.path.abspath(line) != line):
lines.append(line)
else:
new_value = make_relative_path(filename, line)
if line != new_value:
logger.debug('Rewriting path %s as %s (in %s)' % (line, new_value, filename))
lines.append(new_value)
if lines == prev_lines:
logger.info('No changes to .pth file %s' % filename)
return
logger.notify('Making paths in .pth file %s relative' % filename)
f = open(filename, 'w')
f.write('\n'.join(lines) + '\n')
f.close()
def fixup_egg_link(filename):
f = open(filename)
link = f.readline().strip()
f.close()
if os.path.abspath(link) != link:
logger.debug('Link in %s already relative' % filename)
return
new_link = make_relative_path(filename, link)
logger.notify('Rewriting link %s in %s as %s' % (link, filename, new_link))
f = open(filename, 'w')
f.write(new_link)
f.close()
def make_relative_path(source, dest, dest_is_directory=True):
"""
Make a filename relative, where the filename is dest, and it is
being referred to from the filename source.
>>> make_relative_path('/usr/share/something/a-file.pth',
... '/usr/share/another-place/src/Directory')
'../another-place/src/Directory'
>>> make_relative_path('/usr/share/something/a-file.pth',
... '/home/user/src/Directory')
'../../../home/user/src/Directory'
>>> make_relative_path('/usr/share/a-file.pth', '/usr/share/')
'./'
"""
source = os.path.dirname(source)
if not dest_is_directory:
dest_filename = os.path.basename(dest)
dest = os.path.dirname(dest)
dest = os.path.normpath(os.path.abspath(dest))
source = os.path.normpath(os.path.abspath(source))
dest_parts = dest.strip(os.path.sep).split(os.path.sep)
source_parts = source.strip(os.path.sep).split(os.path.sep)
while dest_parts and source_parts and dest_parts[0] == source_parts[0]:
dest_parts.pop(0)
source_parts.pop(0)
full_parts = ['..']*len(source_parts) + dest_parts
if not dest_is_directory:
full_parts.append(dest_filename)
if not full_parts:
# Special case for the current directory (otherwise it'd be '')
return './'
return os.path.sep.join(full_parts)
############################################################
## Bootstrap script creation:
def create_bootstrap_script(extra_text, python_version=''):
"""
Creates a bootstrap script, which is like this script but with
extend_parser, adjust_options, and after_install hooks.
This returns a string that (written to disk of course) can be used
as a bootstrap script with your own customizations. The script
will be the standard virtualenv.py script, with your extra text
added (your extra text should be Python code).
If you include these functions, they will be called:
``extend_parser(optparse_parser)``:
You can add or remove options from the parser here.
``adjust_options(options, args)``:
You can change options here, or change the args (if you accept
different kinds of arguments, be sure you modify ``args`` so it is
only ``[DEST_DIR]``).
``after_install(options, home_dir)``:
After everything is installed, this function is called. This
is probably the function you are most likely to use. An
example would be::
def after_install(options, home_dir):
subprocess.call([join(home_dir, 'bin', 'easy_install'),
'MyPackage'])
subprocess.call([join(home_dir, 'bin', 'my-package-script'),
'setup', home_dir])
This example immediately installs a package, and runs a setup
script from that package.
If you provide something like ``python_version='2.5'`` then the
script will start with ``#!/usr/bin/env python2.5`` instead of
``#!/usr/bin/env python``. You can use this when the script must
be run with a particular Python version.
"""
filename = __file__
if filename.endswith('.pyc'):
filename = filename[:-1]
f = codecs.open(filename, 'r', encoding='utf-8')
content = f.read()
f.close()
py_exe = 'python%s' % python_version
content = (('#!/usr/bin/env %s\n' % py_exe)
+ '## WARNING: This file is generated\n'
+ content)
return content.replace('##EXT' 'END##', extra_text)
##EXTEND##
def convert(s):
b = base64.b64decode(s.encode('ascii'))
return zlib.decompress(b).decode('utf-8')
##file site.py
SITE_PY = convert("""
eJzFPf1z2zaWv/OvwMqToZTIdOK0vR2nzo2TOK3v3MTbpLO5dT1aSoIs1hTJEqRl7c3d337vAwAB
kpLtTXdO04klEnh4eHhfeHgPHQwGJ0Uhs7lY5fM6lULJuJwtRRFXSyUWeSmqZVLO94u4rDbwdHYT
X0slqlyojYqwVRQET7/yEzwVn5eJMijAt7iu8lVcJbM4TTciWRV5Wcm5mNdlkl2LJEuqJE6Tf0CL
PIvE06/HIDjLBMw8TWQpbmWpAK4S+UJcbKplnolhXeCcX0Tfxi9HY6FmZVJU0KDUOANFlnEVZFLO
AU1oWSsgZVLJfVXIWbJIZrbhOq/TuSjSeCbF3//OU6OmYRiofCXXS1lKkQEyAFMCrALxgK9JKWb5
XEZCvJGzGAfg5w2xAoY2xjVTSMYsF2meXcOcMjmTSsXlRgyndUWACGUxzwGnBDCokjQN1nl5o0aw
pLQea3gkYmYPfzLMHjBPHL/LOYDjxyz4JUvuxgwbuAfBVUtmm1IukjsRI1j4Ke/kbKKfDZOFmCeL
BdAgq0bYJGAElEiT6UFBy/G9XqHXB4SV5coYxpCIMjfml9QjCs4qEacK2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/UdJI2M
taFhedW0RC0Ar8bGHkiFaXALPc1SkILtl/P3Wf8rPu+z5bt//Xb3YvXbXLcnq/4Yo9/ucdETjI1C
rr9klRpCscBn8+skbRmxVhX/f7fRgk3dei/t1R3GMA3kC/20fojRFY82d0+bv3hsYkI27VGneg+A
GcxocdxuF7udStjdbtF9sJEqiVBT5/BrR5fD9u939h3eefkSYNWp0itfvdzpljubu6fqouaIi0y1
qL7+C1AkCcw=
""")
##file distribute_from_egg.py
DISTRIBUTE_FROM_EGG_PY = convert("""
eJw9j8tqAzEMRfcG/4MgmxQyptkGusonZBmGoGTUGYFfWPKE6dfXTkM3gqt7rh47OKP3NMF3SQFW
LlrRU1zhybpAxoKBlIqcrNnBdRjQP3GTocYfzmNrrCPQPN9iwzpxSQfQhWBi0cL3qtRtYIG/4Mv0
KApY5hooqrOGQ05FQTaxptF9Fnx16Rq0XofjaE1XGXVxHIWK7j8P8EY/rHndLqQ1a0pe3COFgHFy
hLLdWkDbi/DeEpCjNb3u/zccT2Ob8gtnwVyI
""")
##file distribute_setup.py
DISTRIBUTE_SETUP_PY = convert("""
eJztPGtz2ziS3/UrcHK5SOUkxs7MzV25TlOVmTizrs0mKdvZ/ZC4aIiEJI75GpC0ov311403SEp2
LrMfruq8O7ZENBqNfncDzMm/1ft2W5WT6XT6S1W1TctpTdIM/marrmUkK5uW5jltMwCaXK3JvurI
jpYtaSvSNYw0rO3qtqryBmBxlJOaJg90w4JGDkb1fk5+75oWAJK8Sxlpt1kzWWc5oocvgIQWDFbl
LGkrvie7rN2SrJ0TWqaEpqmYgAsibFvVpFrLlTT+i4vJhMDPmleFQ30sxklW1BVvkdrYUivg/Ufh
bLBDzv7ogCxCSVOzJFtnCXlkvAFmIA126hw/A1Ra7cq8oumkyDiv+JxUXHCJloTmLeMlBZ5qILvj
uVg0Aai0Ik1FVnvSdHWd77NyM8FN07rmVc0znF7VKAzBj/v7/g7u76PJ5BbZJfibiIURIyO8g88N
biXhWS22p6QrqKw3nKauPCN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CNblaFbMKCyvmX0PeRaQ=
""")
##file distutils.cfg
DISTUTILS_CFG = convert("""
eJxNj00KwkAMhfc9xYNuxe4Ft57AjYiUtDO1wXSmNJnK3N5pdSEEAu8nH6lxHVlRhtDHMPATA4uH
xJ4EFmGbvfJiicSHFRzUSISMY6hq3GLCRLnIvSTnEefN0FIjw5tF0Hkk9Q5dRunBsVoyFi24aaLg
9FDOlL0FPGluf4QjcInLlxd6f6rqkgPu/5nHLg0cXCscXoozRrP51DRT3j9QNl99AP53T2Q=
""")
##file activate_this.py
ACTIVATE_THIS = convert("""
eJyNU01v2zAMvetXEB4K21jmDOstQA4dMGCHbeihlyEIDMWmG62yJEiKE//7kXKdpN2KzYBt8euR
fKSyLPs8wiEo8wh4wqZTGou4V6Hm0wJa1cSiTkJdr8+GsoTRHuCotBayiWqQEYGtMCgfD1KjGYBe
5a3p0cRKiAe2NtLADikftnDco0ko/SFEVgEZ8aRC5GLux7i3BpSJ6J1H+i7A2CjiHq9z7JRZuuQq
siwTIvpxJYCeuWaBpwZdhB+yxy/eWz+ZvVSU8C4E9FFZkyxFsvCT/ZzL8gcz9aXVE14Yyp2M+2W0
y7n5mp0qN+avKXvbsyyzUqjeWR8hjGE+2iCE1W1tQ82hsCZN9UzlJr+/e/iab8WfqsmPI6pWeUPd
FrMsd4H/55poeO9n54COhUs+sZNEzNtg/wanpjpuqHJaxs76HtZryI/K3H7KJ/KDIhqcbJ7kI4ar
XL+sMgXnX0D+Te2Iy5xdP8yueSlQB/x/ED2BTAtyE3K4SYUN6AMNfbO63f4lBW3bUJPbTL+mjSxS
PyRfJkZRgj+VbFv+EzHFi5pKwUEepa4JslMnwkowSRCXI+m5XvEOvtuBrxHdhLalG0JofYBok6qj
YdN2dEngUlbC4PG60M1WEN0piu7Nq7on0mgyyUw3iV1etLo6r/81biWdQ9MWHFaePWZYaq+nmp+t
s3az+sj7eA0jfgPfeoN1
""")
MH_MAGIC = 0xfeedface
MH_CIGAM = 0xcefaedfe
MH_MAGIC_64 = 0xfeedfacf
MH_CIGAM_64 = 0xcffaedfe
FAT_MAGIC = 0xcafebabe
BIG_ENDIAN = '>'
LITTLE_ENDIAN = '<'
LC_LOAD_DYLIB = 0xc
maxint = majver == 3 and getattr(sys, 'maxsize') or getattr(sys, 'maxint')
class fileview(object):
"""
A proxy for file-like objects that exposes a given view of a file.
Modified from macholib.
"""
def __init__(self, fileobj, start=0, size=maxint):
if isinstance(fileobj, fileview):
self._fileobj = fileobj._fileobj
else:
self._fileobj = fileobj
self._start = start
self._end = start + size
self._pos = 0
def __repr__(self):
return '' % (
self._start, self._end, self._fileobj)
def tell(self):
return self._pos
def _checkwindow(self, seekto, op):
if not (self._start <= seekto <= self._end):
raise IOError("%s to offset %d is outside window [%d, %d]" % (
op, seekto, self._start, self._end))
def seek(self, offset, whence=0):
seekto = offset
if whence == os.SEEK_SET:
seekto += self._start
elif whence == os.SEEK_CUR:
seekto += self._start + self._pos
elif whence == os.SEEK_END:
seekto += self._end
else:
raise IOError("Invalid whence argument to seek: %r" % (whence,))
self._checkwindow(seekto, 'seek')
self._fileobj.seek(seekto)
self._pos = seekto - self._start
def write(self, bytes):
here = self._start + self._pos
self._checkwindow(here, 'write')
self._checkwindow(here + len(bytes), 'write')
self._fileobj.seek(here, os.SEEK_SET)
self._fileobj.write(bytes)
self._pos += len(bytes)
def read(self, size=maxint):
assert size >= 0
here = self._start + self._pos
self._checkwindow(here, 'read')
size = min(size, self._end - here)
self._fileobj.seek(here, os.SEEK_SET)
bytes = self._fileobj.read(size)
self._pos += len(bytes)
return bytes
def read_data(file, endian, num=1):
"""
Read a given number of 32-bits unsigned integers from the given file
with the given endianness.
"""
res = struct.unpack(endian + 'L' * num, file.read(num * 4))
if len(res) == 1:
return res[0]
return res
def mach_o_change(path, what, value):
"""
Replace a given name (what) in any LC_LOAD_DYLIB command found in
the given binary with a new name (value), provided it's shorter.
"""
def do_macho(file, bits, endian):
# Read Mach-O header (the magic number is assumed read by the caller)
cputype, cpusubtype, filetype, ncmds, sizeofcmds, flags = read_data(file, endian, 6)
# 64-bits header has one more field.
if bits == 64:
read_data(file, endian)
# The header is followed by ncmds commands
for n in range(ncmds):
where = file.tell()
# Read command header
cmd, cmdsize = read_data(file, endian, 2)
if cmd == LC_LOAD_DYLIB:
# The first data field in LC_LOAD_DYLIB commands is the
# offset of the name, starting from the beginning of the
# command.
name_offset = read_data(file, endian)
file.seek(where + name_offset, os.SEEK_SET)
# Read the NUL terminated string
load = file.read(cmdsize - name_offset).decode()
load = load[:load.index('\0')]
# If the string is what is being replaced, overwrite it.
if load == what:
file.seek(where + name_offset, os.SEEK_SET)
file.write(value.encode() + '\0'.encode())
# Seek to the next command
file.seek(where + cmdsize, os.SEEK_SET)
def do_file(file, offset=0, size=maxint):
file = fileview(file, offset, size)
# Read magic number
magic = read_data(file, BIG_ENDIAN)
if magic == FAT_MAGIC:
# Fat binaries contain nfat_arch Mach-O binaries
nfat_arch = read_data(file, BIG_ENDIAN)
for n in range(nfat_arch):
# Read arch header
cputype, cpusubtype, offset, size, align = read_data(file, BIG_ENDIAN, 5)
do_file(file, offset, size)
elif magic == MH_MAGIC:
do_macho(file, 32, BIG_ENDIAN)
elif magic == MH_CIGAM:
do_macho(file, 32, LITTLE_ENDIAN)
elif magic == MH_MAGIC_64:
do_macho(file, 64, BIG_ENDIAN)
elif magic == MH_CIGAM_64:
do_macho(file, 64, LITTLE_ENDIAN)
assert(len(what) >= len(value))
do_file(open(path, 'r+b'))
if __name__ == '__main__':
main()
## TODO:
## Copy python.exe.manifest
## Monkeypatch distutils.sysconfig
cxxtest-4.4/admin/virtualenv_1.7.py 0000775 0000000 0000000 00000261401 12343514423 0017321 0 ustar 00root root 0000000 0000000 #!/usr/bin/env python
"""Create a "virtual" Python installation
"""
# If you change the version here, change it in setup.py
# and docs/conf.py as well.
virtualenv_version = "1.7"
import base64
import sys
import os
import optparse
import re
import shutil
import logging
import tempfile
import zlib
import errno
import distutils.sysconfig
from distutils.util import strtobool
try:
import subprocess
except ImportError:
if sys.version_info <= (2, 3):
print('ERROR: %s' % sys.exc_info()[1])
print('ERROR: this script requires Python 2.4 or greater; or at least the subprocess module.')
print('If you copy subprocess.py from a newer version of Python this script will probably work')
sys.exit(101)
else:
raise
try:
set
except NameError:
from sets import Set as set
try:
basestring
except NameError:
basestring = str
try:
import ConfigParser
except ImportError:
import configparser as ConfigParser
join = os.path.join
py_version = 'python%s.%s' % (sys.version_info[0], sys.version_info[1])
is_jython = sys.platform.startswith('java')
is_pypy = hasattr(sys, 'pypy_version_info')
is_win = (sys.platform == 'win32')
abiflags = getattr(sys, 'abiflags', '')
user_dir = os.path.expanduser('~')
if sys.platform == 'win32':
user_dir = os.environ.get('APPDATA', user_dir) # Use %APPDATA% for roaming
default_storage_dir = os.path.join(user_dir, 'virtualenv')
else:
default_storage_dir = os.path.join(user_dir, '.virtualenv')
default_config_file = os.path.join(default_storage_dir, 'virtualenv.ini')
if is_pypy:
expected_exe = 'pypy'
elif is_jython:
expected_exe = 'jython'
else:
expected_exe = 'python'
REQUIRED_MODULES = ['os', 'posix', 'posixpath', 'nt', 'ntpath', 'genericpath',
'fnmatch', 'locale', 'encodings', 'codecs',
'stat', 'UserDict', 'readline', 'copy_reg', 'types',
're', 'sre', 'sre_parse', 'sre_constants', 'sre_compile',
'zlib']
REQUIRED_FILES = ['lib-dynload', 'config']
majver, minver = sys.version_info[:2]
if majver == 2:
if minver >= 6:
REQUIRED_MODULES.extend(['warnings', 'linecache', '_abcoll', 'abc'])
if minver >= 7:
REQUIRED_MODULES.extend(['_weakrefset'])
if minver <= 3:
REQUIRED_MODULES.extend(['sets', '__future__'])
elif majver == 3:
# Some extra modules are needed for Python 3, but different ones
# for different versions.
REQUIRED_MODULES.extend(['_abcoll', 'warnings', 'linecache', 'abc', 'io',
'_weakrefset', 'copyreg', 'tempfile', 'random',
'__future__', 'collections', 'keyword', 'tarfile',
'shutil', 'struct', 'copy'])
if minver >= 2:
REQUIRED_FILES[-1] = 'config-%s' % majver
if minver == 3:
# The whole list of 3.3 modules is reproduced below - the current
# uncommented ones are required for 3.3 as of now, but more may be
# added as 3.3 development continues.
REQUIRED_MODULES.extend([
#"aifc",
#"antigravity",
#"argparse",
#"ast",
#"asynchat",
#"asyncore",
"base64",
#"bdb",
#"binhex",
"bisect",
#"calendar",
#"cgi",
#"cgitb",
#"chunk",
#"cmd",
#"codeop",
#"code",
#"colorsys",
#"_compat_pickle",
#"compileall",
#"concurrent",
#"configparser",
#"contextlib",
#"cProfile",
#"crypt",
#"csv",
#"ctypes",
#"curses",
#"datetime",
#"dbm",
#"decimal",
#"difflib",
#"dis",
#"doctest",
#"dummy_threading",
"_dummy_thread",
#"email",
#"filecmp",
#"fileinput",
#"formatter",
#"fractions",
#"ftplib",
#"functools",
#"getopt",
#"getpass",
#"gettext",
#"glob",
#"gzip",
"hashlib",
"heapq",
"hmac",
#"html",
#"http",
#"idlelib",
#"imaplib",
#"imghdr",
#"importlib",
#"inspect",
#"json",
#"lib2to3",
#"logging",
#"macpath",
#"macurl2path",
#"mailbox",
#"mailcap",
#"_markupbase",
#"mimetypes",
#"modulefinder",
#"multiprocessing",
#"netrc",
#"nntplib",
#"nturl2path",
#"numbers",
#"opcode",
#"optparse",
#"os2emxpath",
#"pdb",
#"pickle",
#"pickletools",
#"pipes",
#"pkgutil",
#"platform",
#"plat-linux2",
#"plistlib",
#"poplib",
#"pprint",
#"profile",
#"pstats",
#"pty",
#"pyclbr",
#"py_compile",
#"pydoc_data",
#"pydoc",
#"_pyio",
#"queue",
#"quopri",
"reprlib",
"rlcompleter",
#"runpy",
#"sched",
#"shelve",
#"shlex",
#"smtpd",
#"smtplib",
#"sndhdr",
#"socket",
#"socketserver",
#"sqlite3",
#"ssl",
#"stringprep",
#"string",
#"_strptime",
#"subprocess",
#"sunau",
#"symbol",
#"symtable",
#"sysconfig",
#"tabnanny",
#"telnetlib",
#"test",
#"textwrap",
#"this",
#"_threading_local",
#"threading",
#"timeit",
#"tkinter",
#"tokenize",
#"token",
#"traceback",
#"trace",
#"tty",
#"turtledemo",
#"turtle",
#"unittest",
#"urllib",
#"uuid",
#"uu",
#"wave",
"weakref",
#"webbrowser",
#"wsgiref",
#"xdrlib",
#"xml",
#"xmlrpc",
#"zipfile",
])
if is_pypy:
# these are needed to correctly display the exceptions that may happen
# during the bootstrap
REQUIRED_MODULES.extend(['traceback', 'linecache'])
class Logger(object):
"""
Logging object for use in command-line script. Allows ranges of
levels, to avoid some redundancy of displayed information.
"""
DEBUG = logging.DEBUG
INFO = logging.INFO
NOTIFY = (logging.INFO+logging.WARN)/2
WARN = WARNING = logging.WARN
ERROR = logging.ERROR
FATAL = logging.FATAL
LEVELS = [DEBUG, INFO, NOTIFY, WARN, ERROR, FATAL]
def __init__(self, consumers):
self.consumers = consumers
self.indent = 0
self.in_progress = None
self.in_progress_hanging = False
def debug(self, msg, *args, **kw):
self.log(self.DEBUG, msg, *args, **kw)
def info(self, msg, *args, **kw):
self.log(self.INFO, msg, *args, **kw)
def notify(self, msg, *args, **kw):
self.log(self.NOTIFY, msg, *args, **kw)
def warn(self, msg, *args, **kw):
self.log(self.WARN, msg, *args, **kw)
def error(self, msg, *args, **kw):
self.log(self.WARN, msg, *args, **kw)
def fatal(self, msg, *args, **kw):
self.log(self.FATAL, msg, *args, **kw)
def log(self, level, msg, *args, **kw):
if args:
if kw:
raise TypeError(
"You may give positional or keyword arguments, not both")
args = args or kw
rendered = None
for consumer_level, consumer in self.consumers:
if self.level_matches(level, consumer_level):
if (self.in_progress_hanging
and consumer in (sys.stdout, sys.stderr)):
self.in_progress_hanging = False
sys.stdout.write('\n')
sys.stdout.flush()
if rendered is None:
if args:
rendered = msg % args
else:
rendered = msg
rendered = ' '*self.indent + rendered
if hasattr(consumer, 'write'):
consumer.write(rendered+'\n')
else:
consumer(rendered)
def start_progress(self, msg):
assert not self.in_progress, (
"Tried to start_progress(%r) while in_progress %r"
% (msg, self.in_progress))
if self.level_matches(self.NOTIFY, self._stdout_level()):
sys.stdout.write(msg)
sys.stdout.flush()
self.in_progress_hanging = True
else:
self.in_progress_hanging = False
self.in_progress = msg
def end_progress(self, msg='done.'):
assert self.in_progress, (
"Tried to end_progress without start_progress")
if self.stdout_level_matches(self.NOTIFY):
if not self.in_progress_hanging:
# Some message has been printed out since start_progress
sys.stdout.write('...' + self.in_progress + msg + '\n')
sys.stdout.flush()
else:
sys.stdout.write(msg + '\n')
sys.stdout.flush()
self.in_progress = None
self.in_progress_hanging = False
def show_progress(self):
"""If we are in a progress scope, and no log messages have been
shown, write out another '.'"""
if self.in_progress_hanging:
sys.stdout.write('.')
sys.stdout.flush()
def stdout_level_matches(self, level):
"""Returns true if a message at this level will go to stdout"""
return self.level_matches(level, self._stdout_level())
def _stdout_level(self):
"""Returns the level that stdout runs at"""
for level, consumer in self.consumers:
if consumer is sys.stdout:
return level
return self.FATAL
def level_matches(self, level, consumer_level):
"""
>>> l = Logger([])
>>> l.level_matches(3, 4)
False
>>> l.level_matches(3, 2)
True
>>> l.level_matches(slice(None, 3), 3)
False
>>> l.level_matches(slice(None, 3), 2)
True
>>> l.level_matches(slice(1, 3), 1)
True
>>> l.level_matches(slice(2, 3), 1)
False
"""
if isinstance(level, slice):
start, stop = level.start, level.stop
if start is not None and start > consumer_level:
return False
if stop is not None and stop <= consumer_level:
return False
return True
else:
return level >= consumer_level
#@classmethod
def level_for_integer(cls, level):
levels = cls.LEVELS
if level < 0:
return levels[0]
if level >= len(levels):
return levels[-1]
return levels[level]
level_for_integer = classmethod(level_for_integer)
# create a silent logger just to prevent this from being undefined
# will be overridden with requested verbosity main() is called.
logger = Logger([(Logger.LEVELS[-1], sys.stdout)])
def mkdir(path):
if not os.path.exists(path):
logger.info('Creating %s', path)
os.makedirs(path)
else:
logger.info('Directory %s already exists', path)
def copyfileordir(src, dest):
if os.path.isdir(src):
shutil.copytree(src, dest, True)
else:
shutil.copy2(src, dest)
def copyfile(src, dest, symlink=True):
if not os.path.exists(src):
# Some bad symlink in the src
logger.warn('Cannot find file %s (bad symlink)', src)
return
if os.path.exists(dest):
logger.debug('File %s already exists', dest)
return
if not os.path.exists(os.path.dirname(dest)):
logger.info('Creating parent directories for %s' % os.path.dirname(dest))
os.makedirs(os.path.dirname(dest))
if not os.path.islink(src):
srcpath = os.path.abspath(src)
else:
srcpath = os.readlink(src)
if symlink and hasattr(os, 'symlink'):
logger.info('Symlinking %s', dest)
try:
os.symlink(srcpath, dest)
except (OSError, NotImplementedError):
logger.info('Symlinking failed, copying to %s', dest)
copyfileordir(src, dest)
else:
logger.info('Copying to %s', dest)
copyfileordir(src, dest)
def writefile(dest, content, overwrite=True):
if not os.path.exists(dest):
logger.info('Writing %s', dest)
f = open(dest, 'wb')
f.write(content.encode('utf-8'))
f.close()
return
else:
f = open(dest, 'rb')
c = f.read()
f.close()
if c != content:
if not overwrite:
logger.notify('File %s exists with different content; not overwriting', dest)
return
logger.notify('Overwriting %s with new content', dest)
f = open(dest, 'wb')
f.write(content.encode('utf-8'))
f.close()
else:
logger.info('Content %s already in place', dest)
def rmtree(dir):
if os.path.exists(dir):
logger.notify('Deleting tree %s', dir)
shutil.rmtree(dir)
else:
logger.info('Do not need to delete %s; already gone', dir)
def make_exe(fn):
if hasattr(os, 'chmod'):
oldmode = os.stat(fn).st_mode & 0xFFF # 0o7777
newmode = (oldmode | 0x16D) & 0xFFF # 0o555, 0o7777
os.chmod(fn, newmode)
logger.info('Changed mode of %s to %s', fn, oct(newmode))
def _find_file(filename, dirs):
for dir in dirs:
if os.path.exists(join(dir, filename)):
return join(dir, filename)
return filename
def _install_req(py_executable, unzip=False, distribute=False,
search_dirs=None, never_download=False):
if search_dirs is None:
search_dirs = file_search_dirs()
if not distribute:
setup_fn = 'setuptools-0.6c11-py%s.egg' % sys.version[:3]
project_name = 'setuptools'
bootstrap_script = EZ_SETUP_PY
source = None
else:
setup_fn = None
source = 'distribute-0.6.24.tar.gz'
project_name = 'distribute'
bootstrap_script = DISTRIBUTE_SETUP_PY
if setup_fn is not None:
setup_fn = _find_file(setup_fn, search_dirs)
if source is not None:
source = _find_file(source, search_dirs)
if is_jython and os._name == 'nt':
# Jython's .bat sys.executable can't handle a command line
# argument with newlines
fd, ez_setup = tempfile.mkstemp('.py')
os.write(fd, bootstrap_script)
os.close(fd)
cmd = [py_executable, ez_setup]
else:
cmd = [py_executable, '-c', bootstrap_script]
if unzip:
cmd.append('--always-unzip')
env = {}
remove_from_env = []
if logger.stdout_level_matches(logger.DEBUG):
cmd.append('-v')
old_chdir = os.getcwd()
if setup_fn is not None and os.path.exists(setup_fn):
logger.info('Using existing %s egg: %s' % (project_name, setup_fn))
cmd.append(setup_fn)
if os.environ.get('PYTHONPATH'):
env['PYTHONPATH'] = setup_fn + os.path.pathsep + os.environ['PYTHONPATH']
else:
env['PYTHONPATH'] = setup_fn
else:
# the source is found, let's chdir
if source is not None and os.path.exists(source):
logger.info('Using existing %s egg: %s' % (project_name, source))
os.chdir(os.path.dirname(source))
# in this case, we want to be sure that PYTHONPATH is unset (not
# just empty, really unset), else CPython tries to import the
# site.py that it's in virtualenv_support
remove_from_env.append('PYTHONPATH')
else:
if never_download:
logger.fatal("Can't find any local distributions of %s to install "
"and --never-download is set. Either re-run virtualenv "
"without the --never-download option, or place a %s "
"distribution (%s) in one of these "
"locations: %r" % (project_name, project_name,
setup_fn or source,
search_dirs))
sys.exit(1)
logger.info('No %s egg found; downloading' % project_name)
cmd.extend(['--always-copy', '-U', project_name])
logger.start_progress('Installing %s...' % project_name)
logger.indent += 2
cwd = None
if project_name == 'distribute':
env['DONT_PATCH_SETUPTOOLS'] = 'true'
def _filter_ez_setup(line):
return filter_ez_setup(line, project_name)
if not os.access(os.getcwd(), os.W_OK):
cwd = tempfile.mkdtemp()
if source is not None and os.path.exists(source):
# the current working dir is hostile, let's copy the
# tarball to a temp dir
target = os.path.join(cwd, os.path.split(source)[-1])
shutil.copy(source, target)
try:
call_subprocess(cmd, show_stdout=False,
filter_stdout=_filter_ez_setup,
extra_env=env,
remove_from_env=remove_from_env,
cwd=cwd)
finally:
logger.indent -= 2
logger.end_progress()
if os.getcwd() != old_chdir:
os.chdir(old_chdir)
if is_jython and os._name == 'nt':
os.remove(ez_setup)
def file_search_dirs():
here = os.path.dirname(os.path.abspath(__file__))
dirs = ['.', here,
join(here, 'virtualenv_support')]
if os.path.splitext(os.path.dirname(__file__))[0] != 'virtualenv':
# Probably some boot script; just in case virtualenv is installed...
try:
import virtualenv
except ImportError:
pass
else:
dirs.append(os.path.join(os.path.dirname(virtualenv.__file__), 'virtualenv_support'))
return [d for d in dirs if os.path.isdir(d)]
def install_setuptools(py_executable, unzip=False,
search_dirs=None, never_download=False):
_install_req(py_executable, unzip,
search_dirs=search_dirs, never_download=never_download)
def install_distribute(py_executable, unzip=False,
search_dirs=None, never_download=False):
_install_req(py_executable, unzip, distribute=True,
search_dirs=search_dirs, never_download=never_download)
_pip_re = re.compile(r'^pip-.*(zip|tar.gz|tar.bz2|tgz|tbz)$', re.I)
def install_pip(py_executable, search_dirs=None, never_download=False):
if search_dirs is None:
search_dirs = file_search_dirs()
filenames = []
for dir in search_dirs:
filenames.extend([join(dir, fn) for fn in os.listdir(dir)
if _pip_re.search(fn)])
filenames = [(os.path.basename(filename).lower(), i, filename) for i, filename in enumerate(filenames)]
filenames.sort()
filenames = [filename for basename, i, filename in filenames]
if not filenames:
filename = 'pip'
else:
filename = filenames[-1]
easy_install_script = 'easy_install'
if sys.platform == 'win32':
easy_install_script = 'easy_install-script.py'
cmd = [join(os.path.dirname(py_executable), easy_install_script), filename]
if sys.platform == 'win32':
cmd.insert(0, py_executable)
if filename == 'pip':
if never_download:
logger.fatal("Can't find any local distributions of pip to install "
"and --never-download is set. Either re-run virtualenv "
"without the --never-download option, or place a pip "
"source distribution (zip/tar.gz/tar.bz2) in one of these "
"locations: %r" % search_dirs)
sys.exit(1)
logger.info('Installing pip from network...')
else:
logger.info('Installing existing %s distribution: %s' % (
os.path.basename(filename), filename))
logger.start_progress('Installing pip...')
logger.indent += 2
def _filter_setup(line):
return filter_ez_setup(line, 'pip')
try:
call_subprocess(cmd, show_stdout=False,
filter_stdout=_filter_setup)
finally:
logger.indent -= 2
logger.end_progress()
def filter_ez_setup(line, project_name='setuptools'):
if not line.strip():
return Logger.DEBUG
if project_name == 'distribute':
for prefix in ('Extracting', 'Now working', 'Installing', 'Before',
'Scanning', 'Setuptools', 'Egg', 'Already',
'running', 'writing', 'reading', 'installing',
'creating', 'copying', 'byte-compiling', 'removing',
'Processing'):
if line.startswith(prefix):
return Logger.DEBUG
return Logger.DEBUG
for prefix in ['Reading ', 'Best match', 'Processing setuptools',
'Copying setuptools', 'Adding setuptools',
'Installing ', 'Installed ']:
if line.startswith(prefix):
return Logger.DEBUG
return Logger.INFO
class UpdatingDefaultsHelpFormatter(optparse.IndentedHelpFormatter):
"""
Custom help formatter for use in ConfigOptionParser that updates
the defaults before expanding them, allowing them to show up correctly
in the help listing
"""
def expand_default(self, option):
if self.parser is not None:
self.parser.update_defaults(self.parser.defaults)
return optparse.IndentedHelpFormatter.expand_default(self, option)
class ConfigOptionParser(optparse.OptionParser):
"""
Custom option parser which updates its defaults by by checking the
configuration files and environmental variables
"""
def __init__(self, *args, **kwargs):
self.config = ConfigParser.RawConfigParser()
self.files = self.get_config_files()
self.config.read(self.files)
optparse.OptionParser.__init__(self, *args, **kwargs)
def get_config_files(self):
config_file = os.environ.get('VIRTUALENV_CONFIG_FILE', False)
if config_file and os.path.exists(config_file):
return [config_file]
return [default_config_file]
def update_defaults(self, defaults):
"""
Updates the given defaults with values from the config files and
the environ. Does a little special handling for certain types of
options (lists).
"""
# Then go and look for the other sources of configuration:
config = {}
# 1. config files
config.update(dict(self.get_config_section('virtualenv')))
# 2. environmental variables
config.update(dict(self.get_environ_vars()))
# Then set the options with those values
for key, val in config.items():
key = key.replace('_', '-')
if not key.startswith('--'):
key = '--%s' % key # only prefer long opts
option = self.get_option(key)
if option is not None:
# ignore empty values
if not val:
continue
# handle multiline configs
if option.action == 'append':
val = val.split()
else:
option.nargs = 1
if option.action in ('store_true', 'store_false', 'count'):
val = strtobool(val)
try:
val = option.convert_value(key, val)
except optparse.OptionValueError:
e = sys.exc_info()[1]
print("An error occured during configuration: %s" % e)
sys.exit(3)
defaults[option.dest] = val
return defaults
def get_config_section(self, name):
"""
Get a section of a configuration
"""
if self.config.has_section(name):
return self.config.items(name)
return []
def get_environ_vars(self, prefix='VIRTUALENV_'):
"""
Returns a generator with all environmental vars with prefix VIRTUALENV
"""
for key, val in os.environ.items():
if key.startswith(prefix):
yield (key.replace(prefix, '').lower(), val)
def get_default_values(self):
"""
Overridding to make updating the defaults after instantiation of
the option parser possible, update_defaults() does the dirty work.
"""
if not self.process_default_values:
# Old, pre-Optik 1.5 behaviour.
return optparse.Values(self.defaults)
defaults = self.update_defaults(self.defaults.copy()) # ours
for option in self._get_all_options():
default = defaults.get(option.dest)
if isinstance(default, basestring):
opt_str = option.get_opt_string()
defaults[option.dest] = option.check_value(opt_str, default)
return optparse.Values(defaults)
def main():
parser = ConfigOptionParser(
version=virtualenv_version,
usage="%prog [OPTIONS] DEST_DIR",
formatter=UpdatingDefaultsHelpFormatter())
parser.add_option(
'-v', '--verbose',
action='count',
dest='verbose',
default=0,
help="Increase verbosity")
parser.add_option(
'-q', '--quiet',
action='count',
dest='quiet',
default=0,
help='Decrease verbosity')
parser.add_option(
'-p', '--python',
dest='python',
metavar='PYTHON_EXE',
help='The Python interpreter to use, e.g., --python=python2.5 will use the python2.5 '
'interpreter to create the new environment. The default is the interpreter that '
'virtualenv was installed with (%s)' % sys.executable)
parser.add_option(
'--clear',
dest='clear',
action='store_true',
help="Clear out the non-root install and start from scratch")
parser.add_option(
'--no-site-packages',
dest='no_site_packages',
action='store_true',
help="Don't give access to the global site-packages dir to the "
"virtual environment")
parser.add_option(
'--system-site-packages',
dest='system_site_packages',
action='store_true',
help="Give access to the global site-packages dir to the "
"virtual environment")
parser.add_option(
'--unzip-setuptools',
dest='unzip_setuptools',
action='store_true',
help="Unzip Setuptools or Distribute when installing it")
parser.add_option(
'--relocatable',
dest='relocatable',
action='store_true',
help='Make an EXISTING virtualenv environment relocatable. '
'This fixes up scripts and makes all .pth files relative')
parser.add_option(
'--distribute',
dest='use_distribute',
action='store_true',
help='Use Distribute instead of Setuptools. Set environ variable '
'VIRTUALENV_DISTRIBUTE to make it the default ')
default_search_dirs = file_search_dirs()
parser.add_option(
'--extra-search-dir',
dest="search_dirs",
action="append",
default=default_search_dirs,
help="Directory to look for setuptools/distribute/pip distributions in. "
"You can add any number of additional --extra-search-dir paths.")
parser.add_option(
'--never-download',
dest="never_download",
action="store_true",
help="Never download anything from the network. Instead, virtualenv will fail "
"if local distributions of setuptools/distribute/pip are not present.")
parser.add_option(
'--prompt=',
dest='prompt',
help='Provides an alternative prompt prefix for this environment')
if 'extend_parser' in globals():
extend_parser(parser)
options, args = parser.parse_args()
global logger
if 'adjust_options' in globals():
adjust_options(options, args)
verbosity = options.verbose - options.quiet
logger = Logger([(Logger.level_for_integer(2-verbosity), sys.stdout)])
if options.python and not os.environ.get('VIRTUALENV_INTERPRETER_RUNNING'):
env = os.environ.copy()
interpreter = resolve_interpreter(options.python)
if interpreter == sys.executable:
logger.warn('Already using interpreter %s' % interpreter)
else:
logger.notify('Running virtualenv with interpreter %s' % interpreter)
env['VIRTUALENV_INTERPRETER_RUNNING'] = 'true'
file = __file__
if file.endswith('.pyc'):
file = file[:-1]
popen = subprocess.Popen([interpreter, file] + sys.argv[1:], env=env)
raise SystemExit(popen.wait())
# Force --use-distribute on Python 3, since setuptools is not available.
if majver > 2:
options.use_distribute = True
if os.environ.get('PYTHONDONTWRITEBYTECODE') and not options.use_distribute:
print(
"The PYTHONDONTWRITEBYTECODE environment variable is "
"not compatible with setuptools. Either use --distribute "
"or unset PYTHONDONTWRITEBYTECODE.")
sys.exit(2)
if not args:
print('You must provide a DEST_DIR')
parser.print_help()
sys.exit(2)
if len(args) > 1:
print('There must be only one argument: DEST_DIR (you gave %s)' % (
' '.join(args)))
parser.print_help()
sys.exit(2)
home_dir = args[0]
if os.environ.get('WORKING_ENV'):
logger.fatal('ERROR: you cannot run virtualenv while in a workingenv')
logger.fatal('Please deactivate your workingenv, then re-run this script')
sys.exit(3)
if 'PYTHONHOME' in os.environ:
logger.warn('PYTHONHOME is set. You *must* activate the virtualenv before using it')
del os.environ['PYTHONHOME']
if options.relocatable:
make_environment_relocatable(home_dir)
return
if options.no_site_packages:
logger.warn('The --no-site-packages flag is deprecated; it is now '
'the default behavior.')
create_environment(home_dir,
site_packages=options.system_site_packages,
clear=options.clear,
unzip_setuptools=options.unzip_setuptools,
use_distribute=options.use_distribute,
prompt=options.prompt,
search_dirs=options.search_dirs,
never_download=options.never_download)
if 'after_install' in globals():
after_install(options, home_dir)
def call_subprocess(cmd, show_stdout=True,
filter_stdout=None, cwd=None,
raise_on_returncode=True, extra_env=None,
remove_from_env=None):
cmd_parts = []
for part in cmd:
if len(part) > 45:
part = part[:20]+"..."+part[-20:]
if ' ' in part or '\n' in part or '"' in part or "'" in part:
part = '"%s"' % part.replace('"', '\\"')
if hasattr(part, 'decode'):
try:
part = part.decode(sys.getdefaultencoding())
except UnicodeDecodeError:
part = part.decode(sys.getfilesystemencoding())
cmd_parts.append(part)
cmd_desc = ' '.join(cmd_parts)
if show_stdout:
stdout = None
else:
stdout = subprocess.PIPE
logger.debug("Running command %s" % cmd_desc)
if extra_env or remove_from_env:
env = os.environ.copy()
if extra_env:
env.update(extra_env)
if remove_from_env:
for varname in remove_from_env:
env.pop(varname, None)
else:
env = None
try:
proc = subprocess.Popen(
cmd, stderr=subprocess.STDOUT, stdin=None, stdout=stdout,
cwd=cwd, env=env)
except Exception:
e = sys.exc_info()[1]
logger.fatal(
"Error %s while executing command %s" % (e, cmd_desc))
raise
all_output = []
if stdout is not None:
stdout = proc.stdout
encoding = sys.getdefaultencoding()
fs_encoding = sys.getfilesystemencoding()
while 1:
line = stdout.readline()
try:
line = line.decode(encoding)
except UnicodeDecodeError:
line = line.decode(fs_encoding)
if not line:
break
line = line.rstrip()
all_output.append(line)
if filter_stdout:
level = filter_stdout(line)
if isinstance(level, tuple):
level, line = level
logger.log(level, line)
if not logger.stdout_level_matches(level):
logger.show_progress()
else:
logger.info(line)
else:
proc.communicate()
proc.wait()
if proc.returncode:
if raise_on_returncode:
if all_output:
logger.notify('Complete output from command %s:' % cmd_desc)
logger.notify('\n'.join(all_output) + '\n----------------------------------------')
raise OSError(
"Command %s failed with error code %s"
% (cmd_desc, proc.returncode))
else:
logger.warn(
"Command %s had error code %s"
% (cmd_desc, proc.returncode))
def create_environment(home_dir, site_packages=False, clear=False,
unzip_setuptools=False, use_distribute=False,
prompt=None, search_dirs=None, never_download=False):
"""
Creates a new environment in ``home_dir``.
If ``site_packages`` is true, then the global ``site-packages/``
directory will be on the path.
If ``clear`` is true (default False) then the environment will
first be cleared.
"""
home_dir, lib_dir, inc_dir, bin_dir = path_locations(home_dir)
py_executable = os.path.abspath(install_python(
home_dir, lib_dir, inc_dir, bin_dir,
site_packages=site_packages, clear=clear))
install_distutils(home_dir)
# use_distribute also is True if VIRTUALENV_DISTRIBUTE env var is set
# we also check VIRTUALENV_USE_DISTRIBUTE for backwards compatibility
if use_distribute or os.environ.get('VIRTUALENV_USE_DISTRIBUTE'):
install_distribute(py_executable, unzip=unzip_setuptools,
search_dirs=search_dirs, never_download=never_download)
else:
install_setuptools(py_executable, unzip=unzip_setuptools,
search_dirs=search_dirs, never_download=never_download)
install_pip(py_executable, search_dirs=search_dirs, never_download=never_download)
install_activate(home_dir, bin_dir, prompt)
def path_locations(home_dir):
"""Return the path locations for the environment (where libraries are,
where scripts go, etc)"""
# XXX: We'd use distutils.sysconfig.get_python_inc/lib but its
# prefix arg is broken: http://bugs.python.org/issue3386
if sys.platform == 'win32':
# Windows has lots of problems with executables with spaces in
# the name; this function will remove them (using the ~1
# format):
mkdir(home_dir)
if ' ' in home_dir:
try:
import win32api
except ImportError:
print('Error: the path "%s" has a space in it' % home_dir)
print('To handle these kinds of paths, the win32api module must be installed:')
print(' http://sourceforge.net/projects/pywin32/')
sys.exit(3)
home_dir = win32api.GetShortPathName(home_dir)
lib_dir = join(home_dir, 'Lib')
inc_dir = join(home_dir, 'Include')
bin_dir = join(home_dir, 'Scripts')
elif is_jython:
lib_dir = join(home_dir, 'Lib')
inc_dir = join(home_dir, 'Include')
bin_dir = join(home_dir, 'bin')
elif is_pypy:
lib_dir = home_dir
inc_dir = join(home_dir, 'include')
bin_dir = join(home_dir, 'bin')
else:
lib_dir = join(home_dir, 'lib', py_version)
inc_dir = join(home_dir, 'include', py_version + abiflags)
bin_dir = join(home_dir, 'bin')
return home_dir, lib_dir, inc_dir, bin_dir
def change_prefix(filename, dst_prefix):
prefixes = [sys.prefix]
if sys.platform == "darwin":
prefixes.extend((
os.path.join("/Library/Python", sys.version[:3], "site-packages"),
os.path.join(sys.prefix, "Extras", "lib", "python"),
os.path.join("~", "Library", "Python", sys.version[:3], "site-packages")))
if hasattr(sys, 'real_prefix'):
prefixes.append(sys.real_prefix)
prefixes = list(map(os.path.abspath, prefixes))
filename = os.path.abspath(filename)
for src_prefix in prefixes:
if filename.startswith(src_prefix):
_, relpath = filename.split(src_prefix, 1)
assert relpath[0] == os.sep
relpath = relpath[1:]
return join(dst_prefix, relpath)
assert False, "Filename %s does not start with any of these prefixes: %s" % \
(filename, prefixes)
def copy_required_modules(dst_prefix):
import imp
for modname in REQUIRED_MODULES:
if modname in sys.builtin_module_names:
logger.info("Ignoring built-in bootstrap module: %s" % modname)
continue
try:
f, filename, _ = imp.find_module(modname)
except ImportError:
logger.info("Cannot import bootstrap module: %s" % modname)
else:
if f is not None:
f.close()
dst_filename = change_prefix(filename, dst_prefix)
copyfile(filename, dst_filename)
if filename.endswith('.pyc'):
pyfile = filename[:-1]
if os.path.exists(pyfile):
copyfile(pyfile, dst_filename[:-1])
def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear):
"""Install just the base environment, no distutils patches etc"""
if sys.executable.startswith(bin_dir):
print('Please use the *system* python to run this script')
return
if clear:
rmtree(lib_dir)
## FIXME: why not delete it?
## Maybe it should delete everything with #!/path/to/venv/python in it
logger.notify('Not deleting %s', bin_dir)
if hasattr(sys, 'real_prefix'):
logger.notify('Using real prefix %r' % sys.real_prefix)
prefix = sys.real_prefix
else:
prefix = sys.prefix
mkdir(lib_dir)
fix_lib64(lib_dir)
fix_local_scheme(home_dir)
stdlib_dirs = [os.path.dirname(os.__file__)]
if sys.platform == 'win32':
stdlib_dirs.append(join(os.path.dirname(stdlib_dirs[0]), 'DLLs'))
elif sys.platform == 'darwin':
stdlib_dirs.append(join(stdlib_dirs[0], 'site-packages'))
if hasattr(os, 'symlink'):
logger.info('Symlinking Python bootstrap modules')
else:
logger.info('Copying Python bootstrap modules')
logger.indent += 2
try:
# copy required files...
for stdlib_dir in stdlib_dirs:
if not os.path.isdir(stdlib_dir):
continue
for fn in os.listdir(stdlib_dir):
bn = os.path.splitext(fn)[0]
if fn != 'site-packages' and bn in REQUIRED_FILES:
copyfile(join(stdlib_dir, fn), join(lib_dir, fn))
# ...and modules
copy_required_modules(home_dir)
finally:
logger.indent -= 2
mkdir(join(lib_dir, 'site-packages'))
import site
site_filename = site.__file__
if site_filename.endswith('.pyc'):
site_filename = site_filename[:-1]
elif site_filename.endswith('$py.class'):
site_filename = site_filename.replace('$py.class', '.py')
site_filename_dst = change_prefix(site_filename, home_dir)
site_dir = os.path.dirname(site_filename_dst)
writefile(site_filename_dst, SITE_PY)
writefile(join(site_dir, 'orig-prefix.txt'), prefix)
site_packages_filename = join(site_dir, 'no-global-site-packages.txt')
if not site_packages:
writefile(site_packages_filename, '')
else:
if os.path.exists(site_packages_filename):
logger.info('Deleting %s' % site_packages_filename)
os.unlink(site_packages_filename)
if is_pypy or is_win:
stdinc_dir = join(prefix, 'include')
else:
stdinc_dir = join(prefix, 'include', py_version + abiflags)
if os.path.exists(stdinc_dir):
copyfile(stdinc_dir, inc_dir)
else:
logger.debug('No include dir %s' % stdinc_dir)
# pypy never uses exec_prefix, just ignore it
if sys.exec_prefix != prefix and not is_pypy:
if sys.platform == 'win32':
exec_dir = join(sys.exec_prefix, 'lib')
elif is_jython:
exec_dir = join(sys.exec_prefix, 'Lib')
else:
exec_dir = join(sys.exec_prefix, 'lib', py_version)
for fn in os.listdir(exec_dir):
copyfile(join(exec_dir, fn), join(lib_dir, fn))
if is_jython:
# Jython has either jython-dev.jar and javalib/ dir, or just
# jython.jar
for name in 'jython-dev.jar', 'javalib', 'jython.jar':
src = join(prefix, name)
if os.path.exists(src):
copyfile(src, join(home_dir, name))
# XXX: registry should always exist after Jython 2.5rc1
src = join(prefix, 'registry')
if os.path.exists(src):
copyfile(src, join(home_dir, 'registry'), symlink=False)
copyfile(join(prefix, 'cachedir'), join(home_dir, 'cachedir'),
symlink=False)
mkdir(bin_dir)
py_executable = join(bin_dir, os.path.basename(sys.executable))
if 'Python.framework' in prefix:
if re.search(r'/Python(?:-32|-64)*$', py_executable):
# The name of the python executable is not quite what
# we want, rename it.
py_executable = os.path.join(
os.path.dirname(py_executable), 'python')
logger.notify('New %s executable in %s', expected_exe, py_executable)
if sys.executable != py_executable:
## FIXME: could I just hard link?
executable = sys.executable
if sys.platform == 'cygwin' and os.path.exists(executable + '.exe'):
# Cygwin misreports sys.executable sometimes
executable += '.exe'
py_executable += '.exe'
logger.info('Executable actually exists in %s' % executable)
shutil.copyfile(executable, py_executable)
make_exe(py_executable)
if sys.platform == 'win32' or sys.platform == 'cygwin':
pythonw = os.path.join(os.path.dirname(sys.executable), 'pythonw.exe')
if os.path.exists(pythonw):
logger.info('Also created pythonw.exe')
shutil.copyfile(pythonw, os.path.join(os.path.dirname(py_executable), 'pythonw.exe'))
if is_pypy:
# make a symlink python --> pypy-c
python_executable = os.path.join(os.path.dirname(py_executable), 'python')
logger.info('Also created executable %s' % python_executable)
copyfile(py_executable, python_executable)
if os.path.splitext(os.path.basename(py_executable))[0] != expected_exe:
secondary_exe = os.path.join(os.path.dirname(py_executable),
expected_exe)
py_executable_ext = os.path.splitext(py_executable)[1]
if py_executable_ext == '.exe':
# python2.4 gives an extension of '.4' :P
secondary_exe += py_executable_ext
if os.path.exists(secondary_exe):
logger.warn('Not overwriting existing %s script %s (you must use %s)'
% (expected_exe, secondary_exe, py_executable))
else:
logger.notify('Also creating executable in %s' % secondary_exe)
shutil.copyfile(sys.executable, secondary_exe)
make_exe(secondary_exe)
if 'Python.framework' in prefix:
logger.debug('MacOSX Python framework detected')
# Make sure we use the the embedded interpreter inside
# the framework, even if sys.executable points to
# the stub executable in ${sys.prefix}/bin
# See http://groups.google.com/group/python-virtualenv/
# browse_thread/thread/17cab2f85da75951
original_python = os.path.join(
prefix, 'Resources/Python.app/Contents/MacOS/Python')
shutil.copy(original_python, py_executable)
# Copy the framework's dylib into the virtual
# environment
virtual_lib = os.path.join(home_dir, '.Python')
if os.path.exists(virtual_lib):
os.unlink(virtual_lib)
copyfile(
os.path.join(prefix, 'Python'),
virtual_lib)
# And then change the install_name of the copied python executable
try:
call_subprocess(
["install_name_tool", "-change",
os.path.join(prefix, 'Python'),
'@executable_path/../.Python',
py_executable])
except:
logger.fatal(
"Could not call install_name_tool -- you must have Apple's development tools installed")
raise
# Some tools depend on pythonX.Y being present
py_executable_version = '%s.%s' % (
sys.version_info[0], sys.version_info[1])
if not py_executable.endswith(py_executable_version):
# symlinking pythonX.Y > python
pth = py_executable + '%s.%s' % (
sys.version_info[0], sys.version_info[1])
if os.path.exists(pth):
os.unlink(pth)
os.symlink('python', pth)
else:
# reverse symlinking python -> pythonX.Y (with --python)
pth = join(bin_dir, 'python')
if os.path.exists(pth):
os.unlink(pth)
os.symlink(os.path.basename(py_executable), pth)
if sys.platform == 'win32' and ' ' in py_executable:
# There's a bug with subprocess on Windows when using a first
# argument that has a space in it. Instead we have to quote
# the value:
py_executable = '"%s"' % py_executable
cmd = [py_executable, '-c', """
import sys
prefix = sys.prefix
if sys.version_info[0] == 3:
prefix = prefix.encode('utf8')
if hasattr(sys.stdout, 'detach'):
sys.stdout = sys.stdout.detach()
elif hasattr(sys.stdout, 'buffer'):
sys.stdout = sys.stdout.buffer
sys.stdout.write(prefix)
"""]
logger.info('Testing executable with %s %s "%s"' % tuple(cmd))
try:
proc = subprocess.Popen(cmd,
stdout=subprocess.PIPE)
proc_stdout, proc_stderr = proc.communicate()
except OSError:
e = sys.exc_info()[1]
if e.errno == errno.EACCES:
logger.fatal('ERROR: The executable %s could not be run: %s' % (py_executable, e))
sys.exit(100)
else:
raise e
proc_stdout = proc_stdout.strip().decode("utf-8")
proc_stdout = os.path.normcase(os.path.abspath(proc_stdout))
norm_home_dir = os.path.normcase(os.path.abspath(home_dir))
if hasattr(norm_home_dir, 'decode'):
norm_home_dir = norm_home_dir.decode(sys.getfilesystemencoding())
if proc_stdout != norm_home_dir:
logger.fatal(
'ERROR: The executable %s is not functioning' % py_executable)
logger.fatal(
'ERROR: It thinks sys.prefix is %r (should be %r)'
% (proc_stdout, norm_home_dir))
logger.fatal(
'ERROR: virtualenv is not compatible with this system or executable')
if sys.platform == 'win32':
logger.fatal(
'Note: some Windows users have reported this error when they installed Python for "Only this user". The problem may be resolvable if you install Python "For all users". (See https://bugs.launchpad.net/virtualenv/+bug/352844)')
sys.exit(100)
else:
logger.info('Got sys.prefix result: %r' % proc_stdout)
pydistutils = os.path.expanduser('~/.pydistutils.cfg')
if os.path.exists(pydistutils):
logger.notify('Please make sure you remove any previous custom paths from '
'your %s file.' % pydistutils)
## FIXME: really this should be calculated earlier
return py_executable
def install_activate(home_dir, bin_dir, prompt=None):
if sys.platform == 'win32' or is_jython and os._name == 'nt':
files = {'activate.bat': ACTIVATE_BAT,
'deactivate.bat': DEACTIVATE_BAT}
if os.environ.get('OS') == 'Windows_NT' and os.environ.get('OSTYPE') == 'cygwin':
files['activate'] = ACTIVATE_SH
else:
files = {'activate': ACTIVATE_SH}
# suppling activate.fish in addition to, not instead of, the
# bash script support.
files['activate.fish'] = ACTIVATE_FISH
# same for csh/tcsh support...
files['activate.csh'] = ACTIVATE_CSH
files['activate_this.py'] = ACTIVATE_THIS
home_dir = os.path.abspath(home_dir)
if hasattr(home_dir, 'decode'):
home_dir = home_dir.decode(sys.getfilesystemencoding())
vname = os.path.basename(home_dir)
for name, content in files.items():
content = content.replace('__VIRTUAL_PROMPT__', prompt or '')
content = content.replace('__VIRTUAL_WINPROMPT__', prompt or '(%s)' % vname)
content = content.replace('__VIRTUAL_ENV__', home_dir)
content = content.replace('__VIRTUAL_NAME__', vname)
content = content.replace('__BIN_NAME__', os.path.basename(bin_dir))
writefile(os.path.join(bin_dir, name), content)
def install_distutils(home_dir):
distutils_path = change_prefix(distutils.__path__[0], home_dir)
mkdir(distutils_path)
## FIXME: maybe this prefix setting should only be put in place if
## there's a local distutils.cfg with a prefix setting?
home_dir = os.path.abspath(home_dir)
## FIXME: this is breaking things, removing for now:
#distutils_cfg = DISTUTILS_CFG + "\n[install]\nprefix=%s\n" % home_dir
writefile(os.path.join(distutils_path, '__init__.py'), DISTUTILS_INIT)
writefile(os.path.join(distutils_path, 'distutils.cfg'), DISTUTILS_CFG, overwrite=False)
def fix_local_scheme(home_dir):
"""
Platforms that use the "posix_local" install scheme (like Ubuntu with
Python 2.7) need to be given an additional "local" location, sigh.
"""
try:
import sysconfig
except ImportError:
pass
else:
if sysconfig._get_default_scheme() == 'posix_local':
local_path = os.path.join(home_dir, 'local')
if not os.path.exists(local_path):
os.symlink(os.path.abspath(home_dir), local_path)
def fix_lib64(lib_dir):
"""
Some platforms (particularly Gentoo on x64) put things in lib64/pythonX.Y
instead of lib/pythonX.Y. If this is such a platform we'll just create a
symlink so lib64 points to lib
"""
if [p for p in distutils.sysconfig.get_config_vars().values()
if isinstance(p, basestring) and 'lib64' in p]:
logger.debug('This system uses lib64; symlinking lib64 to lib')
assert os.path.basename(lib_dir) == 'python%s' % sys.version[:3], (
"Unexpected python lib dir: %r" % lib_dir)
lib_parent = os.path.dirname(lib_dir)
assert os.path.basename(lib_parent) == 'lib', (
"Unexpected parent dir: %r" % lib_parent)
copyfile(lib_parent, os.path.join(os.path.dirname(lib_parent), 'lib64'))
def resolve_interpreter(exe):
"""
If the executable given isn't an absolute path, search $PATH for the interpreter
"""
if os.path.abspath(exe) != exe:
paths = os.environ.get('PATH', '').split(os.pathsep)
for path in paths:
if os.path.exists(os.path.join(path, exe)):
exe = os.path.join(path, exe)
break
if not os.path.exists(exe):
logger.fatal('The executable %s (from --python=%s) does not exist' % (exe, exe))
raise SystemExit(3)
if not is_executable(exe):
logger.fatal('The executable %s (from --python=%s) is not executable' % (exe, exe))
raise SystemExit(3)
return exe
def is_executable(exe):
"""Checks a file is executable"""
return os.access(exe, os.X_OK)
############################################################
## Relocating the environment:
def make_environment_relocatable(home_dir):
"""
Makes the already-existing environment use relative paths, and takes out
the #!-based environment selection in scripts.
"""
home_dir, lib_dir, inc_dir, bin_dir = path_locations(home_dir)
activate_this = os.path.join(bin_dir, 'activate_this.py')
if not os.path.exists(activate_this):
logger.fatal(
'The environment doesn\'t have a file %s -- please re-run virtualenv '
'on this environment to update it' % activate_this)
fixup_scripts(home_dir)
fixup_pth_and_egg_link(home_dir)
## FIXME: need to fix up distutils.cfg
OK_ABS_SCRIPTS = ['python', 'python%s' % sys.version[:3],
'activate', 'activate.bat', 'activate_this.py']
def fixup_scripts(home_dir):
# This is what we expect at the top of scripts:
shebang = '#!%s/bin/python' % os.path.normcase(os.path.abspath(home_dir))
# This is what we'll put:
new_shebang = '#!/usr/bin/env python%s' % sys.version[:3]
activate = "import os; activate_this=os.path.join(os.path.dirname(__file__), 'activate_this.py'); execfile(activate_this, dict(__file__=activate_this)); del os, activate_this"
if sys.platform == 'win32':
bin_suffix = 'Scripts'
else:
bin_suffix = 'bin'
bin_dir = os.path.join(home_dir, bin_suffix)
home_dir, lib_dir, inc_dir, bin_dir = path_locations(home_dir)
for filename in os.listdir(bin_dir):
filename = os.path.join(bin_dir, filename)
if not os.path.isfile(filename):
# ignore subdirs, e.g. .svn ones.
continue
f = open(filename, 'rb')
lines = f.readlines()
f.close()
if not lines:
logger.warn('Script %s is an empty file' % filename)
continue
if not lines[0].strip().startswith(shebang):
if os.path.basename(filename) in OK_ABS_SCRIPTS:
logger.debug('Cannot make script %s relative' % filename)
elif lines[0].strip() == new_shebang:
logger.info('Script %s has already been made relative' % filename)
else:
logger.warn('Script %s cannot be made relative (it\'s not a normal script that starts with %s)'
% (filename, shebang))
continue
logger.notify('Making script %s relative' % filename)
lines = [new_shebang+'\n', activate+'\n'] + lines[1:]
f = open(filename, 'wb')
f.writelines(lines)
f.close()
def fixup_pth_and_egg_link(home_dir, sys_path=None):
"""Makes .pth and .egg-link files use relative paths"""
home_dir = os.path.normcase(os.path.abspath(home_dir))
if sys_path is None:
sys_path = sys.path
for path in sys_path:
if not path:
path = '.'
if not os.path.isdir(path):
continue
path = os.path.normcase(os.path.abspath(path))
if not path.startswith(home_dir):
logger.debug('Skipping system (non-environment) directory %s' % path)
continue
for filename in os.listdir(path):
filename = os.path.join(path, filename)
if filename.endswith('.pth'):
if not os.access(filename, os.W_OK):
logger.warn('Cannot write .pth file %s, skipping' % filename)
else:
fixup_pth_file(filename)
if filename.endswith('.egg-link'):
if not os.access(filename, os.W_OK):
logger.warn('Cannot write .egg-link file %s, skipping' % filename)
else:
fixup_egg_link(filename)
def fixup_pth_file(filename):
lines = []
prev_lines = []
f = open(filename)
prev_lines = f.readlines()
f.close()
for line in prev_lines:
line = line.strip()
if (not line or line.startswith('#') or line.startswith('import ')
or os.path.abspath(line) != line):
lines.append(line)
else:
new_value = make_relative_path(filename, line)
if line != new_value:
logger.debug('Rewriting path %s as %s (in %s)' % (line, new_value, filename))
lines.append(new_value)
if lines == prev_lines:
logger.info('No changes to .pth file %s' % filename)
return
logger.notify('Making paths in .pth file %s relative' % filename)
f = open(filename, 'w')
f.write('\n'.join(lines) + '\n')
f.close()
def fixup_egg_link(filename):
f = open(filename)
link = f.read().strip()
f.close()
if os.path.abspath(link) != link:
logger.debug('Link in %s already relative' % filename)
return
new_link = make_relative_path(filename, link)
logger.notify('Rewriting link %s in %s as %s' % (link, filename, new_link))
f = open(filename, 'w')
f.write(new_link)
f.close()
def make_relative_path(source, dest, dest_is_directory=True):
"""
Make a filename relative, where the filename is dest, and it is
being referred to from the filename source.
>>> make_relative_path('/usr/share/something/a-file.pth',
... '/usr/share/another-place/src/Directory')
'../another-place/src/Directory'
>>> make_relative_path('/usr/share/something/a-file.pth',
... '/home/user/src/Directory')
'../../../home/user/src/Directory'
>>> make_relative_path('/usr/share/a-file.pth', '/usr/share/')
'./'
"""
source = os.path.dirname(source)
if not dest_is_directory:
dest_filename = os.path.basename(dest)
dest = os.path.dirname(dest)
dest = os.path.normpath(os.path.abspath(dest))
source = os.path.normpath(os.path.abspath(source))
dest_parts = dest.strip(os.path.sep).split(os.path.sep)
source_parts = source.strip(os.path.sep).split(os.path.sep)
while dest_parts and source_parts and dest_parts[0] == source_parts[0]:
dest_parts.pop(0)
source_parts.pop(0)
full_parts = ['..']*len(source_parts) + dest_parts
if not dest_is_directory:
full_parts.append(dest_filename)
if not full_parts:
# Special case for the current directory (otherwise it'd be '')
return './'
return os.path.sep.join(full_parts)
############################################################
## Bootstrap script creation:
def create_bootstrap_script(extra_text, python_version=''):
"""
Creates a bootstrap script, which is like this script but with
extend_parser, adjust_options, and after_install hooks.
This returns a string that (written to disk of course) can be used
as a bootstrap script with your own customizations. The script
will be the standard virtualenv.py script, with your extra text
added (your extra text should be Python code).
If you include these functions, they will be called:
``extend_parser(optparse_parser)``:
You can add or remove options from the parser here.
``adjust_options(options, args)``:
You can change options here, or change the args (if you accept
different kinds of arguments, be sure you modify ``args`` so it is
only ``[DEST_DIR]``).
``after_install(options, home_dir)``:
After everything is installed, this function is called. This
is probably the function you are most likely to use. An
example would be::
def after_install(options, home_dir):
subprocess.call([join(home_dir, 'bin', 'easy_install'),
'MyPackage'])
subprocess.call([join(home_dir, 'bin', 'my-package-script'),
'setup', home_dir])
This example immediately installs a package, and runs a setup
script from that package.
If you provide something like ``python_version='2.4'`` then the
script will start with ``#!/usr/bin/env python2.4`` instead of
``#!/usr/bin/env python``. You can use this when the script must
be run with a particular Python version.
"""
filename = __file__
if filename.endswith('.pyc'):
filename = filename[:-1]
f = open(filename, 'rb')
content = f.read()
f.close()
py_exe = 'python%s' % python_version
content = (('#!/usr/bin/env %s\n' % py_exe)
+ '## WARNING: This file is generated\n'
+ content)
return content.replace('##EXT' 'END##', extra_text)
##EXTEND##
def convert(s):
b = base64.b64decode(s.encode('ascii'))
return zlib.decompress(b).decode('utf-8')
##file site.py
SITE_PY = convert("""
eJzVPP1z2zaWv/OvwMqTIZXKdD66nR2n7o2TOK3v3MTbpLO5dT06SoIk1hTJEqQV7c3d337vAwAB
kvLHdvvDaTKxRAIPDw/vGw8YjUanZSnzhdgUiyaTQsmkmq9FmdRrJZZFJep1Wi0Oy6Sqd/B0fpOs
pBJ1IdROxdgqDoKnv/MTPBWf1qkyKMC3pKmLTVKn8yTLdiLdlEVVy4VYNFWar0Sap3WaZOk/oEWR
x+Lp78cgOM8FzDxLZSVuZaUArhLFUlzu6nWRi6gpcc7P4z8nL8cToeZVWtbQoNI4A0XWSR3kUi4A
TWjZKCBlWstDVcp5ukzntuG2aLKFKLNkLsV//RdPjZqGYaCKjdyuZSVFDsgATAmwSsQDvqaVmBcL
GQvxWs4THICft8QKGNoE10whGfNCZEW+gjnlci6VSqqdiGZNTYAIZbEoAKcUMKjTLAu2RXWjxrCk
tB5beCQSZg9/MsweME8cv885gOOHPPg5T79MGDZwD4Kr18w2lVymX0SCYOGn/CLnU/0sSpdikS6X
QIO8HmOTgBFQIktnRyUtx7d6hb47IqwsVyYwhkSUuTG/pB5xcF6LJFPAtk2JNFKE+Vs5S5McqJHf
wnAAEUgaDI2zSFVtx6HZiQIAVLiONUjJRolok6Q5MOuPyZzQ/luaL4qtGhMFYLWU+LVRtTv/aIAA
0NohwCTAxTKr2eRZeiOz3RgQ+ATYV1I1WY0CsUgrOa+LKpWKAABqOyG/ANITkVRSk5A508jthOhP
NElzXFgUMBR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9mn+PLnjj5P5D1yM8QmXlzBkSdXwZ0H/BBc0mEo5FE5qI2jKhclHOOvy9HD/OO/6YO1mX9vx
sY0H/tPIV0dtqel0V7iZvWyNg8XFcBA0ToEqVeqOdNUEQFvN41SumAv32VtJrakQNSmLWmgp4oJM
yDoBHgoydtoEAs47r5wHHnUal5vbJ8oOI+9wI86vb2d8Nrm/4Xy4RZ8R85E4uTZPB5EZPnTaaAGu
E59J8BE2J8XgrkbLeXMlVoQxznEYFYY8uFFdxsKQRx90Giwx9vSueHP1YNaUSFG4vTaErNSYuBOF
lXiVyXa9Sy3JdClEyK1dD6Nos9mEf8iKlOpmqSNTZnYjNEWiUYn2pKNB3ttcLJ3HmYYXy6Un76f7
r8rRsC1TpTJj7f19m5sUf/V3Ir+x/yjtLu8KjLX/CmN/AcVGUUo=
""")
##file activate.bat
ACTIVATE_BAT = convert("""
eJyFUkEKgzAQvAfyhz0YaL9QEWpRqlSjWGspFPZQTevFHOr/adQaU1GaUzI7Mzu7ZF89XhKkEJS8
qxaKMMsvboQ+LxxE44VICSW1gEa2UFaibqoS0iyJ0xw2lIA6nX5AHCu1jpRsv5KRjknkac9VLVug
sX9mtzxIeJDE/mg4OGp47qoLo3NHX2jsMB3AiDht5hryAUOEifoTdCXbSh7V0My2NMq/Xbh5MEjU
ZT63gpgNT9lKOJ/CtHsvT99re3pX303kydn4HeyOeAg5cjf2EW1D6HOPkg9NGKhu
""")
##file deactivate.bat
DEACTIVATE_BAT = convert("""
eJxzSE3OyFfIT0vj4spMU0hJTcvMS01RiPf3cYkP8wwKCXX0iQ8I8vcNCFHQ4FIAguLUEgWIgK0q
FlWqXJpcICVYpGzx2BAZ4uHv5+Hv6wq1BWINXBTdKriEKkI1DhW2QAfhttcxxANiFZCBbglQSJUL
i2dASrm4rFz9XLgAwJNbyQ==
""")
##file distutils-init.py
DISTUTILS_INIT = convert("""
eJytV92L4zYQf/dfMU0ottuse7RvC6FQrg8Lxz2Ugz4si9HacqKuIxlJ2ST313d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HXQ4bYPdrsVX
4lQMc/q6ZW975nmSK+oH6wL42a9H65U6aha342Mh0UVDzrD87C1bH73s16R5zsStkBZDp0NrXQ+7
HaRnMo8f06UBnljKoOtn/YT+LtdvSyaT/BtIv9KR60nF9f3qmuYKO4//T9ItJMsjPfgUHqKwCZ3n
xu/Lx8M/UvCLTxW7VULHxB1PRRbrYfvWNY5S8it008jOjcleaMqVBDnUXcWULV2YK9JEQ92OfC96
1Tv4ZicZZZ7GpuEpZbbeQ7DxquVx5hdqoyFSSmXwfC90f1Dc7hjFs/tK99I0fpkI8zSLy4tSy+sI
3vMWehjQNJmE5VePlZbL61nzX3S93ZcfDqznnkb9AZ3GWJU=
""")
if __name__ == '__main__':
main()
## TODO:
## Copy python.exe.manifest
## Monkeypatch distutils.sysconfig
cxxtest-4.4/bin/ 0000775 0000000 0000000 00000000000 12343514423 0013634 5 ustar 00root root 0000000 0000000 cxxtest-4.4/bin/cxxtestgen 0000775 0000000 0000000 00000000647 12343514423 0015765 0 ustar 00root root 0000000 0000000 #! /usr/bin/env python
#
# The CxxTest driver script, which uses the cxxtest Python package.
#
import sys
import os
from os.path import realpath, dirname
if sys.version_info < (3,0):
sys.path.insert(0, dirname(dirname(realpath(__file__)))+os.sep+'python')
else:
sys.path.insert(0, dirname(dirname(realpath(__file__)))+os.sep+'python'+os.sep+'python3')
sys.path.append(".")
import cxxtest
cxxtest.main(sys.argv)
cxxtest-4.4/bin/cxxtestgen.bat 0000664 0000000 0000000 00000000066 12343514423 0016522 0 ustar 00root root 0000000 0000000 @echo off
rem Just run the python script
python %0 %*
cxxtest-4.4/build_tools/ 0000775 0000000 0000000 00000000000 12343514423 0015403 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/ 0000775 0000000 0000000 00000000000 12343514423 0016430 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/AUTHORS 0000664 0000000 0000000 00000000604 12343514423 0017500 0 ustar 00root root 0000000 0000000 This file is meant to be a full credit of the people who helped make the CxxTest
builder what it is today.
Current maintainer:
Gašper Ažman (gasper dot azman at gmail.com)
Original author:
Gašper Ažman
Additional patches and tests:
Diego Nieto Cid
Edmundo López Bobeda
John Darby Mitchell
Pavol Juhas
Other helpful suggestions:
John Darby Mitchell
cxxtest-4.4/build_tools/SCons/cxxtest.py 0000664 0000000 0000000 00000041131 12343514423 0020504 0 ustar 00root root 0000000 0000000 # coding=UTF-8
#-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
#
# == Preamble ==
# Authors of this script are in the Authors file in the same directory as this
# script.
#
# Maintainer: Gašper Ažman
#
# This file is maintained as a part of the CxxTest test suite.
#
# == About ==
#
# This builder correctly tracks dependencies and supports just about every
# configuration option for CxxTest that I can think of. It automatically
# defines a target "check" (configurable), so all tests can be run with a
# % scons check
# This will first compile and then run the tests.
#
# The default configuration assumes that cxxtest is located at the base source
# directory (where SConstruct is), that the cxxtestgen is under
# cxxtest/bin/cxxtestgen and headers are in cxxtest/cxxtest/. The
# header include path is automatically added to CPPPATH. It, however, can also
# recognise that cxxtest is installed system-wide (based on redhat's RPM).
#
# For a list of environment variables and their defaults, see the generate()
# function.
#
# This should be in a file called cxxtest.py somewhere in the scons toolpath.
# (default: #/site_scons/site_tools/)
#
# == Usage: ==
#
# For configuration options, check the comment of the generate() function.
#
# This builder has a variety of different possible usages, so bear with me.
#
# env.CxxTest('target')
# The simplest of them all, it models the Program call. This sees if target.t.h
# is around and passes it through the cxxtestgen and compiles it. Might only
# work on unix though, because target can't have a suffix right now.
#
# env.CxxTest(['target.t.h'])
# This compiles target.t.h as in the previous example, but now sees that it is a
# source file. It need not have the same suffix as the env['CXXTEST_SUFFIX']
# variable dictates. The only file provided is taken as the test source file.
#
# env.CxxTest(['test1.t.h','test1_lib.cpp','test1_lib2.cpp','test2.t.h',...])
# You may also specify multiple source files. In this case, the 1st file that
# ends with CXXTEST_SUFFIX (default: .t.h) will be taken as the default test
# file. All others will be run with the --part switch and linked in. All files
# *not* having the right suffix will be passed to the Program call verbatim.
#
# In the last two cases, you may also specify the desired name of the test as
# the 1st argument to the function. This will result in the end executable
# called that. Normal Program builder rules apply.
#
from SCons.Script import *
from SCons.Builder import Builder
from SCons.Util import PrependPath, unique, uniquer
import os
# A warning class to notify users of problems
class ToolCxxTestWarning(SCons.Warnings.Warning):
pass
SCons.Warnings.enableWarningClass(ToolCxxTestWarning)
def accumulateEnvVar(dicts, name, default = []):
"""
Accumulates the values under key 'name' from the list of dictionaries dict.
The default value is appended to the end list if 'name' does not exist in
the dict.
"""
final = []
for d in dicts:
final += Split(d.get(name, default))
return final
def multiget(dictlist, key, default = None):
"""
Takes a list of dictionaries as its 1st argument. Checks if the key exists
in each one and returns the 1st one it finds. If the key is found in no
dictionaries, the default is returned.
"""
for dict in dictlist:
if dict.has_key(key):
return dict[key]
else:
return default
def envget(env, key, default=None):
"""Look in the env, then in os.environ. Otherwise same as multiget."""
return multiget([env, os.environ], key, default)
def prepend_ld_library_path(env, overrides, **kwargs):
"""Prepend LD_LIBRARY_PATH with LIBPATH to run successfully programs that
were linked against local shared libraries."""
# make it unique but preserve order ...
libpath = uniquer(Split(kwargs.get('CXXTEST_LIBPATH', [])) +
Split(env.get( 'CXXTEST_LIBPATH', [])))
if len(libpath) > 0:
libpath = env.arg2nodes(libpath, env.fs.Dir)
platform = env.get('PLATFORM','')
if platform == 'win32':
var = 'PATH'
else:
var = 'LD_LIBRARY_PATH'
eenv = overrides.get('ENV', env['ENV'].copy())
canonicalize = lambda p : p.abspath
eenv[var] = PrependPath(eenv.get(var,''), libpath, os.pathsep, 1, canonicalize)
overrides['ENV'] = eenv
return overrides
def UnitTest(env, target, source = [], **kwargs):
"""
Prepares the Program call arguments, calls Program and adds the result to
the check target.
"""
# get the c and cxx flags to process.
ccflags = Split( multiget([kwargs, env, os.environ], 'CCFLAGS' ))
cxxflags = Split( multiget([kwargs, env, os.environ], 'CXXFLAGS'))
# get the removal c and cxx flags
cxxremove = set( Split( multiget([kwargs, env, os.environ],'CXXTEST_CXXFLAGS_REMOVE')))
ccremove = set( Split( multiget([kwargs, env, os.environ],'CXXTEST_CCFLAGS_REMOVE' )))
# remove the required flags
ccflags = [item for item in ccflags if item not in ccremove]
cxxflags = [item for item in cxxflags if item not in cxxremove]
# fill the flags into kwargs
kwargs["CXXFLAGS"] = cxxflags
kwargs["CCFLAGS"] = ccflags
test = env.Program(target, source = source, **kwargs)
testCommand = multiget([kwargs, env, os.environ], 'CXXTEST_COMMAND')
if testCommand:
testCommand = testCommand.replace('%t', test[0].abspath)
else:
testCommand = test[0].abspath
if multiget([kwargs, env, os.environ], 'CXXTEST_SKIP_ERRORS', False):
runner = env.Action(testCommand, exitstatfunc=lambda x:0)
else:
runner = env.Action(testCommand)
overrides = prepend_ld_library_path(env, {}, **kwargs)
cxxtest_target = multiget([kwargs, env], 'CXXTEST_TARGET')
env.Alias(cxxtest_target, test, runner, **overrides)
env.AlwaysBuild(cxxtest_target)
return test
def isValidScriptPath(cxxtestgen):
"""check keyword arg or environment variable locating cxxtestgen script"""
if cxxtestgen and os.path.exists(cxxtestgen):
return True
else:
SCons.Warnings.warn(ToolCxxTestWarning,
"Invalid CXXTEST environment variable specified!")
return False
def defaultCxxTestGenLocation(env):
return os.path.join(
envget(env, 'CXXTEST_CXXTESTGEN_DEFAULT_LOCATION'),
envget(env, 'CXXTEST_CXXTESTGEN_SCRIPT_NAME')
)
def findCxxTestGen(env):
"""locate the cxxtestgen script by checking environment, path and project"""
# check the SCons environment...
# Then, check the OS environment...
cxxtest = envget(env, 'CXXTEST', None)
# check for common passing errors and provide diagnostics.
if isinstance(cxxtest, (list, tuple, dict)):
SCons.Warnings.warn(
ToolCxxTestWarning,
"The CXXTEST variable was specified as a list."
" This is not supported. Please pass a string."
)
if cxxtest:
try:
#try getting the absolute path of the file first.
# Required to expand '#'
cxxtest = env.File(cxxtest).abspath
except TypeError:
try:
#maybe only the directory was specified?
cxxtest = env.File(
os.path.join(cxxtest, defaultCxxTestGenLocation(env)
)).abspath
except TypeError:
pass
# If the user specified the location in the environment,
# make sure it was correct
if isValidScriptPath(cxxtest):
return os.path.realpath(cxxtest)
# No valid environment variable found, so...
# Next, check the path...
# Next, check the project
check_path = os.path.join(
envget(env, 'CXXTEST_INSTALL_DIR'),
envget(env, 'CXXTEST_CXXTESTGEN_DEFAULT_LOCATION'))
cxxtest = (env.WhereIs(envget(env, 'CXXTEST_CXXTESTGEN_SCRIPT_NAME')) or
env.WhereIs(envget(env, 'CXXTEST_CXXTESTGEN_SCRIPT_NAME'),
path=[Dir(check_path).abspath]))
if cxxtest:
return cxxtest
else:
# If we weren't able to locate the cxxtestgen script, complain...
SCons.Warnings.warn(
ToolCxxTestWarning,
"Unable to locate cxxtestgen in environment, path or"
" project!\n"
"Please set the CXXTEST variable to the path of the"
" cxxtestgen script"
)
return None
def findCxxTestHeaders(env):
searchfile = 'TestSuite.h'
cxxtestgen_pathlen = len(defaultCxxTestGenLocation(env))
default_path = Dir(envget(env,'CXXTEST_INSTALL_DIR')).abspath
os_cxxtestgen = os.path.realpath(File(env['CXXTEST']).abspath)
alt_path = os_cxxtestgen[:-cxxtestgen_pathlen]
searchpaths = [default_path, alt_path]
foundpaths = []
for p in searchpaths:
if os.path.exists(os.path.join(p, 'cxxtest', searchfile)):
foundpaths.append(p)
return foundpaths
def generate(env, **kwargs):
"""
Keyword arguments (all can be set via environment variables as well):
CXXTEST - the path to the cxxtestgen script.
Default: searches SCons environment, OS environment,
path and project in that order. Instead of setting this,
you can also set CXXTEST_INSTALL_DIR
CXXTEST_RUNNER - the runner to use. Default: ErrorPrinter
CXXTEST_OPTS - other options to pass to cxxtest. Default: ''
CXXTEST_SUFFIX - the suffix of the test files. Default: '.t.h'
CXXTEST_TARGET - the target to append the tests to. Default: check
CXXTEST_COMMAND - the command that will be executed to run the test,
%t will be replace with the test executable.
Can be used for example for MPI or valgrind tests.
Default: %t
CXXTEST_CXXFLAGS_REMOVE - the flags that cxxtests can't compile with,
or give lots of warnings. Will be stripped.
Default: -pedantic -Weffc++
CXXTEST_CCFLAGS_REMOVE - the same thing as CXXTEST_CXXFLAGS_REMOVE, just for
CCFLAGS. Default: same as CXXFLAGS.
CXXTEST_PYTHON - the path to the python binary.
Default: searches path for python
CXXTEST_SKIP_ERRORS - set to True to continue running the next test if one
test fails. Default: False
CXXTEST_CPPPATH - If you do not want to clutter your global CPPPATH with the
CxxTest header files and other stuff you only need for
your tests, this is the variable to set. Behaves as
CPPPATH does.
CXXTEST_LIBPATH - If your test is linked to shared libraries which are
outside of standard directories. This is used as LIBPATH
when compiling the test program and to modify
LD_LIBRARY_PATH (or PATH on win32) when running the
program.
CXXTEST_INSTALL_DIR - this is where you tell the builder where CxxTest is
installed. The install directory has cxxtest,
python, docs and other subdirectories.
... and all others that Program() accepts, like CPPPATH etc.
"""
print "Loading CxxTest tool..."
#
# Expected behaviour: keyword arguments override environment variables;
# environment variables override default settings.
#
env.SetDefault( CXXTEST_RUNNER = 'ErrorPrinter' )
env.SetDefault( CXXTEST_OPTS = '' )
env.SetDefault( CXXTEST_SUFFIX = '.t.h' )
env.SetDefault( CXXTEST_TARGET = 'check' )
env.SetDefault( CXXTEST_CPPPATH = ['#'] )
env.SetDefault( CXXTEST_PYTHON = env.WhereIs('python') )
env.SetDefault( CXXTEST_SKIP_ERRORS = False )
env.SetDefault( CXXTEST_CXXFLAGS_REMOVE =
['-pedantic','-Weffc++','-pedantic-errors'] )
env.SetDefault( CXXTEST_CCFLAGS_REMOVE =
['-pedantic','-Weffc++','-pedantic-errors'] )
env.SetDefault( CXXTEST_INSTALL_DIR = '#/cxxtest/' )
# this one's not for public use - it documents where the cxxtestgen script
# is located in the CxxTest tree normally.
env.SetDefault( CXXTEST_CXXTESTGEN_DEFAULT_LOCATION = 'bin' )
# the cxxtestgen script name.
env.SetDefault( CXXTEST_CXXTESTGEN_SCRIPT_NAME = 'cxxtestgen' )
#Here's where keyword arguments are applied
apply(env.Replace, (), kwargs)
#If the user specified the path to CXXTEST, make sure it is correct
#otherwise, search for and set the default toolpath.
if (not kwargs.has_key('CXXTEST') or not isValidScriptPath(kwargs['CXXTEST']) ):
env["CXXTEST"] = findCxxTestGen(env)
# find and add the CxxTest headers to the path.
env.AppendUnique( CXXTEST_CPPPATH = findCxxTestHeaders(env) )
cxxtest = env['CXXTEST']
if cxxtest:
#
# Create the Builder (only if we have a valid cxxtestgen!)
#
cxxtest_builder = Builder(
action =
[["$CXXTEST_PYTHON",cxxtest,"--runner=$CXXTEST_RUNNER",
"$CXXTEST_OPTS","$CXXTEST_ROOT_PART","-o","$TARGET","$SOURCE"]],
suffix = ".cpp",
src_suffix = '$CXXTEST_SUFFIX'
)
else:
cxxtest_builder = (lambda *a: sys.stderr.write("ERROR: CXXTESTGEN NOT FOUND!"))
def CxxTest(env, target, source = None, **kwargs):
"""Usage:
The function is modelled to be called as the Program() call is:
env.CxxTest('target_name') will build the test from the source
target_name + env['CXXTEST_SUFFIX'],
env.CxxTest('target_name', source = 'test_src.t.h') will build the test
from test_src.t.h source,
env.CxxTest('target_name, source = ['test_src.t.h', other_srcs]
builds the test from source[0] and links in other files mentioned in
sources,
You may also add additional arguments to the function. In that case, they
will be passed to the actual Program builder call unmodified. Convenient
for passing different CPPPATHs and the sort. This function also appends
CXXTEST_CPPPATH to CPPPATH. It does not clutter the environment's CPPPATH.
"""
if (source == None):
suffix = multiget([kwargs, env, os.environ], 'CXXTEST_SUFFIX', "")
source = [t + suffix for t in target]
sources = Flatten(Split(source))
headers = []
linkins = []
for l in sources:
# check whether this is a file object or a string path
try:
s = l.abspath
except AttributeError:
s = l
if s.endswith(multiget([kwargs, env, os.environ], 'CXXTEST_SUFFIX', None)):
headers.append(l)
else:
linkins.append(l)
deps = []
if len(headers) == 0:
if len(linkins) != 0:
# the 1st source specified is the test
deps.append(env.CxxTestCpp(linkins.pop(0), **kwargs))
else:
deps.append(env.CxxTestCpp(headers.pop(0), **kwargs))
deps.extend(
[env.CxxTestCpp(header, CXXTEST_RUNNER = 'none',
CXXTEST_ROOT_PART = '--part', **kwargs)
for header in headers]
)
deps.extend(linkins)
kwargs['CPPPATH'] = unique(
Split(kwargs.get('CPPPATH', [])) +
Split(env.get( 'CPPPATH', [])) +
Split(kwargs.get('CXXTEST_CPPPATH', [])) +
Split(env.get( 'CXXTEST_CPPPATH', []))
)
kwargs['LIBPATH'] = unique(
Split(kwargs.get('LIBPATH', [])) +
Split(env.get( 'LIBPATH', [])) +
Split(kwargs.get('CXXTEST_LIBPATH', [])) +
Split(env.get( 'CXXTEST_LIBPATH', []))
)
return UnitTest(env, target, source = deps, **kwargs)
env.Append( BUILDERS = { "CxxTest" : CxxTest, "CxxTestCpp" : cxxtest_builder } )
def exists(env):
return os.path.exists(env['CXXTEST'])
cxxtest-4.4/build_tools/SCons/test/ 0000775 0000000 0000000 00000000000 12343514423 0017407 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/default_env/ 0000775 0000000 0000000 00000000000 12343514423 0021703 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/default_env/README 0000664 0000000 0000000 00000000141 12343514423 0022557 0 ustar 00root root 0000000 0000000 Tests if the 'default environment' defaults are sane and work out of the box.
by: Gašper Ažman
cxxtest-4.4/build_tools/SCons/test/default_env/SConstruct 0000664 0000000 0000000 00000000336 12343514423 0023737 0 ustar 00root root 0000000 0000000 env = Environment(
toolpath=['../../'],
tools=['default','cxxtest']
)
env['CXXTEST_SKIP_ERRORS'] = True
env.CxxTest(['src/ThrowNoStd.h'])
env.CxxTest(['src/AborterNoThrow.h'])
env.CxxTest(['src/Comments.h'])
cxxtest-4.4/build_tools/SCons/test/default_env/TestDef.py 0000664 0000000 0000000 00000001216 12343514423 0023613 0 ustar 00root root 0000000 0000000 #-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
expect_success = True
type = 'scons'
links = {
'cxxtest': '../../../../',
'src' : '../../../../test/'
}
cxxtest-4.4/build_tools/SCons/test/empty_source_list/ 0000775 0000000 0000000 00000000000 12343514423 0023160 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/empty_source_list/README 0000664 0000000 0000000 00000000117 12343514423 0024037 0 ustar 00root root 0000000 0000000 Tests if cxxtest behaves correctly if no sources are given.
by: Gašper Ažman
cxxtest-4.4/build_tools/SCons/test/empty_source_list/SConstruct 0000664 0000000 0000000 00000000164 12343514423 0025213 0 ustar 00root root 0000000 0000000 env = Environment(toolpath=['../../'],tools=['default','cxxtest'])
env.CxxTest('test_bar')
env.CxxTest('test_foo')
cxxtest-4.4/build_tools/SCons/test/empty_source_list/TestDef.py 0000664 0000000 0000000 00000001044 12343514423 0025067 0 ustar 00root root 0000000 0000000 #-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
links = {'cxxtest' : '../../../../'}
cxxtest-4.4/build_tools/SCons/test/empty_source_list/requirement.hpp 0000664 0000000 0000000 00000000353 12343514423 0026232 0 ustar 00root root 0000000 0000000 /**
* @file requirement.cpp
* Implementation of the requirement function.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:09:42 AM
*/
bool call_a_requirement() {
return true;
}
cxxtest-4.4/build_tools/SCons/test/empty_source_list/test_bar.t.h 0000664 0000000 0000000 00000000635 12343514423 0025402 0 ustar 00root root 0000000 0000000 #ifndef TEST_BAR_T_H
#define TEST_BAR_T_H
/**
* @file test_bar.t.h
* Test one for the joint test ehm, test.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:04:06 AM
*/
#include
#include "requirement.hpp"
class TestBar : public CxxTest::TestSuite
{
public:
void test_foo() {
TS_ASSERT(call_a_requirement());
}
};
#endif
cxxtest-4.4/build_tools/SCons/test/empty_source_list/test_foo.t.h 0000664 0000000 0000000 00000000635 12343514423 0025421 0 ustar 00root root 0000000 0000000 #ifndef TEST_FOO_T_H
#define TEST_FOO_T_H
/**
* @file test_foo.t.h
* Test one for the joint test ehm, test.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:02:06 AM
*/
#include "requirement.hpp"
#include
class TestFoo : public CxxTest::TestSuite
{
public:
void test_foo() {
TS_ASSERT(call_a_requirement());
}
};
#endif
cxxtest-4.4/build_tools/SCons/test/eprouvette.py 0000775 0000000 0000000 00000014510 12343514423 0022167 0 ustar 00root root 0000000 0000000 #!/usr/bin/env python
# vim: fileencoding=utf-8
#-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
from __future__ import print_function
import os, sys
from os.path import isdir, isfile, islink, join
from optparse import OptionParser
from subprocess import check_call, CalledProcessError, PIPE
options = None
args = []
available_types = set(['scons'])
tool_stdout = PIPE
def main():
global options
global args
global tool_stdout
"""Parse the options and execute the program."""
usage = \
"""Usage: %prog [options] [test1 [test2 [...]]]
If you provide one or more tests, this will run the provided tests.
Otherwise, it will look for tests in the current directory and run them all.
"""
# option parsing
parser = OptionParser(usage)
parser.set_defaults(
action='run',
verbose=True)
parser.add_option("-c", "--clean",
action='store_const', const='clean', dest='action',
help="deletes any generated files in the tests")
parser.add_option("--run",
action='store_const', const='run', dest='action',
help="sets up the environment, compiles and runs the tests")
parser.add_option("-v", "--verbose",
action='store_true', dest='verbose',
help="spew out more details")
parser.add_option("-q", "--quiet",
action='store_false', dest='verbose',
help="spew out only success/failure of tests")
parser.add_option("--target-dir",
dest='target_dir', action='store', default='./',
help='target directory to look for tests in. default: %default')
parser.add_option("--debug",
dest='debug', action='store_true', default=False,
help='turn on debug output.')
(options, args) = parser.parse_args()
if options.debug or options.verbose:
tool_stdout = None
# gather the tests
tests = []
if len(args) == 0:
tests = crawl_tests(options.target_dir)
else:
tests = args
tests = purge_tests(tests)
# run the tests
if options.action == 'run':
for t in tests:
run_test(t)
elif options.action == 'clean':
for t in tests:
clean_test(t)
def crawl_tests(target):
"""Gather the directories in the test directory."""
files = os.listdir(target)
return [f for f in files if isdir(f) and f[0] != '.']
def purge_tests(dirs):
"""Look at the test candidates and purge those that aren't from the list"""
tests = []
for t in dirs:
if isfile(join(t, 'TestDef.py')):
tests.append(t)
else:
warn("{0} is not a test (missing TestDef.py file).".format(t))
return tests
def warn(msg):
"""A general warning function."""
if options.verbose:
print('[Warn]: ' + msg, file=sys.stderr)
def notice(msg):
"""A general print function."""
if options.verbose:
print(msg)
def debug(msg):
"""A debugging function"""
if options.debug:
print(msg)
def run_test(t):
"""Runs the test in directory t."""
opts = read_opts(t)
notice("-----------------------------------------------------")
notice("running test '{0}':\n".format(t))
readme = join(t, 'README')
if isfile(readme):
notice(open(readme).read())
notice("")
if opts['type'] not in available_types:
warn('{0} is not a recognised test type in {1}'.format(opts['type'], t))
return
if not opts['expect_success']:
warn("tests that fail intentionally are not yet supported.")
return
# set up the environment
setup_env(t, opts)
# run the test
try:
if opts['type'] == 'scons':
run_scons(t, opts)
except RuntimeError as e:
print("Test {0} failed.".format(t))
return
if not options.verbose:
print('.', end='')
sys.stdout.flush()
else:
print("test '{0}' successful.".format(t))
def read_opts(t):
"""Read the test options and return them."""
opts = {
'expect_success' : True,
'type' : 'scons',
'links' : {}
}
f = open(join(t, "TestDef.py"))
exec(f.read(), opts)
return opts
def setup_env(t, opts):
"""Set up the environment for the test."""
# symlinks
links = opts['links']
for link in links:
frm = links[link]
to = join(t, link)
debug("Symlinking {0} to {1}".format(frm, to))
if islink(to):
os.unlink(to)
os.symlink(frm, to)
def teardown_env(t, opts):
"""Remove all files generated for the test."""
links = opts['links']
for link in links:
to = join(t, link)
debug('removing link {0}'.format(to))
os.unlink(to)
def clean_test(t):
"""Remove all generated files."""
opts = read_opts(t)
notice("cleaning test {0}".format(t))
if opts['type'] == 'scons':
setup_env(t, opts) # scons needs the environment links to work
clean_scons(t, opts)
teardown_env(t, opts)
def clean_scons(t, opts):
"""Make scons clean after itself."""
cwd = os.getcwd()
os.chdir(t)
try:
check_call(['scons', '--clean'], stdout=tool_stdout, stderr=None)
except CalledProcessError as e:
warn("SCons failed with error {0}".format(e.returncode))
os.chdir(cwd)
sconsign = join(t, '.sconsign.dblite')
if isfile(sconsign):
os.unlink(sconsign)
def run_scons(t, opts):
"""Run scons test."""
cwd = os.getcwd()
os.chdir(t)
try:
check_call(['scons', '--clean'], stdout=tool_stdout)
check_call(['scons', '.'], stdout=tool_stdout)
check_call(['scons', 'check'], stdout=tool_stdout)
except CalledProcessError as e:
os.chdir(cwd) # clean up
raise e
os.chdir(cwd)
if __name__ == "__main__":
main()
if not options.verbose:
print() # quiet doesn't output newlines.
cxxtest-4.4/build_tools/SCons/test/expanding_#/ 0000775 0000000 0000000 00000000000 12343514423 0021566 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/expanding_#/README 0000664 0000000 0000000 00000000146 12343514423 0022447 0 ustar 00root root 0000000 0000000 Tests whether expanding '#' to the top-level directory works as intended in
scons.
by: Gašper Ažman
cxxtest-4.4/build_tools/SCons/test/expanding_#/SConstruct 0000664 0000000 0000000 00000000411 12343514423 0023614 0 ustar 00root root 0000000 0000000 env = Environment(
toolpath=['../../'],
tools=['default','cxxtest'],
CXXTEST='./../../../../bin/cxxtestgen'
)
env['CXXTEST_SKIP_ERRORS'] = True
env.CxxTest(['src/ThrowNoStd.h'])
env.CxxTest(['src/AborterNoThrow.h'])
env.CxxTest(['src/Comments.h'])
cxxtest-4.4/build_tools/SCons/test/expanding_#/TestDef.py 0000664 0000000 0000000 00000001044 12343514423 0023475 0 ustar 00root root 0000000 0000000 #-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
links = {'src' : '../../../../test'}
cxxtest-4.4/build_tools/SCons/test/globbing/ 0000775 0000000 0000000 00000000000 12343514423 0021172 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/globbing/README 0000664 0000000 0000000 00000000132 12343514423 0022046 0 ustar 00root root 0000000 0000000 Tests whether we can swallow file nodes as sources as well as strings.
by: Gašper Ažman
cxxtest-4.4/build_tools/SCons/test/globbing/SConstruct 0000664 0000000 0000000 00000000212 12343514423 0023217 0 ustar 00root root 0000000 0000000 env = Environment(toolpath=['../../'],tools=['default','cxxtest'])
env.CxxTest('joint_tests',[Glob('src/*.t.h'), 'src/requirement.cpp'])
cxxtest-4.4/build_tools/SCons/test/globbing/TestDef.py 0000664 0000000 0000000 00000001044 12343514423 0023101 0 ustar 00root root 0000000 0000000 #-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
links = {'cxxtest' : '../../../../'}
cxxtest-4.4/build_tools/SCons/test/globbing/src/ 0000775 0000000 0000000 00000000000 12343514423 0021761 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/globbing/src/requirement.cpp 0000664 0000000 0000000 00000000405 12343514423 0025024 0 ustar 00root root 0000000 0000000 /**
* @file requirement.cpp
* Implementation of the requirement function.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:09:42 AM
*/
#include "requirement.h"
bool call_a_requirement() {
return true;
}
cxxtest-4.4/build_tools/SCons/test/globbing/src/requirement.h 0000664 0000000 0000000 00000000416 12343514423 0024473 0 ustar 00root root 0000000 0000000 #ifndef REQUIREMENT_H
#define REQUIREMENT_H
/**
* @file requirement.h
* Prototype for the call_a_requirement() function.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:08:35 AM
*/
bool call_a_requirement();
#endif
cxxtest-4.4/build_tools/SCons/test/globbing/src/test_bar.t.h 0000664 0000000 0000000 00000000633 12343514423 0024201 0 ustar 00root root 0000000 0000000 #ifndef TEST_BAR_T_H
#define TEST_BAR_T_H
/**
* @file test_bar.t.h
* Test one for the joint test ehm, test.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:04:06 AM
*/
#include
#include "requirement.h"
class TestBar : public CxxTest::TestSuite
{
public:
void test_foo() {
TS_ASSERT(call_a_requirement());
}
};
#endif
cxxtest-4.4/build_tools/SCons/test/globbing/src/test_foo.t.h 0000664 0000000 0000000 00000000633 12343514423 0024220 0 ustar 00root root 0000000 0000000 #ifndef TEST_FOO_T_H
#define TEST_FOO_T_H
/**
* @file test_foo.t.h
* Test one for the joint test ehm, test.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:02:06 AM
*/
#include "requirement.h"
#include
class TestFoo : public CxxTest::TestSuite
{
public:
void test_foo() {
TS_ASSERT(call_a_requirement());
}
};
#endif
cxxtest-4.4/build_tools/SCons/test/globbing_edmundo/ 0000775 0000000 0000000 00000000000 12343514423 0022705 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/globbing_edmundo/README 0000664 0000000 0000000 00000000122 12343514423 0023560 0 ustar 00root root 0000000 0000000 Test for various things cxxtest failed to do, but now does.
by: Edmundo López B.
cxxtest-4.4/build_tools/SCons/test/globbing_edmundo/SConstruct 0000664 0000000 0000000 00000001750 12343514423 0024742 0 ustar 00root root 0000000 0000000 # What I want to do is the following:
# I have my class files ending with .cc and
# the main file ending with .cpp. This way it
# very easy to do the following line just to
# have all sources in that variable
import os
mySrc = Glob("*.cc")
myFlags = ['-I.']
myEnv = Environment( ENV = os.environ, tools = ['default', \
'cxxtest'], toolpath=['../../'])
# Here is the first problem I corrected:
# Flags won't be correctly recognized by cxxtest
myEnv.Replace(CXXFLAGS = myFlags)
# Then I want to convert those sources to objects
myObjs = myEnv.Object(mySrc)
# Having the objects I can create my program
# this way:
myEnv.Program('hello', ['main.cpp'] + myObjs)
# Now I want to do the same thing with the tests
# target
# With the non corrected version you'll get 2 errors:
# The CXXFLAGS are not set correctly
# It won't even accept this construction, which as you see
# works perfectly with Program (and CxxTest should work like it)
myEnv.CxxTest('helloTest', ['hellotest.t.h'] + myObjs)
cxxtest-4.4/build_tools/SCons/test/globbing_edmundo/TestDef.py 0000664 0000000 0000000 00000001044 12343514423 0024614 0 ustar 00root root 0000000 0000000 #-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
links = {'cxxtest' : '../../../../'}
cxxtest-4.4/build_tools/SCons/test/globbing_edmundo/hello.cc 0000664 0000000 0000000 00000000613 12343514423 0024317 0 ustar 00root root 0000000 0000000 /**
* \file
* Implementation of class.
*/
/****************************************************
* Author: Edmundo LOPEZ
* email: lopezed5@etu.unige.ch
*
* This code was written as a part of my bachelor
* thesis at the University of Geneva.
*
* $Id$
*
* **************************************************/
#include
int
Hello::foo(int x, int y)
{
return x + y;
}
cxxtest-4.4/build_tools/SCons/test/globbing_edmundo/hello.hh 0000664 0000000 0000000 00000000425 12343514423 0024332 0 ustar 00root root 0000000 0000000 /**
* \file
* File containing a class
*/
/****************************************************
* Author: Edmundo LOPEZ
* email: lopezed5@etu.unige.ch
*
* **************************************************/
class Hello
{
public:
int foo(int x, int y);
};
cxxtest-4.4/build_tools/SCons/test/globbing_edmundo/hellotest.t.h 0000664 0000000 0000000 00000000656 12343514423 0025332 0 ustar 00root root 0000000 0000000 /**
* \file
* The test file.
*/
/****************************************************
* Author: Edmundo LOPEZ
* email: lopezed5@etu.unige.ch
*
* **************************************************/
#include
#include
class helloTestSuite : public CxxTest::TestSuite
{
public:
void testFoo()
{
Hello h;
TS_ASSERT_EQUALS (h.foo(2,2), 4);
}
};
cxxtest-4.4/build_tools/SCons/test/globbing_edmundo/main.cpp 0000664 0000000 0000000 00000000543 12343514423 0024337 0 ustar 00root root 0000000 0000000 /**
* \file
* Main function comes here.
*/
/****************************************************
* Author: Edmundo LOPEZ
* email: lopezed5@etu.unige.ch
*
* **************************************************/
#include
#include
int main (int argc, char *argv[])
{
Hello h;
std::cout << h.foo(2,3) << std::endl;
}
cxxtest-4.4/build_tools/SCons/test/include_CCFLAGS/ 0000775 0000000 0000000 00000000000 12343514423 0022154 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/include_CCFLAGS/README 0000664 0000000 0000000 00000000164 12343514423 0023035 0 ustar 00root root 0000000 0000000 Tests:
- if CXXTEST_CXXFLAGS_REMOVE and CXXTEST_CCFLAGS_REMOVE flags work,
- if CCFLAGS and CXXFLAGS vars work.
cxxtest-4.4/build_tools/SCons/test/include_CCFLAGS/SConstruct 0000664 0000000 0000000 00000000652 12343514423 0024211 0 ustar 00root root 0000000 0000000 flags = '-pedantic-errors -Weffc++ -Wall -Wextra -ansi'
env = Environment(
toolpath=['../../'],
tools=['default','cxxtest'],
CCFLAGS=flags,
CXXFLAGS=flags,
CXXTEST_CXXFLAGS_REMOVE=['-pedantic-errors','-Weffc++','-Wextra','-Wall','-W'],
CXXTEST_CCFLAGS_REMOVE=['-pedantic-errors','-Weffc++','-Wextra','-Wall','-W']
)
env.CxxTest(['src/not-with-pedantic.h'])
env.CxxTest(['src/only_with_ansi.t.h'])
cxxtest-4.4/build_tools/SCons/test/include_CCFLAGS/TestDef.py 0000664 0000000 0000000 00000001044 12343514423 0024063 0 ustar 00root root 0000000 0000000 #-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
links = {'cxxtest' : '../../../../'}
cxxtest-4.4/build_tools/SCons/test/include_CCFLAGS/src/ 0000775 0000000 0000000 00000000000 12343514423 0022743 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/include_CCFLAGS/src/not-with-pedantic.h 0000664 0000000 0000000 00000000553 12343514423 0026455 0 ustar 00root root 0000000 0000000 /**
* @file not-with-pedantic.h
* Compiles, but not with -pedantic.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-09-30 13:33:50
*/
#include
class TestPedantic : public CxxTest::TestSuite
{
public:
void testPedanticPresent() {
TS_ASSERT(true);
int f = (true)?:5;
}
};
cxxtest-4.4/build_tools/SCons/test/include_CCFLAGS/src/only_with_ansi.t.h 0000664 0000000 0000000 00000000652 12343514423 0026407 0 ustar 00root root 0000000 0000000 /**
* @file only_with_ansi.t.h
* This test only runs correctly if -ansi was supplied as a g++ switch.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2009-02-11 06:26:59 PM
*/
#include
class TestAnsi : public CxxTest::TestSuite
{
public:
void testAnsiPresent() {
#ifdef __STRICT_ANSI__
TS_ASSERT(true);
#else
TS_ASSERT(false);
#endif
}
};
cxxtest-4.4/build_tools/SCons/test/include_CXXFLAGS/ 0000775 0000000 0000000 00000000000 12343514423 0022331 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/include_CXXFLAGS/README 0000664 0000000 0000000 00000000352 12343514423 0023211 0 ustar 00root root 0000000 0000000 This test tests whether variables that are put into the environment after it has
been initialised work as expected.
If they do not, -pedantic-errors will appear in the gcc commandline and the
compilation WILL FAIL, failing the test.
cxxtest-4.4/build_tools/SCons/test/include_CXXFLAGS/SConstruct 0000664 0000000 0000000 00000000741 12343514423 0024365 0 ustar 00root root 0000000 0000000 flags = '-Weffc++ -Wall -Wextra -std=gnu++0x'
env = Environment(
toolpath=['../../'],
tools=['default','cxxtest'],
CCFLAGS = Split(flags) + ['-pedantic-errors'],
CXXFLAGS = Split(flags) + ['-pedantic-errors']
)
env['CXXTEST_CXXFLAGS_REMOVE']=['-Weffc++','-Wextra','-Wall','-W']
env['CXXTEST_CCFLAGS_REMOVE']='-Weffc++ -Wextra -Wall -W'
env['CCFLAGS'] = flags
env['CXXFLAGS'] = flags
env['CXXTEST_SKIP_ERRORS'] = True
env.CxxTest(['src/not-with-pedantic.h'])
cxxtest-4.4/build_tools/SCons/test/include_CXXFLAGS/TestDef.py 0000664 0000000 0000000 00000001044 12343514423 0024240 0 ustar 00root root 0000000 0000000 #-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
links = {'cxxtest' : '../../../../'}
cxxtest-4.4/build_tools/SCons/test/include_CXXFLAGS/src/ 0000775 0000000 0000000 00000000000 12343514423 0023120 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/include_CXXFLAGS/src/not-with-pedantic.h 0000664 0000000 0000000 00000000522 12343514423 0026626 0 ustar 00root root 0000000 0000000 /**
* @file not-with-pedantic.h
* Compiles, but not with -pedantic.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-09-30 13:33:50
*/
#include
class TestPedantic : public CxxTest::TestSuite
{
public:
void testPedanticPresent() {
int f = (true)?:5;
}
};
cxxtest-4.4/build_tools/SCons/test/libpath/ 0000775 0000000 0000000 00000000000 12343514423 0021032 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/libpath/README 0000664 0000000 0000000 00000000174 12343514423 0021714 0 ustar 00root root 0000000 0000000 Test whether we can run program that depends on (shared) libraries that we know
but they are outside of standard load path.
cxxtest-4.4/build_tools/SCons/test/libpath/SConstruct 0000664 0000000 0000000 00000000212 12343514423 0023057 0 ustar 00root root 0000000 0000000 env = Environment(toolpath=['../../'],tools=['default','cxxtest'])
SConscript(['src/SConscript', 'test/SConscript'], exports = ['env'])
cxxtest-4.4/build_tools/SCons/test/libpath/TestDef.py 0000664 0000000 0000000 00000001044 12343514423 0022741 0 ustar 00root root 0000000 0000000 #-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
links = {'cxxtest' : '../../../../'}
cxxtest-4.4/build_tools/SCons/test/libpath/src/ 0000775 0000000 0000000 00000000000 12343514423 0021621 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/libpath/src/SConscript 0000664 0000000 0000000 00000000063 12343514423 0023632 0 ustar 00root root 0000000 0000000 Import('env')
env.SharedLibrary('foo', 'foo.cpp')
cxxtest-4.4/build_tools/SCons/test/libpath/src/foo.cpp 0000664 0000000 0000000 00000000032 12343514423 0023103 0 ustar 00root root 0000000 0000000 int foo()
{
return 0;
}
cxxtest-4.4/build_tools/SCons/test/libpath/test/ 0000775 0000000 0000000 00000000000 12343514423 0022011 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/libpath/test/SConscript 0000664 0000000 0000000 00000000124 12343514423 0024020 0 ustar 00root root 0000000 0000000 Import('env')
env.CxxTest('test.t.h', LIBS = ['foo'], CXXTEST_LIBPATH = ['../src'])
cxxtest-4.4/build_tools/SCons/test/libpath/test/test.t.h 0000664 0000000 0000000 00000000307 12343514423 0023403 0 ustar 00root root 0000000 0000000 // test/test.t.h
#include
extern int foo();
class FooTestSuite1 : public CxxTest::TestSuite
{
public:
void testFoo(void)
{
TS_ASSERT_EQUALS(foo(), 0);
}
};
cxxtest-4.4/build_tools/SCons/test/libpath_multitarget/ 0000775 0000000 0000000 00000000000 12343514423 0023453 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/libpath_multitarget/README 0000664 0000000 0000000 00000000270 12343514423 0024332 0 ustar 00root root 0000000 0000000 Test whether we can run program that depends on (shared) libraries that we know
but they are outside of standard load path. Test whether multiple test runners
do not alter each other.
cxxtest-4.4/build_tools/SCons/test/libpath_multitarget/SConstruct 0000664 0000000 0000000 00000000236 12343514423 0025506 0 ustar 00root root 0000000 0000000 env = Environment(toolpath=['../../'],tools=['default','cxxtest'])
SConscript(['src1/SConscript', 'src2/SConscript', 'test/SConscript'], exports = ['env'])
cxxtest-4.4/build_tools/SCons/test/libpath_multitarget/TestDef.py 0000664 0000000 0000000 00000001044 12343514423 0025362 0 ustar 00root root 0000000 0000000 #-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
links = {'cxxtest' : '../../../../'}
cxxtest-4.4/build_tools/SCons/test/libpath_multitarget/src1/ 0000775 0000000 0000000 00000000000 12343514423 0024323 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/libpath_multitarget/src1/SConscript 0000664 0000000 0000000 00000000063 12343514423 0026334 0 ustar 00root root 0000000 0000000 Import('env')
env.SharedLibrary('foo', 'foo.cpp')
cxxtest-4.4/build_tools/SCons/test/libpath_multitarget/src1/foo.cpp 0000664 0000000 0000000 00000000032 12343514423 0025605 0 ustar 00root root 0000000 0000000 int foo()
{
return 0;
}
cxxtest-4.4/build_tools/SCons/test/libpath_multitarget/src2/ 0000775 0000000 0000000 00000000000 12343514423 0024324 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/libpath_multitarget/src2/SConscript 0000664 0000000 0000000 00000000063 12343514423 0026335 0 ustar 00root root 0000000 0000000 Import('env')
env.SharedLibrary('bar', 'bar.cpp')
cxxtest-4.4/build_tools/SCons/test/libpath_multitarget/src2/bar.cpp 0000664 0000000 0000000 00000000032 12343514423 0025567 0 ustar 00root root 0000000 0000000 int bar()
{
return 0;
}
cxxtest-4.4/build_tools/SCons/test/libpath_multitarget/test/ 0000775 0000000 0000000 00000000000 12343514423 0024432 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/libpath_multitarget/test/SConscript 0000664 0000000 0000000 00000000432 12343514423 0026443 0 ustar 00root root 0000000 0000000 Import('env')
env.CxxTest('test1.t.h', LIBS = ['foo'], CXXTEST_LIBPATH = ['../src1'], CXXTEST_TARGET = 'check-1')
env.CxxTest('test2.t.h', LIBS = ['bar'], CXXTEST_LIBPATH = ['../src2'], CXXTEST_TARGET = 'check-2')
env.Alias('check', ['check-1', 'check-2'])
env.AlwaysBuild('check')
cxxtest-4.4/build_tools/SCons/test/libpath_multitarget/test/test1.t.h 0000664 0000000 0000000 00000000307 12343514423 0026105 0 ustar 00root root 0000000 0000000 // test/test.t.h
#include
extern int foo();
class FooTestSuite1 : public CxxTest::TestSuite
{
public:
void testFoo(void)
{
TS_ASSERT_EQUALS(foo(), 0);
}
};
cxxtest-4.4/build_tools/SCons/test/libpath_multitarget/test/test2.t.h 0000664 0000000 0000000 00000000307 12343514423 0026106 0 ustar 00root root 0000000 0000000 // test/test.t.h
#include
extern int bar();
class BarTestSuite1 : public CxxTest::TestSuite
{
public:
void testBar(void)
{
TS_ASSERT_EQUALS(bar(), 0);
}
};
cxxtest-4.4/build_tools/SCons/test/multifile_tests/ 0000775 0000000 0000000 00000000000 12343514423 0022623 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/multifile_tests/SConstruct 0000664 0000000 0000000 00000000323 12343514423 0024653 0 ustar 00root root 0000000 0000000 env = Environment(toolpath=['../../'],tools=['default','cxxtest'])
env.CxxTest('joint_tests',
Split('src/test_foo.t.h '
'src/test_bar.t.h '
'src/requirement.cpp'
)
)
cxxtest-4.4/build_tools/SCons/test/multifile_tests/TestDef.py 0000664 0000000 0000000 00000001044 12343514423 0024532 0 ustar 00root root 0000000 0000000 #-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
links = {'cxxtest' : '../../../../'}
cxxtest-4.4/build_tools/SCons/test/multifile_tests/src/ 0000775 0000000 0000000 00000000000 12343514423 0023412 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/multifile_tests/src/requirement.cpp 0000664 0000000 0000000 00000000405 12343514423 0026455 0 ustar 00root root 0000000 0000000 /**
* @file requirement.cpp
* Implementation of the requirement function.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:09:42 AM
*/
#include "requirement.h"
bool call_a_requirement() {
return true;
}
cxxtest-4.4/build_tools/SCons/test/multifile_tests/src/requirement.h 0000664 0000000 0000000 00000000416 12343514423 0026124 0 ustar 00root root 0000000 0000000 #ifndef REQUIREMENT_H
#define REQUIREMENT_H
/**
* @file requirement.h
* Prototype for the call_a_requirement() function.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:08:35 AM
*/
bool call_a_requirement();
#endif
cxxtest-4.4/build_tools/SCons/test/multifile_tests/src/test_bar.t.h 0000664 0000000 0000000 00000000633 12343514423 0025632 0 ustar 00root root 0000000 0000000 #ifndef TEST_BAR_T_H
#define TEST_BAR_T_H
/**
* @file test_bar.t.h
* Test one for the joint test ehm, test.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:04:06 AM
*/
#include
#include "requirement.h"
class TestBar : public CxxTest::TestSuite
{
public:
void test_foo() {
TS_ASSERT(call_a_requirement());
}
};
#endif
cxxtest-4.4/build_tools/SCons/test/multifile_tests/src/test_foo.t.h 0000664 0000000 0000000 00000000633 12343514423 0025651 0 ustar 00root root 0000000 0000000 #ifndef TEST_FOO_T_H
#define TEST_FOO_T_H
/**
* @file test_foo.t.h
* Test one for the joint test ehm, test.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:02:06 AM
*/
#include "requirement.h"
#include
class TestFoo : public CxxTest::TestSuite
{
public:
void test_foo() {
TS_ASSERT(call_a_requirement());
}
};
#endif
cxxtest-4.4/build_tools/SCons/test/need_cpppath/ 0000775 0000000 0000000 00000000000 12343514423 0022041 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/need_cpppath/SConstruct 0000664 0000000 0000000 00000000302 12343514423 0024066 0 ustar 00root root 0000000 0000000
env = Environment(
toolpath=['../../'],
tools=['default','cxxtest'],
CXXTEST_INSTALL_DIR = '../../../../',
CPPPATH = ['src/cpppathdir/']
)
env.CxxTest(['src/cpppath.t.h'])
cxxtest-4.4/build_tools/SCons/test/need_cpppath/TestDef.py 0000664 0000000 0000000 00000000000 12343514423 0023737 0 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/need_cpppath/src/ 0000775 0000000 0000000 00000000000 12343514423 0022630 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/need_cpppath/src/cpppath.t.h 0000664 0000000 0000000 00000000717 12343514423 0024707 0 ustar 00root root 0000000 0000000 #ifndef CPPPATH_T_H
#define CPPPATH_T_H
/**
* @file cpppath.t.h
* This file needs the include in the include dir.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-28 11:16:46 AM
*/
// actual path cpppathdir/include.h
#include "include.h"
#include
class CppPathTest : public CxxTest::TestSuite
{
public:
void test_i_need_me_exists() {
TS_ASSERT(i_need_me() == 0);
}
};
#endif
cxxtest-4.4/build_tools/SCons/test/need_cpppath/src/cpppathdir/ 0000775 0000000 0000000 00000000000 12343514423 0024766 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/need_cpppath/src/cpppathdir/include.h 0000664 0000000 0000000 00000000364 12343514423 0026565 0 ustar 00root root 0000000 0000000 #ifndef INCLUDE_H
#define INCLUDE_H
/**
* @file include.h
* Include file for this test.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-28 11:15:40 AM
*/
int i_need_me() {
return 0;
}
#endif
cxxtest-4.4/build_tools/SCons/test/nonstandard_cxxtest_dir/ 0000775 0000000 0000000 00000000000 12343514423 0024342 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/nonstandard_cxxtest_dir/SConstruct 0000664 0000000 0000000 00000000407 12343514423 0026375 0 ustar 00root root 0000000 0000000 env = Environment(
toolpath=['../../'],
tools=['default','cxxtest'],
CXXTEST_INSTALL_DIR = '../../../../'
)
env['CXXTEST_SKIP_ERRORS'] = True
env.CxxTest(['src/ThrowNoStd.h'])
env.CxxTest(['src/AborterNoThrow.h'])
env.CxxTest(['src/Comments.h'])
cxxtest-4.4/build_tools/SCons/test/nonstandard_cxxtest_dir/TestDef.py 0000664 0000000 0000000 00000001045 12343514423 0026252 0 ustar 00root root 0000000 0000000 #-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
links = {'src' : '../../../../test/'}
cxxtest-4.4/build_tools/SCons/test/printer_propagation/ 0000775 0000000 0000000 00000000000 12343514423 0023475 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/printer_propagation/SConstruct 0000664 0000000 0000000 00000000316 12343514423 0025527 0 ustar 00root root 0000000 0000000
env = Environment(
toolpath=['../../'],
tools=['default','cxxtest'],
CXXTEST_INSTALL_DIR = '../../../../',
)
env.CxxTest(['src/failtest.t.h'], CPPPATH=['#'], CXXTEST_RUNNER="CrazyRunner")
cxxtest-4.4/build_tools/SCons/test/printer_propagation/TestDef.py 0000664 0000000 0000000 00000000000 12343514423 0025373 0 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/printer_propagation/cxxtest/ 0000775 0000000 0000000 00000000000 12343514423 0025177 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/printer_propagation/cxxtest/CrazyRunner.h 0000664 0000000 0000000 00000000462 12343514423 0027634 0 ustar 00root root 0000000 0000000 #ifndef __cxxtest_CrazyRunner_h__
#define __cxxtest_CrazyRunner_h__
/*
* This is not a proper runner. Just a simple class that looks like one.
*/
namespace CxxTest {
class CrazyRunner {
public:
int run() { return 0; }
void process_commandline(int argc, char** argv) { }
};
}
#endif
cxxtest-4.4/build_tools/SCons/test/printer_propagation/src/ 0000775 0000000 0000000 00000000000 12343514423 0024264 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/printer_propagation/src/failtest.t.h 0000664 0000000 0000000 00000000542 12343514423 0026513 0 ustar 00root root 0000000 0000000 #ifndef FAILTEST_T_H
#define FAILTEST_T_H
/**
* @file failtest.t.h
* This test will succed only with a CrazyRunner.
*
* @author
* @version 1.0
* @since jue ago 28 14:18:57 ART 2008
*/
#include
class CppPathTest : public CxxTest::TestSuite
{
public:
void test_i_will_fail() {
TS_ASSERT(false);
}
};
#endif
cxxtest-4.4/build_tools/SCons/test/recursive_sources/ 0000775 0000000 0000000 00000000000 12343514423 0023161 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/recursive_sources/README 0000664 0000000 0000000 00000000133 12343514423 0024036 0 ustar 00root root 0000000 0000000 Tests whether we can swallow recursively supplied sources - a list of lists, for
instance.
cxxtest-4.4/build_tools/SCons/test/recursive_sources/SConstruct 0000664 0000000 0000000 00000000237 12343514423 0025215 0 ustar 00root root 0000000 0000000 env = Environment(toolpath=['../../'],tools=['default','cxxtest'])
env.CxxTest('joint_tests',['src/test_foo.t.h',['src/test_bar.t.h','src/requirement.cpp']])
cxxtest-4.4/build_tools/SCons/test/recursive_sources/TestDef.py 0000664 0000000 0000000 00000001044 12343514423 0025070 0 ustar 00root root 0000000 0000000 #-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
links = {'cxxtest' : '../../../../'}
cxxtest-4.4/build_tools/SCons/test/recursive_sources/src/ 0000775 0000000 0000000 00000000000 12343514423 0023750 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/recursive_sources/src/requirement.cpp 0000664 0000000 0000000 00000000405 12343514423 0027013 0 ustar 00root root 0000000 0000000 /**
* @file requirement.cpp
* Implementation of the requirement function.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:09:42 AM
*/
#include "requirement.h"
bool call_a_requirement() {
return true;
}
cxxtest-4.4/build_tools/SCons/test/recursive_sources/src/requirement.h 0000664 0000000 0000000 00000000416 12343514423 0026462 0 ustar 00root root 0000000 0000000 #ifndef REQUIREMENT_H
#define REQUIREMENT_H
/**
* @file requirement.h
* Prototype for the call_a_requirement() function.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:08:35 AM
*/
bool call_a_requirement();
#endif
cxxtest-4.4/build_tools/SCons/test/recursive_sources/src/test_bar.t.h 0000664 0000000 0000000 00000000633 12343514423 0026170 0 ustar 00root root 0000000 0000000 #ifndef TEST_BAR_T_H
#define TEST_BAR_T_H
/**
* @file test_bar.t.h
* Test one for the joint test ehm, test.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:04:06 AM
*/
#include
#include "requirement.h"
class TestBar : public CxxTest::TestSuite
{
public:
void test_foo() {
TS_ASSERT(call_a_requirement());
}
};
#endif
cxxtest-4.4/build_tools/SCons/test/recursive_sources/src/test_foo.t.h 0000664 0000000 0000000 00000000633 12343514423 0026207 0 ustar 00root root 0000000 0000000 #ifndef TEST_FOO_T_H
#define TEST_FOO_T_H
/**
* @file test_foo.t.h
* Test one for the joint test ehm, test.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:02:06 AM
*/
#include "requirement.h"
#include
class TestFoo : public CxxTest::TestSuite
{
public:
void test_foo() {
TS_ASSERT(call_a_requirement());
}
};
#endif
cxxtest-4.4/build_tools/SCons/test/string_cpppath/ 0000775 0000000 0000000 00000000000 12343514423 0022434 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/string_cpppath/SConstruct 0000664 0000000 0000000 00000000300 12343514423 0024457 0 ustar 00root root 0000000 0000000
env = Environment(
toolpath=['../../'],
tools=['default','cxxtest'],
CXXTEST_INSTALL_DIR = '../../../../',
CPPPATH = 'src/cpppathdir/'
)
env.CxxTest(['src/cpppath.t.h'])
cxxtest-4.4/build_tools/SCons/test/string_cpppath/TestDef.py 0000664 0000000 0000000 00000000000 12343514423 0024332 0 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/string_cpppath/src/ 0000775 0000000 0000000 00000000000 12343514423 0023223 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/string_cpppath/src/cpppath.t.h 0000664 0000000 0000000 00000000717 12343514423 0025302 0 ustar 00root root 0000000 0000000 #ifndef CPPPATH_T_H
#define CPPPATH_T_H
/**
* @file cpppath.t.h
* This file needs the include in the include dir.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-28 11:16:46 AM
*/
// actual path cpppathdir/include.h
#include "include.h"
#include
class CppPathTest : public CxxTest::TestSuite
{
public:
void test_i_need_me_exists() {
TS_ASSERT(i_need_me() == 0);
}
};
#endif
cxxtest-4.4/build_tools/SCons/test/string_cpppath/src/cpppathdir/ 0000775 0000000 0000000 00000000000 12343514423 0025361 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/string_cpppath/src/cpppathdir/include.h 0000664 0000000 0000000 00000000364 12343514423 0027160 0 ustar 00root root 0000000 0000000 #ifndef INCLUDE_H
#define INCLUDE_H
/**
* @file include.h
* Include file for this test.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-28 11:15:40 AM
*/
int i_need_me() {
return 0;
}
#endif
cxxtest-4.4/build_tools/SCons/test/target_syntax/ 0000775 0000000 0000000 00000000000 12343514423 0022303 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/target_syntax/SConstruct 0000664 0000000 0000000 00000000274 12343514423 0024340 0 ustar 00root root 0000000 0000000
env = Environment(
toolpath=['../../'],
tools=['default','cxxtest'],
CXXTEST_INSTALL_DIR = '../../../../',
CPPPATH = ['src/cpppathdir/']
)
env.CxxTest('src/cpppath')
cxxtest-4.4/build_tools/SCons/test/target_syntax/TestDef.py 0000664 0000000 0000000 00000000000 12343514423 0024201 0 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/target_syntax/src/ 0000775 0000000 0000000 00000000000 12343514423 0023072 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/target_syntax/src/cpppath.t.h 0000664 0000000 0000000 00000000717 12343514423 0025151 0 ustar 00root root 0000000 0000000 #ifndef CPPPATH_T_H
#define CPPPATH_T_H
/**
* @file cpppath.t.h
* This file needs the include in the include dir.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-28 11:16:46 AM
*/
// actual path cpppathdir/include.h
#include "include.h"
#include
class CppPathTest : public CxxTest::TestSuite
{
public:
void test_i_need_me_exists() {
TS_ASSERT(i_need_me() == 0);
}
};
#endif
cxxtest-4.4/build_tools/SCons/test/target_syntax/src/cpppathdir/ 0000775 0000000 0000000 00000000000 12343514423 0025230 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/SCons/test/target_syntax/src/cpppathdir/include.h 0000664 0000000 0000000 00000000364 12343514423 0027027 0 ustar 00root root 0000000 0000000 #ifndef INCLUDE_H
#define INCLUDE_H
/**
* @file include.h
* Include file for this test.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-28 11:15:40 AM
*/
int i_need_me() {
return 0;
}
#endif
cxxtest-4.4/build_tools/cmake/ 0000775 0000000 0000000 00000000000 12343514423 0016463 5 ustar 00root root 0000000 0000000 cxxtest-4.4/build_tools/cmake/CxxTest.cmake 0000664 0000000 0000000 00000001307 12343514423 0021070 0 ustar 00root root 0000000 0000000
include("${CMAKE_CURRENT_LIST_DIR}/FindCxxTest.cmake")
function(cxx_test target source)
get_filename_component(CPP_FILE_NAME ${source} NAME)
string(REGEX REPLACE "h$|hpp$" "cpp" CPP_FILE_NAME ${CPP_FILE_NAME})
message(${CPP_FILE_NAME})
set(CPP_FULL_NAME "${CMAKE_CURRENT_BINARY_DIR}/${CPP_FILE_NAME}")
add_custom_command(
OUTPUT "${CPP_FULL_NAME}"
COMMAND ${CXXTESTGEN} --runner=ErrorPrinter --output "${CPP_FULL_NAME}" "${source}"
DEPENDS "${source}"
)
add_executable(${target} ${CPP_FULL_NAME})
set_target_properties(${target} PROPERTIES COMPILE_FLAGS "-Wno-effc++")
add_test(${target} ${RUNTIME_OUTPUT_DIRECTORY}/${target})
endfunction(cxx_test)
cxxtest-4.4/build_tools/cmake/FindCxxTest.cmake 0000664 0000000 0000000 00000002012 12343514423 0021663 0 ustar 00root root 0000000 0000000 IF (DEFINED FIND_CXXTEST_CMAKE_INCLUDED)
RETURN()
ENDIF (DEFINED FIND_CXXTEST_CMAKE_INCLUDED)
SET(FIND_CXXTEST_CMAKE_INCLUDED true)
FIND_PROGRAM(CXXTESTGEN
NAMES cxxtestgen
PATHS "${CXXTEST_PATH}/bin"
"${PROJECT_SOURCE_DIR}/cxxtest/bin"
"${PROJECT_SOURCE_DIR}/lib/cxxtest/bin"
"${PROJECT_BINARY_DIR}/cxxtest/bin"
"${PROJECT_BINARY_DIR}/lib/cxxtest/bin"
/usr/bin
/bin
)
FIND_PATH(CXXTEST_INCLUDES
NAMES "cxxtest/TestSuite.h"
PATHS "${CXXTEST_PATH}"
"${PROJECT_SOURCE_DIR}/cxxtest/"
"${PROJECT_SOURCE_DIR}/lib/cxxtest/"
)
IF(NOT CXXTESTGEN)
MESSAGE(FATAL_ERROR "Unable to find 'cxxtestgen'")
SET(CXXTEST_FOUND false)
ELSEIF(NOT CXXTEST_INCLUDES)
SET(CXXTEST_FOUND false)
ELSE(NOT CXXTESTGEN)
SET(CXXTEST_FOUND true)
SET(CXXTEST_ROOT ${CXXTEST_INCLUDES})
ENDIF(NOT CXXTESTGEN)
SET(CXXTEST_CMAKE_MODULES_PATH "${CMAKE_CURRENT_LIST_DIR}")
INCLUDE("${CXXTEST_CMAKE_MODULES_PATH}/CxxTest.cmake")
cxxtest-4.4/cxxtest/ 0000775 0000000 0000000 00000000000 12343514423 0014566 5 ustar 00root root 0000000 0000000 cxxtest-4.4/cxxtest/Descriptions.cpp 0000664 0000000 0000000 00000003761 12343514423 0017747 0 ustar 00root root 0000000 0000000 /*
-------------------------------------------------------------------------
CxxTest: A lightweight C++ unit testing library.
Copyright (c) 2008 Sandia Corporation.
This software is distributed under the LGPL License v3
For more information, see the COPYING file in the top CxxTest directory.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------
*/
#ifndef __cxxtest__Descriptions_cpp__
#define __cxxtest__Descriptions_cpp__
#include
namespace CxxTest
{
TestDescription::~TestDescription() {}
SuiteDescription::~SuiteDescription() {}
WorldDescription::~WorldDescription() {}
//
// Convert total tests to string
//
#ifndef _CXXTEST_FACTOR
char *WorldDescription::strTotalTests(char *s) const
{
numberToString(numTotalTests(), s);
return s;
}
#else // _CXXTEST_FACTOR
char *WorldDescription::strTotalTests(char *s) const
{
char *p = numberToString(numTotalTests(), s);
if (numTotalTests() <= 1)
{
return s;
}
unsigned n = numTotalTests();
unsigned numFactors = 0;
for (unsigned factor = 2; (factor * factor) <= n; factor += (factor == 2) ? 1 : 2)
{
unsigned power;
for (power = 0; (n % factor) == 0; n /= factor)
{
++ power;
}
if (!power)
{
continue;
}
p = numberToString(factor, copyString(p, (numFactors == 0) ? " = " : " * "));
if (power > 1)
{
p = numberToString(power, copyString(p, "^"));
}
++ numFactors;
}
if (n > 1)
{
if (!numFactors)
{
copyString(p, tracker().failedTests() ? " :(" : tracker().warnings() ? " :|" : " :)");
}
else
{
numberToString(n, copyString(p, " * "));
}
}
return s;
}
#endif // _CXXTEST_FACTOR
}
#endif // __cxxtest__Descriptions_cpp__
cxxtest-4.4/cxxtest/Descriptions.h 0000664 0000000 0000000 00000005151 12343514423 0017407 0 ustar 00root root 0000000 0000000 /*
-------------------------------------------------------------------------
CxxTest: A lightweight C++ unit testing library.
Copyright (c) 2008 Sandia Corporation.
This software is distributed under the LGPL License v3
For more information, see the COPYING file in the top CxxTest directory.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------
*/
#ifndef __cxxtest__Descriptions_h__
#define __cxxtest__Descriptions_h__
//
// TestDescription, SuiteDescription and WorldDescription
// hold information about tests so they can be run and reported.
//
#include
namespace CxxTest
{
class TestSuite;
class TestDescription : public Link
{
public:
virtual ~TestDescription();
virtual const char *file() const = 0;
virtual int line() const = 0;
virtual const char *testName() const = 0;
virtual const char *suiteName() const = 0;
virtual void run() = 0;
virtual bool setUp() = 0;
virtual bool tearDown() = 0;
virtual const TestDescription *next() const = 0;
virtual TestDescription *next() = 0;
};
class SuiteDescription : public Link
{
public:
virtual ~SuiteDescription();
virtual const char *file() const = 0;
virtual int line() const = 0;
virtual const char *suiteName() const = 0;
virtual TestSuite *suite() const = 0;
virtual unsigned numTests() const = 0;
virtual const TestDescription &testDescription(unsigned /*i*/) const = 0;
virtual TestDescription *firstTest() = 0;
virtual const TestDescription *firstTest() const = 0;
virtual SuiteDescription *next() = 0;
virtual const SuiteDescription *next() const = 0;
virtual void activateAllTests() = 0;
virtual bool leaveOnly(const char * /*testName*/) = 0;
virtual bool setUp() = 0;
virtual bool tearDown() = 0;
};
class WorldDescription : public Link
{
public:
virtual ~WorldDescription();
virtual const char *worldName() const { return "cxxtest"; }
virtual unsigned numSuites(void) const = 0;
virtual unsigned numTotalTests(void) const = 0;
virtual const SuiteDescription &suiteDescription(unsigned /*i*/) const = 0;
enum { MAX_STRLEN_TOTAL_TESTS = 32 };
char *strTotalTests(char * /*buffer*/) const;
virtual SuiteDescription *firstSuite() = 0;
virtual const SuiteDescription *firstSuite() const = 0;
virtual void activateAllTests() = 0;
virtual bool leaveOnly(const char * /*suiteName*/, const char * /*testName*/ = 0) = 0;
};
}
#endif // __cxxtest__Descriptions_h__
cxxtest-4.4/cxxtest/DummyDescriptions.cpp 0000664 0000000 0000000 00000005522 12343514423 0020760 0 ustar 00root root 0000000 0000000 /*
-------------------------------------------------------------------------
CxxTest: A lightweight C++ unit testing library.
Copyright (c) 2008 Sandia Corporation.
This software is distributed under the LGPL License v3
For more information, see the COPYING file in the top CxxTest directory.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------
*/
#include
namespace CxxTest
{
DummyTestDescription::DummyTestDescription() {}
const char *DummyTestDescription::file() const { return ""; }
int DummyTestDescription::line() const { return 0; }
const char *DummyTestDescription::testName() const { return ""; }
const char *DummyTestDescription::suiteName() const { return ""; }
bool DummyTestDescription::setUp() { return true;}
void DummyTestDescription::run() {}
bool DummyTestDescription::tearDown() { return true;}
TestDescription *DummyTestDescription::next() { return 0; }
const TestDescription *DummyTestDescription::next() const { return 0; }
DummySuiteDescription::DummySuiteDescription() : _test() {}
const char *DummySuiteDescription::file() const { return ""; }
int DummySuiteDescription::line() const { return 0; }
const char *DummySuiteDescription::suiteName() const { return ""; }
TestSuite *DummySuiteDescription::suite() const { return 0; }
unsigned DummySuiteDescription::numTests() const { return 0; }
const TestDescription &DummySuiteDescription::testDescription(unsigned) const { return _test; }
SuiteDescription *DummySuiteDescription::next() { return 0; }
TestDescription *DummySuiteDescription::firstTest() { return 0; }
const SuiteDescription *DummySuiteDescription::next() const { return 0; }
const TestDescription *DummySuiteDescription::firstTest() const { return 0; }
void DummySuiteDescription::activateAllTests() {}
bool DummySuiteDescription::leaveOnly(const char * /*testName*/) { return false; }
bool DummySuiteDescription::setUp() { return true;}
bool DummySuiteDescription::tearDown() { return true;}
DummyWorldDescription::DummyWorldDescription() : _suite() {}
unsigned DummyWorldDescription::numSuites(void) const { return 0; }
unsigned DummyWorldDescription::numTotalTests(void) const { return 0; }
const SuiteDescription &DummyWorldDescription::suiteDescription(unsigned) const { return _suite; }
SuiteDescription *DummyWorldDescription::firstSuite() { return 0; }
const SuiteDescription *DummyWorldDescription::firstSuite() const { return 0; }
void DummyWorldDescription::activateAllTests() {}
bool DummyWorldDescription::leaveOnly(const char * /*suiteName*/, const char * /*testName*/) { return false; }
bool DummyWorldDescription::setUp() { return true;}
bool DummyWorldDescription::tearDown() { return true;}
}
cxxtest-4.4/cxxtest/DummyDescriptions.h 0000664 0000000 0000000 00000004303 12343514423 0020421 0 ustar 00root root 0000000 0000000 /*
-------------------------------------------------------------------------
CxxTest: A lightweight C++ unit testing library.
Copyright (c) 2008 Sandia Corporation.
This software is distributed under the LGPL License v3
For more information, see the COPYING file in the top CxxTest directory.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------
*/
#ifndef __cxxtest__DummyDescriptions_h__
#define __cxxtest__DummyDescriptions_h__
//
// DummyTestDescription, DummySuiteDescription and DummyWorldDescription
//
#include
namespace CxxTest
{
class DummyTestDescription : public TestDescription
{
public:
DummyTestDescription();
const char *file() const;
int line() const;
const char *testName() const;
const char *suiteName() const;
bool setUp();
void run();
bool tearDown();
TestDescription *next();
const TestDescription *next() const;
};
class DummySuiteDescription : public SuiteDescription
{
public:
DummySuiteDescription();
const char *file() const;
int line() const;
const char *suiteName() const;
TestSuite *suite() const;
unsigned numTests() const;
const TestDescription &testDescription(unsigned) const;
SuiteDescription *next();
TestDescription *firstTest();
const SuiteDescription *next() const;
const TestDescription *firstTest() const;
void activateAllTests();
bool leaveOnly(const char * /*testName*/);
bool setUp();
bool tearDown();
private:
DummyTestDescription _test;
};
class DummyWorldDescription : public WorldDescription
{
public:
DummyWorldDescription();
unsigned numSuites(void) const;
unsigned numTotalTests(void) const;
const SuiteDescription &suiteDescription(unsigned) const;
SuiteDescription *firstSuite();
const SuiteDescription *firstSuite() const;
void activateAllTests();
bool leaveOnly(const char * /*suiteName*/, const char * /*testName*/ = 0);
bool setUp();
bool tearDown();
private:
DummySuiteDescription _suite;
};
}
#endif // __cxxtest__DummyDescriptions_h__
cxxtest-4.4/cxxtest/ErrorFormatter.h 0000664 0000000 0000000 00000025100 12343514423 0017712 0 ustar 00root root 0000000 0000000 /*
-------------------------------------------------------------------------
CxxTest: A lightweight C++ unit testing library.
Copyright (c) 2008 Sandia Corporation.
This software is distributed under the LGPL License v3
For more information, see the COPYING file in the top CxxTest directory.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------
*/
#ifndef __cxxtest__ErrorFormatter_h__
#define __cxxtest__ErrorFormatter_h__
//
// The ErrorFormatter is a TestListener that
// prints reports of the errors to an output
// stream. Since we cannot rely on the standard
// iostreams, this header defines a base class
// analogout to std::ostream.
//
#include
#include
#include
#include
#include
namespace CxxTest
{
class OutputStream
{
public:
virtual ~OutputStream() {}
virtual void flush() {};
virtual OutputStream &operator<<(unsigned /*number*/) { return *this; }
virtual OutputStream &operator<<(const char * /*string*/) { return *this; }
typedef void (*Manipulator)(OutputStream &);
virtual OutputStream &operator<<(Manipulator m) { m(*this); return *this; }
static void endl(OutputStream &o) { (o << "\n").flush(); }
};
class ErrorFormatter : public TestListener
{
public:
ErrorFormatter(OutputStream *o, const char *preLine = ":", const char *postLine = "",
const char *errorString = "Error",
const char *warningString = "Warning") :
_dotting(true),
_reported(false),
_o(o),
_preLine(preLine),
_postLine(postLine),
_errorString(errorString),
_warningString(warningString)
{
}
int run()
{
TestRunner::runAllTests(*this);
return tracker().failedTests();
}
void enterWorld(const WorldDescription& desc)
{
(*_o) << "Running " << desc.worldName() << " tests (" << totalTests << ")";
_o->flush();
_dotting = true;
_reported = false;
}
static void totalTests(OutputStream &o)
{
char s[WorldDescription::MAX_STRLEN_TOTAL_TESTS];
const WorldDescription &wd = tracker().world();
o << wd.strTotalTests(s) << (wd.numTotalTests() == 1 ? " test" : " tests");
}
void enterSuite(const SuiteDescription &)
{
_reported = false;
}
void enterTest(const TestDescription &)
{
_reported = false;
}
void leaveTest(const TestDescription &)
{
if (tracker().testSkipped())
{
(*_o) << "s";
_o->flush();
fflush(stdout);
_dotting = true;
}
else if (!tracker().testFailed())
{
(*_o) << ".";
_o->flush();
fflush(stdout);
_dotting = true;
}
}
void leaveWorld(const WorldDescription &desc)
{
if (!tracker().failedTests())
{
(*_o) << "OK!" << endl;
return;
}
newLine();
(*_o) << "Failed " << tracker().failedTests() << " and Skipped " << tracker().skippedTests() << " of " << totalTests << endl;
unsigned numPassed = desc.numTotalTests() - tracker().failedTests() - tracker().skippedTests();
unsigned numTotal = desc.numTotalTests() - tracker().skippedTests();
if (numTotal == 0)
{
(*_o) << "Success rate: 100%" << endl;
}
else
{
(*_o) << "Success rate: " << (unsigned)(numPassed * 100.0 / numTotal) << "%" << endl;
}
}
void trace(const char *file, int line, const char *expression)
{
stop(file, line) << "Trace: " <<
expression << endl;
}
void warning(const char *file, int line, const char *expression)
{
stop(file, line) << _warningString << ": " <<
expression << endl;
}
void skippedTest(const char *file, int line, const char *expression)
{
if(expression && strlen(expression) > 0)
stop(file, line) << _warningString << ": Test skipped: " <<
expression << endl;
}
void failedTest(const char *file, int line, const char *expression)
{
stop(file, line) << _errorString << ": Test failed: " <<
expression << endl;
}
void failedAssert(const char *file, int line, const char *expression)
{
stop(file, line) << _errorString << ": Assertion failed: " <<
expression << endl;
}
void failedAssertEquals(const char *file, int line,
const char *xStr, const char *yStr,
const char *x, const char *y)
{
stop(file, line) << _errorString << ": Expected (" <<
xStr << " == " << yStr << "), found (" <<
x << " != " << y << ")" << endl;
}
void failedAssertSameData(const char *file, int line,
const char *xStr, const char *yStr,
const char *sizeStr, const void *x,
const void *y, unsigned size)
{
stop(file, line) << _errorString << ": Expected " << sizeStr << " (" << size << ") bytes to be equal at (" <<
xStr << ") and (" << yStr << "), found:" << endl;
dump(x, size);
(*_o) << " differs from" << endl;
dump(y, size);
}
void failedAssertSameFiles(const char* file, int line,
const char*, const char*,
const char* explanation
)
{
stop(file, line) << _errorString << ": " << explanation << endl;
}
void failedAssertDelta(const char *file, int line,
const char *xStr, const char *yStr, const char *dStr,
const char *x, const char *y, const char *d)
{
stop(file, line) << _errorString << ": Expected (" <<
xStr << " == " << yStr << ") up to " << dStr << " (" << d << "), found (" <<
x << " != " << y << ")" << endl;
}
void failedAssertDiffers(const char *file, int line,
const char *xStr, const char *yStr,
const char *value)
{
stop(file, line) << _errorString << ": Expected (" <<
xStr << " != " << yStr << "), found (" <<
value << ")" << endl;
}
void failedAssertLessThan(const char *file, int line,
const char *xStr, const char *yStr,
const char *x, const char *y)
{
stop(file, line) << _errorString << ": Expected (" <<
xStr << " < " << yStr << "), found (" <<
x << " >= " << y << ")" << endl;
}
void failedAssertLessThanEquals(const char *file, int line,
const char *xStr, const char *yStr,
const char *x, const char *y)
{
stop(file, line) << _errorString << ": Expected (" <<
xStr << " <= " << yStr << "), found (" <<
x << " > " << y << ")" << endl;
}
void failedAssertRelation(const char *file, int line,
const char *relation, const char *xStr, const char *yStr,
const char *x, const char *y)
{
stop(file, line) << _errorString << ": Expected " << relation << "( " <<
xStr << ", " << yStr << " ), found !" << relation << "( " << x << ", " << y << " )" << endl;
}
void failedAssertPredicate(const char *file, int line,
const char *predicate, const char *xStr, const char *x)
{
stop(file, line) << _errorString << ": Expected " << predicate << "( " <<
xStr << " ), found !" << predicate << "( " << x << " )" << endl;
}
void failedAssertThrows(const char *file, int line,
const char *expression, const char *type,
bool otherThrown)
{
stop(file, line) << _errorString << ": Expected (" << expression << ") to throw (" <<
type << ") but it " << (otherThrown ? "threw something else" : "didn't throw") <<
endl;
}
void failedAssertThrowsNot(const char *file, int line, const char *expression)
{
stop(file, line) << _errorString << ": Expected (" << expression << ") not to throw, but it did" <<
endl;
}
protected:
OutputStream *outputStream() const
{
return _o;
}
private:
ErrorFormatter(const ErrorFormatter &);
ErrorFormatter &operator=(const ErrorFormatter &);
OutputStream &stop(const char *file, int line)
{
newLine();
reportTest();
return (*_o) << file << _preLine << line << _postLine << ": ";
}
void newLine(void)
{
if (_dotting)
{
(*_o) << endl;
_dotting = false;
}
}
void reportTest(void)
{
if (_reported)
{
return;
}
(*_o) << "In " << tracker().suite().suiteName() << "::" << tracker().test().testName() << ":" << endl;
_reported = true;
}
void dump(const void *buffer, unsigned size)
{
if (!buffer)
{
dumpNull();
}
else
{
dumpBuffer(buffer, size);
}
}
void dumpNull()
{
(*_o) << " (null)" << endl;
}
void dumpBuffer(const void *buffer, unsigned size)
{
unsigned dumpSize = size;
if (maxDumpSize() && dumpSize > maxDumpSize())
{
dumpSize = maxDumpSize();
}
const unsigned char *p = (const unsigned char *)buffer;
(*_o) << " { ";
for (unsigned i = 0; i < dumpSize; ++ i)
{
(*_o) << byteToHex(*p++) << " ";
}
if (dumpSize < size)
{
(*_o) << "... ";
}
(*_o) << "}" << endl;
}
static void endl(OutputStream &o)
{
OutputStream::endl(o);
}
bool _dotting;
bool _reported;
OutputStream *_o;
const char *_preLine;
const char *_postLine;
const char *_errorString;
const char *_warningString;
};
}
#endif // __cxxtest__ErrorFormatter_h__
cxxtest-4.4/cxxtest/ErrorPrinter.h 0000664 0000000 0000000 00000004132 12343514423 0017374 0 ustar 00root root 0000000 0000000 /*
-------------------------------------------------------------------------
CxxTest: A lightweight C++ unit testing library.
Copyright (c) 2008 Sandia Corporation.
This software is distributed under the LGPL License v3
For more information, see the COPYING file in the top CxxTest directory.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------
*/
#ifndef __cxxtest__ErrorPrinter_h__
#define __cxxtest__ErrorPrinter_h__
//
// The ErrorPrinter is a simple TestListener that
// just prints "OK" if everything goes well, otherwise
// reports the error in the format of compiler messages.
// The ErrorPrinter uses std::cout
//
#include
#ifndef _CXXTEST_HAVE_STD
# define _CXXTEST_HAVE_STD
#endif // _CXXTEST_HAVE_STD
#include
#include
#ifdef _CXXTEST_OLD_STD
# include
#else // !_CXXTEST_OLD_STD
# include
#endif // _CXXTEST_OLD_STD
namespace CxxTest
{
class ErrorPrinter : public ErrorFormatter
{
public:
ErrorPrinter(CXXTEST_STD(ostream) &o = CXXTEST_STD(cout), const char *preLine = ":", const char *postLine = "",
const char *errorString = "Error",
const char *warningString = "Warning") :
ErrorFormatter(new Adapter(o), preLine, postLine, errorString, warningString) {}
virtual ~ErrorPrinter() { delete outputStream(); }
private:
class Adapter : public OutputStream
{
CXXTEST_STD(ostream) &_o;
public:
Adapter(CXXTEST_STD(ostream) &o) : _o(o) {}
void flush() { _o.flush(); }
OutputStream &operator<<(const char *s) { _o << s; return *this; }
OutputStream &operator<<(Manipulator m) { return OutputStream::operator<<(m); }
OutputStream &operator<<(unsigned i)
{
char s[1 + 3 * sizeof(unsigned)];
numberToString(i, s);
_o << s;
return *this;
}
};
};
}
#endif // __cxxtest__ErrorPrinter_h__
cxxtest-4.4/cxxtest/Flags.h 0000664 0000000 0000000 00000011223 12343514423 0015772 0 ustar 00root root 0000000 0000000 /*
-------------------------------------------------------------------------
CxxTest: A lightweight C++ unit testing library.
Copyright (c) 2008 Sandia Corporation.
This software is distributed under the LGPL License v3
For more information, see the COPYING file in the top CxxTest directory.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------
*/
#ifndef __cxxtest__Flags_h__
#define __cxxtest__Flags_h__
//
// These are the flags that control CxxTest
//
#if !defined(CXXTEST_FLAGS)
# define CXXTEST_FLAGS
#endif // !CXXTEST_FLAGS
#if defined(CXXTEST_HAVE_EH) && !defined(_CXXTEST_HAVE_EH)
# define _CXXTEST_HAVE_EH
#endif // CXXTEST_HAVE_EH
#if defined(CXXTEST_HAVE_STD) && !defined(_CXXTEST_HAVE_STD)
# define _CXXTEST_HAVE_STD
#endif // CXXTEST_HAVE_STD
#if defined(CXXTEST_OLD_TEMPLATE_SYNTAX) && !defined(_CXXTEST_OLD_TEMPLATE_SYNTAX)
# define _CXXTEST_OLD_TEMPLATE_SYNTAX
#endif // CXXTEST_OLD_TEMPLATE_SYNTAX
#if defined(CXXTEST_OLD_STD) && !defined(_CXXTEST_OLD_STD)
# define _CXXTEST_OLD_STD
#endif // CXXTEST_OLD_STD
#if defined(CXXTEST_ABORT_TEST_ON_FAIL) && !defined(_CXXTEST_ABORT_TEST_ON_FAIL)
# define _CXXTEST_ABORT_TEST_ON_FAIL
#endif // CXXTEST_ABORT_TEST_ON_FAIL
#if defined(CXXTEST_NO_COPY_CONST) && !defined(_CXXTEST_NO_COPY_CONST)
# define _CXXTEST_NO_COPY_CONST
#endif // CXXTEST_NO_COPY_CONST
#if defined(CXXTEST_FACTOR) && !defined(_CXXTEST_FACTOR)
# define _CXXTEST_FACTOR
#endif // CXXTEST_FACTOR
#if defined(CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION) && !defined(_CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION)
# define _CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION
#endif // CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION
#if defined(CXXTEST_LONGLONG)
# if defined(_CXXTEST_LONGLONG)
# undef _CXXTEST_LONGLONG
# endif
# define _CXXTEST_LONGLONG CXXTEST_LONGLONG
#endif // CXXTEST_LONGLONG
#ifndef CXXTEST_MAX_DUMP_SIZE
# define CXXTEST_MAX_DUMP_SIZE 0
#endif // CXXTEST_MAX_DUMP_SIZE
#if defined(_CXXTEST_ABORT_TEST_ON_FAIL) && !defined(CXXTEST_DEFAULT_ABORT)
# define CXXTEST_DEFAULT_ABORT true
#endif // _CXXTEST_ABORT_TEST_ON_FAIL && !CXXTEST_DEFAULT_ABORT
#if !defined(CXXTEST_DEFAULT_ABORT)
# define CXXTEST_DEFAULT_ABORT false
#endif // !CXXTEST_DEFAULT_ABORT
#if defined(_CXXTEST_ABORT_TEST_ON_FAIL) && !defined(_CXXTEST_HAVE_EH)
# warning "CXXTEST_ABORT_TEST_ON_FAIL is meaningless without CXXTEST_HAVE_EH"
# undef _CXXTEST_ABORT_TEST_ON_FAIL
#endif // _CXXTEST_ABORT_TEST_ON_FAIL && !_CXXTEST_HAVE_EH
//
// Some minimal per-compiler configuration to allow us to compile
//
#ifdef __BORLANDC__
# if __BORLANDC__ <= 0x520 // Borland C++ 5.2 or earlier
# ifndef _CXXTEST_OLD_STD
# define _CXXTEST_OLD_STD
# endif
# ifndef _CXXTEST_OLD_TEMPLATE_SYNTAX
# define _CXXTEST_OLD_TEMPLATE_SYNTAX
# endif
# endif
# if __BORLANDC__ >= 0x540 // C++ Builder 4.0 or later
# ifndef _CXXTEST_NO_COPY_CONST
# define _CXXTEST_NO_COPY_CONST
# endif
# ifndef _CXXTEST_LONGLONG
# define _CXXTEST_LONGLONG __int64
# endif
# endif
#endif // __BORLANDC__
#ifdef _MSC_VER // Visual C++
# ifndef _CXXTEST_LONGLONG
# define _CXXTEST_LONGLONG __int64
# endif
# if (_MSC_VER >= 0x51E)
# ifndef _CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION
# define _CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION
# endif
# endif
# pragma warning( disable : 4127 )
# pragma warning( disable : 4290 )
# pragma warning( disable : 4511 )
# pragma warning( disable : 4512 )
# pragma warning( disable : 4514 )
#endif // _MSC_VER
#ifdef __GNUC__
# if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 9)
# ifndef _CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION
# define _CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION
# endif
# endif
# if defined(__LONG_LONG_MAX__) && !defined(__cplusplus)
# define _CXXTEST_LONGLONG long long
# endif
#endif // __GNUC__
#ifdef __DMC__ // Digital Mars
# ifndef _CXXTEST_OLD_STD
# define _CXXTEST_OLD_STD
# endif
#endif
#ifdef __SUNPRO_CC // Sun Studio C++
# if __SUNPRO_CC >= 0x510
# ifndef _CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION
# define _CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION
# endif
# endif
#endif
#ifdef __xlC__ // IBM XL C/C++
// Partial specialization may be supported before 7.0.0.3, but it is
// definitely supported after.
# if __xlC__ >= 0x0700
# ifndef _CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION
# define _CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION
# endif
# endif
#endif
#endif // __cxxtest__Flags_h__
cxxtest-4.4/cxxtest/GlobalFixture.cpp 0000664 0000000 0000000 00000002501 12343514423 0020037 0 ustar 00root root 0000000 0000000 /*
-------------------------------------------------------------------------
CxxTest: A lightweight C++ unit testing library.
Copyright (c) 2008 Sandia Corporation.
This software is distributed under the LGPL License v3
For more information, see the COPYING file in the top CxxTest directory.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------
*/
#ifndef __cxxtest__GlobalFixture_cpp__
#define __cxxtest__GlobalFixture_cpp__
#include
namespace CxxTest
{
bool GlobalFixture::setUpWorld() { return true; }
bool GlobalFixture::tearDownWorld() { return true; }
bool GlobalFixture::setUp() { return true; }
bool GlobalFixture::tearDown() { return true; }
GlobalFixture::GlobalFixture() { attach(_list); }
GlobalFixture::~GlobalFixture() { detach(_list); }
GlobalFixture *GlobalFixture::firstGlobalFixture() { return (GlobalFixture *)_list.head(); }
GlobalFixture *GlobalFixture::lastGlobalFixture() { return (GlobalFixture *)_list.tail(); }
GlobalFixture *GlobalFixture::nextGlobalFixture() { return (GlobalFixture *)next(); }
GlobalFixture *GlobalFixture::prevGlobalFixture() { return (GlobalFixture *)prev(); }
}
#endif // __cxxtest__GlobalFixture_cpp__
cxxtest-4.4/cxxtest/GlobalFixture.h 0000664 0000000 0000000 00000002124 12343514423 0017505 0 ustar 00root root 0000000 0000000 /*
-------------------------------------------------------------------------
CxxTest: A lightweight C++ unit testing library.
Copyright (c) 2008 Sandia Corporation.
This software is distributed under the LGPL License v3
For more information, see the COPYING file in the top CxxTest directory.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------
*/
#ifndef __cxxtest__GlobalFixture_h__
#define __cxxtest__GlobalFixture_h__
#include
namespace CxxTest
{
class GlobalFixture : public Link
{
public:
virtual bool setUpWorld();
virtual bool tearDownWorld();
virtual bool setUp();
virtual bool tearDown();
GlobalFixture();
virtual ~GlobalFixture();
static GlobalFixture *firstGlobalFixture();
static GlobalFixture *lastGlobalFixture();
GlobalFixture *nextGlobalFixture();
GlobalFixture *prevGlobalFixture();
private:
static List _list;
};
}
#endif // __cxxtest__GlobalFixture_h__
cxxtest-4.4/cxxtest/Gui.h 0000664 0000000 0000000 00000013165 12343514423 0015471 0 ustar 00root root 0000000 0000000 /*
-------------------------------------------------------------------------
CxxTest: A lightweight C++ unit testing library.
Copyright (c) 2008 Sandia Corporation.
This software is distributed under the LGPL License v3
For more information, see the COPYING file in the top CxxTest directory.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------
*/
#ifndef __CXXTEST__GUI_H
#define __CXXTEST__GUI_H
//
// GuiListener is a simple base class for the differes GUIs
// GuiTuiRunner combines a GUI with a text-mode error formatter
//
#include
namespace CxxTest
{
class GuiListener : public TestListener
{
public:
GuiListener() : _state(GREEN_BAR) {}
virtual ~GuiListener() {}
virtual void runGui(int &argc, char **argv, TestListener &listener)
{
enterGui(argc, argv);
TestRunner::runAllTests(listener);
leaveGui();
}
virtual void enterGui(int & /*argc*/, char ** /*argv*/) {}
virtual void leaveGui() {}
//
// The easy way is to implement these functions:
//
virtual void guiEnterWorld(unsigned /*numTotalTests*/) {}
virtual void guiEnterSuite(const char * /*suiteName*/) {}
virtual void guiEnterTest(const char * /*suiteName*/, const char * /*testName*/) {}
virtual void yellowBar() {}
virtual void redBar() {}
//
// The hard way is this:
//
void enterWorld(const WorldDescription &d) { guiEnterWorld(d.numTotalTests()); }
void enterSuite(const SuiteDescription &d) { guiEnterSuite(d.suiteName()); }
void enterTest(const TestDescription &d) { guiEnterTest(d.suiteName(), d.testName()); }
void leaveTest(const TestDescription &) {}
void leaveSuite(const SuiteDescription &) {}
void leaveWorld(const WorldDescription &) {}
void warning(const char * /*file*/, int /*line*/, const char * /*expression*/)
{
yellowBarSafe();
}
void skippedTest(const char * /*file*/, int /*line*/, const char * /*expression*/)
{
yellowBarSafe();
}
void failedTest(const char * /*file*/, int /*line*/, const char * /*expression*/)
{
redBarSafe();
}
void failedAssert(const char * /*file*/, int /*line*/, const char * /*expression*/)
{
redBarSafe();
}
void failedAssertEquals(const char * /*file*/, int /*line*/,
const char * /*xStr*/, const char * /*yStr*/,
const char * /*x*/, const char * /*y*/)
{
redBarSafe();
}
void failedAssertSameData(const char * /*file*/, int /*line*/,
const char * /*xStr*/, const char * /*yStr*/,
const char * /*sizeStr*/, const void * /*x*/,
const void * /*y*/, unsigned /*size*/)
{
redBarSafe();
}
void failedAssertDelta(const char * /*file*/, int /*line*/,
const char * /*xStr*/, const char * /*yStr*/, const char * /*dStr*/,
const char * /*x*/, const char * /*y*/, const char * /*d*/)
{
redBarSafe();
}
void failedAssertDiffers(const char * /*file*/, int /*line*/,
const char * /*xStr*/, const char * /*yStr*/,
const char * /*value*/)
{
redBarSafe();
}
void failedAssertLessThan(const char * /*file*/, int /*line*/,
const char * /*xStr*/, const char * /*yStr*/,
const char * /*x*/, const char * /*y*/)
{
redBarSafe();
}
void failedAssertLessThanEquals(const char * /*file*/, int /*line*/,
const char * /*xStr*/, const char * /*yStr*/,
const char * /*x*/, const char * /*y*/)
{
redBarSafe();
}
void failedAssertPredicate(const char * /*file*/, int /*line*/,
const char * /*predicate*/, const char * /*xStr*/, const char * /*x*/)
{
redBarSafe();
}
void failedAssertRelation(const char * /*file*/, int /*line*/,
const char * /*relation*/, const char * /*xStr*/, const char * /*yStr*/,
const char * /*x*/, const char * /*y*/)
{
redBarSafe();
}
void failedAssertThrows(const char * /*file*/, int /*line*/,
const char * /*expression*/, const char * /*type*/,
bool /*otherThrown*/)
{
redBarSafe();
}
void failedAssertThrowsNot(const char * /*file*/, int /*line*/,
const char * /*expression*/)
{
redBarSafe();
}
protected:
void yellowBarSafe()
{
if (_state < YELLOW_BAR)
{
yellowBar();
_state = YELLOW_BAR;
}
}
void redBarSafe()
{
if (_state < RED_BAR)
{
redBar();
_state = RED_BAR;
}
}
private:
enum { GREEN_BAR, YELLOW_BAR, RED_BAR } _state;
};
template
class GuiTuiRunner : public TeeListener
{
int* _argc;
char **_argv;
GuiT _gui;
TuiT _tui;
public:
GuiTuiRunner() : _argc(0), _argv(0) {}
void process_commandline(int& argc, char** argv)
{
_argc = &argc;
_argv = argv;
setFirst(_gui);
setSecond(_tui);
}
int run()
{
_gui.runGui(*_argc, _argv, *this);
return tracker().failedTests();
}
};
}
#endif //__CXXTEST__GUI_H
cxxtest-4.4/cxxtest/LinkedList.cpp 0000664 0000000 0000000 00000006234 12343514423 0017341 0 ustar 00root root 0000000 0000000 /*
-------------------------------------------------------------------------
CxxTest: A lightweight C++ unit testing library.
Copyright (c) 2008 Sandia Corporation.
This software is distributed under the LGPL License v3
For more information, see the COPYING file in the top CxxTest directory.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------
*/
#ifndef __cxxtest__LinkedList_cpp__
#define __cxxtest__LinkedList_cpp__
#include
namespace CxxTest
{
List GlobalFixture::_list = { 0, 0 };
List RealSuiteDescription::_suites = { 0, 0 };
void List::initialize()
{
_head = _tail = 0;
}
Link *List::head()
{
Link *l = _head;
while (l && !l->active())
{
l = l->next();
}
return l;
}
const Link *List::head() const
{
Link *l = _head;
while (l && !l->active())
{
l = l->next();
}
return l;
}
Link *List::tail()
{
Link *l = _tail;
while (l && !l->active())
{
l = l->prev();
}
return l;
}
const Link *List::tail() const
{
Link *l = _tail;
while (l && !l->active())
{
l = l->prev();
}
return l;
}
bool List::empty() const
{
return (_head == 0);
}
unsigned List::size() const
{
unsigned count = 0;
for (const Link *l = head(); l != 0; l = l->next())
{
++ count;
}
return count;
}
Link *List::nth(unsigned n)
{
Link *l = head();
while (n --)
{
l = l->next();
}
return l;
}
void List::activateAll()
{
for (Link *l = _head; l != 0; l = l->justNext())
{
l->setActive(true);
}
}
void List::leaveOnly(const Link &link)
{
for (Link *l = head(); l != 0; l = l->next())
{
if (l != &link)
{
l->setActive(false);
}
}
}
Link::Link() :
_next(0),
_prev(0),
_active(true)
{
}
Link::~Link()
{
}
bool Link::active() const
{
return _active;
}
void Link::setActive(bool value)
{
_active = value;
}
Link * Link::justNext()
{
return _next;
}
Link * Link::justPrev()
{
return _prev;
}
Link * Link::next()
{
Link *l = _next;
while (l && !l->_active)
{
l = l->_next;
}
return l;
}
Link * Link::prev()
{
Link *l = _prev;
while (l && !l->_active)
{
l = l->_prev;
}
return l;
}
const Link * Link::next() const
{
Link *l = _next;
while (l && !l->_active)
{
l = l->_next;
}
return l;
}
const Link * Link::prev() const
{
Link *l = _prev;
while (l && !l->_active)
{
l = l->_prev;
}
return l;
}
void Link::attach(List &l)
{
if (l._tail)
{
l._tail->_next = this;
}
_prev = l._tail;
_next = 0;
if (l._head == 0)
{
l._head = this;
}
l._tail = this;
}
void Link::detach(List &l)
{
if (_prev)
{
_prev->_next = _next;
}
else
{
l._head = _next;
}
if (_next)
{
_next->_prev = _prev;
}
else
{
l._tail = _prev;
}
}
}
#endif // __cxxtest__LinkedList_cpp__
cxxtest-4.4/cxxtest/LinkedList.h 0000664 0000000 0000000 00000002646 12343514423 0017011 0 ustar 00root root 0000000 0000000 /*
-------------------------------------------------------------------------
CxxTest: A lightweight C++ unit testing library.
Copyright (c) 2008 Sandia Corporation.
This software is distributed under the LGPL License v3
For more information, see the COPYING file in the top CxxTest directory.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------
*/
#ifndef __cxxtest__LinkedList_h__
#define __cxxtest__LinkedList_h__
#include
namespace CxxTest
{
struct List;
class Link;
struct List
{
Link *_head;
Link *_tail;
void initialize();
Link *head();
const Link *head() const;
Link *tail();
const Link *tail() const;
bool empty() const;
unsigned size() const;
Link *nth(unsigned n);
void activateAll();
void leaveOnly(const Link &link);
};
class Link
{
public:
Link();
virtual ~Link();
bool active() const;
void setActive(bool value = true);
Link *justNext();
Link *justPrev();
Link *next();
Link *prev();
const Link *next() const;
const Link *prev() const;
void attach(List &l);
void detach(List &l);
private:
Link *_next;
Link *_prev;
bool _active;
Link(const Link &);
Link &operator=(const Link &);
};
}
#endif // __cxxtest__LinkedList_h__
cxxtest-4.4/cxxtest/MSVCErrorPrinter.h 0000664 0000000 0000000 00000002557 12343514423 0020076 0 ustar 00root root 0000000 0000000 /*
-------------------------------------------------------------------------
CxxTest: A lightweight C++ unit testing library.
Copyright (c) 2008 Sandia Corporation.
This software is distributed under the LGPL License v3
For more information, see the COPYING file in the top CxxTest directory.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------
*/
#ifndef __cxxtest__MSVCErrorPrinter_h__
#define __cxxtest__MSVCErrorPrinter_h__
//
// The MSVCErrorPrinter is identical to the ErrorPrinter, except it
// prints the line number and error/warning strings in a format
// consistent with that generated by Microsoft's compiler.
//
// Strict error parsers (e.g. QtCreator's) expect each error to be
// followed by a proper-looking error code, so give them one to make
// them work. Same for warnings.
//
// C2999 : "Unknown error" from Visual Studio 6, no longer used.
// C4999 : "Unknown warning" from Visual Studio 6, no longer used.
//
#include
namespace CxxTest
{
class MSVCErrorPrinter : public ErrorPrinter
{
public:
MSVCErrorPrinter(CXXTEST_STD(ostream) &o = CXXTEST_STD(cout))
: ErrorPrinter(o, "(", ") ", "error C2999", "warning C4999") {}
};
}
#endif // __cxxtest__MSVCErrorPrinter_h__
cxxtest-4.4/cxxtest/Mock.h 0000664 0000000 0000000 00000030464 12343514423 0015637 0 ustar 00root root 0000000 0000000 /*
-------------------------------------------------------------------------
CxxTest: A lightweight C++ unit testing library.
Copyright (c) 2008 Sandia Corporation.
This software is distributed under the LGPL License v3
For more information, see the COPYING file in the top CxxTest directory.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------
*/
#ifndef __cxxtest__Mock_h__
#define __cxxtest__Mock_h__
namespace dummy_mock_ns {}
//
// The default namespace is T::
//
#ifndef CXXTEST_MOCK_NAMESPACE
# define CXXTEST_MOCK_NAMESPACE T
#endif // CXXTEST_MOCK_NAMESPACE
//
// MockTraits: What to return when no mock object has been created
//
#define __CXXTEST_MOCK__TRAITS \
namespace CXXTEST_MOCK_NAMESPACE \
{ \
template \
class MockTraits \
{ \
public: \
static T defaultValue() { return 0; } \
}; \
}
//
// extern "C" when needed
//
#ifdef __cplusplus
# define CXXTEST_EXTERN_C extern "C"
#else
# define CXXTEST_EXTERN_C
#endif // __cplusplus
//
// Prototypes: For "normal" headers
//
#define __CXXTEST_MOCK__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
namespace CXXTEST_MOCK_NAMESPACE { TYPE NAME ARGS; }
#define __CXXTEST_MOCK_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) \
__CXXTEST_MOCK__PROTOTYPE( MOCK, void, NAME, ARGS, REAL, CALL )
#define __CXXTEST_SUPPLY__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
TYPE REAL ARGS;
#define __CXXTEST_SUPPLY_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) \
__CXXTEST_SUPPLY__PROTOTYPE( MOCK, void, NAME, ARGS, REAL, CALL )
//
// Class declarations: For test files
//
#define __CXXTEST_MOCK__CLASS_DECLARATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
namespace CXXTEST_MOCK_NAMESPACE { \
class Base_##MOCK : public CxxTest::Link \
{ \
public: \
Base_##MOCK(); \
~Base_##MOCK(); \
bool setUp(); \
bool tearDown(); \
\
static Base_##MOCK ¤t(); \
\
virtual TYPE NAME ARGS = 0; \
\
private: \
static CxxTest::List _list; \
}; \
\
class Real_##MOCK : public Base_##MOCK \
{ \
public: \
TYPE NAME ARGS; \
}; \
\
class _Unimplemented_##MOCK : public Base_##MOCK \
{ \
public: \
TYPE NAME ARGS; \
}; \
}
#define __CXXTEST_MOCK_VOID__CLASS_DECLARATION( MOCK, NAME, ARGS, REAL, CALL ) \
__CXXTEST_MOCK__CLASS_DECLARATION( MOCK, void, NAME, ARGS, REAL, CALL )
#define __CXXTEST_SUPPLY__CLASS_DECLARATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
namespace CXXTEST_MOCK_NAMESPACE { \
class Base_##MOCK : public CxxTest::Link \
{ \
public: \
Base_##MOCK(); \
~Base_##MOCK(); \
bool setUp(); \
bool tearDown(); \
\
static Base_##MOCK ¤t(); \
\
virtual TYPE NAME ARGS = 0; \
\
private: \
static CxxTest::List _list; \
}; \
\
class _Unimplemented_##MOCK : public Base_##MOCK \
{ \
public: \
TYPE NAME ARGS; \
}; \
}
#define __CXXTEST_SUPPLY_VOID__CLASS_DECLARATION( MOCK, NAME, ARGS, REAL, CALL ) \
__CXXTEST_SUPPLY__CLASS_DECLARATION( MOCK, void, NAME, ARGS, REAL, CALL )
//
// Class implementation: For test source files
//
#define __CXXTEST_MOCK__COMMON_CLASS_IMPLEMENTATION( MOCK, NAME ) \
namespace CXXTEST_MOCK_NAMESPACE { \
\
CxxTest::List Base_##MOCK::_list = { 0, 0 }; \
\
Base_##MOCK::Base_##MOCK() { attach( _list ); } \
Base_##MOCK::~Base_##MOCK() { detach( _list ); } \
bool Base_##MOCK::setUp() { return true; } \
bool Base_##MOCK::tearDown() { return true; } \
\
Base_##MOCK &Base_##MOCK::current() \
{ \
if ( _list.empty() ) { \
static _Unimplemented_##MOCK unimplemented; \
} \
return *(Base_##MOCK *)_list.tail(); \
} \
}
#define __CXXTEST_MOCK__CLASS_IMPLEMENTATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
__CXXTEST_MOCK__COMMON_CLASS_IMPLEMENTATION( MOCK, NAME ) \
namespace CXXTEST_MOCK_NAMESPACE { \
TYPE Real_##MOCK::NAME ARGS \
{ \
return REAL CALL; \
} \
\
TYPE _Unimplemented_##MOCK::NAME ARGS \
{ \
while ( false ) {\
return NAME CALL; \
} \
__CXXTEST_MOCK_UNIMPLEMENTED( NAME, ARGS ); \
return MockTraits::defaultValue(); \
} \
\
TYPE NAME ARGS \
{ \
return Base_##MOCK::current().NAME CALL; \
} \
}
#define __CXXTEST_MOCK_VOID__CLASS_IMPLEMENTATION( MOCK, NAME, ARGS, REAL, CALL ) \
__CXXTEST_MOCK__COMMON_CLASS_IMPLEMENTATION( MOCK, NAME ) \
namespace CXXTEST_MOCK_NAMESPACE { \
void Real_##MOCK::NAME ARGS \
{ \
REAL CALL; \
} \
\
void _Unimplemented_##MOCK::NAME ARGS \
{ \
while ( false ) { \
NAME CALL; \
} \
__CXXTEST_MOCK_UNIMPLEMENTED( NAME, ARGS ); \
} \
\
void NAME ARGS \
{ \
Base_##MOCK::current().NAME CALL; \
} \
}
#define __CXXTEST_SUPPLY__CLASS_IMPLEMENTATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
__CXXTEST_MOCK__COMMON_CLASS_IMPLEMENTATION( MOCK, NAME ) \
namespace CXXTEST_MOCK_NAMESPACE { \
TYPE _Unimplemented_##MOCK::NAME ARGS \
{ \
while ( false ) { \
return NAME CALL; \
} \
__CXXTEST_MOCK_UNIMPLEMENTED( NAME, ARGS ); \
return MockTraits::defaultValue(); \
} \
} \
\
TYPE REAL ARGS \
{ \
return CXXTEST_MOCK_NAMESPACE::Base_##MOCK::current().NAME CALL; \
}
#define __CXXTEST_SUPPLY_VOID__CLASS_IMPLEMENTATION( MOCK, NAME, ARGS, REAL, CALL ) \
__CXXTEST_MOCK__COMMON_CLASS_IMPLEMENTATION( MOCK, NAME ) \
namespace CXXTEST_MOCK_NAMESPACE { \
void _Unimplemented_##MOCK::NAME ARGS \
{ \
while ( false ) { \
NAME CALL; \
} \
__CXXTEST_MOCK_UNIMPLEMENTED( NAME, ARGS ); \
} \
} \
\
void REAL ARGS \
{ \
CXXTEST_MOCK_NAMESPACE::Base_##MOCK::current().NAME CALL; \
} \
//
// Error for calling mock function w/o object
//
#define __CXXTEST_MOCK_UNIMPLEMENTED( NAME, ARGS ) \
TS_FAIL( CXXTEST_MOCK_NAMESPACE_STR #NAME #ARGS " called with no " \
CXXTEST_MOCK_NAMESPACE_STR "Base_" #NAME " object" ); \
#define CXXTEST_MOCK_NAMESPACE_STR __CXXTEST_STR(CXXTEST_MOCK_NAMESPACE) "::"
#define __CXXTEST_STR(X) __CXXTEST_XSTR(X)
#define __CXXTEST_XSTR(X) #X
#if defined(CXXTEST_MOCK_TEST_SOURCE_FILE)
//
// Test source file: Prototypes, class declarations and implementation
//
#include
__CXXTEST_MOCK__TRAITS
#define CXXTEST_MOCK( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
__CXXTEST_MOCK__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
__CXXTEST_MOCK__CLASS_DECLARATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
__CXXTEST_MOCK__CLASS_IMPLEMENTATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
using namespace dummy_mock_ns
#define CXXTEST_MOCK_VOID( MOCK, NAME, ARGS, REAL, CALL ) \
__CXXTEST_MOCK_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) \
__CXXTEST_MOCK_VOID__CLASS_DECLARATION( MOCK, NAME, ARGS, REAL, CALL ) \
__CXXTEST_MOCK_VOID__CLASS_IMPLEMENTATION( MOCK, NAME, ARGS, REAL, CALL ) \
using namespace dummy_mock_ns
#define CXXTEST_SUPPLY( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
__CXXTEST_SUPPLY__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
__CXXTEST_SUPPLY__CLASS_DECLARATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
__CXXTEST_SUPPLY__CLASS_IMPLEMENTATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
using namespace dummy_mock_ns
#define CXXTEST_SUPPLY_VOID( MOCK, NAME, ARGS, REAL, CALL ) \
__CXXTEST_SUPPLY_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) \
__CXXTEST_SUPPLY_VOID__CLASS_DECLARATION( MOCK, NAME, ARGS, REAL, CALL ) \
__CXXTEST_SUPPLY_VOID__CLASS_IMPLEMENTATION( MOCK, NAME, ARGS, REAL, CALL ) \
using namespace dummy_mock_ns
#elif defined(CXXTEST_FLAGS) || defined(CXXTEST_RUNNING)
//
// Test file other than source: Prototypes and class declarations
//
#include
__CXXTEST_MOCK__TRAITS;
#define CXXTEST_MOCK( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
__CXXTEST_MOCK__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
__CXXTEST_MOCK__CLASS_DECLARATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
using namespace dummy_mock_ns
#define CXXTEST_MOCK_VOID( MOCK, NAME, ARGS, REAL, CALL ) \
__CXXTEST_MOCK_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) \
__CXXTEST_MOCK_VOID__CLASS_DECLARATION( MOCK, NAME, ARGS, REAL, CALL ) \
using namespace dummy_mock_ns
#define CXXTEST_SUPPLY( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
__CXXTEST_SUPPLY__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
__CXXTEST_SUPPLY__CLASS_DECLARATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
using namespace dummy_mock_ns
#define CXXTEST_SUPPLY_VOID( MOCK, NAME, ARGS, REAL, CALL ) \
__CXXTEST_SUPPLY_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) \
__CXXTEST_SUPPLY_VOID__CLASS_DECLARATION( MOCK, NAME, ARGS, REAL, CALL ) \
using namespace dummy_mock_ns
#elif defined(CXXTEST_MOCK_REAL_SOURCE_FILE)
//
// Real source file: "Real" implementations
//
#define CXXTEST_MOCK( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
namespace CXXTEST_MOCK_NAMESPACE { TYPE NAME ARGS { return REAL CALL; } } using namespace dummy_mock_ns
#define CXXTEST_MOCK_VOID( MOCK, NAME, ARGS, REAL, CALL ) \
namespace CXXTEST_MOCK_NAMESPACE { void NAME ARGS { REAL CALL; } } using namespace dummy_mock_ns
#else
//
// Ordinary header file: Just prototypes
//
#define CXXTEST_MOCK( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
__CXXTEST_MOCK__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
using namespace dummy_mock_ns
#define CXXTEST_MOCK_VOID( MOCK, NAME, ARGS, REAL, CALL ) \
__CXXTEST_MOCK_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) \
using namespace dummy_mock_ns
#define CXXTEST_SUPPLY( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
__CXXTEST_SUPPLY__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
using namespace dummy_mock_ns
#define CXXTEST_SUPPLY_VOID( MOCK, NAME, ARGS, REAL, CALL ) \
__CXXTEST_SUPPLY_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) \
using namespace dummy_mock_ns
#endif // Ordinary header file
//
// How to supply extern "C" functions
//
#define CXXTEST_SUPPLY_C( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
CXXTEST_EXTERN_C __CXXTEST_SUPPLY__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
CXXTEST_SUPPLY( MOCK, TYPE, NAME, ARGS, REAL, CALL )
#define CXXTEST_SUPPLY_VOID_C( MOCK, NAME, ARGS, REAL, CALL ) \
CXXTEST_EXTERN_C __CXXTEST_SUPPLY_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) \
CXXTEST_SUPPLY_VOID( MOCK, NAME, ARGS, REAL, CALL )
//
// Usually we mean the global namespace
//
#define CXXTEST_MOCK_GLOBAL( TYPE, NAME, ARGS, CALL ) \
CXXTEST_MOCK( NAME, TYPE, NAME, ARGS, ::NAME, CALL )
#define CXXTEST_MOCK_VOID_GLOBAL( NAME, ARGS, CALL ) \
CXXTEST_MOCK_VOID( NAME, NAME, ARGS, ::NAME, CALL )
#define CXXTEST_SUPPLY_GLOBAL( TYPE, NAME, ARGS, CALL ) \
CXXTEST_SUPPLY( NAME, TYPE, NAME, ARGS, NAME, CALL )
#define CXXTEST_SUPPLY_VOID_GLOBAL( NAME, ARGS, CALL ) \
CXXTEST_SUPPLY_VOID( NAME, NAME, ARGS, NAME, CALL )
#define CXXTEST_SUPPLY_GLOBAL_C( TYPE, NAME, ARGS, CALL ) \
CXXTEST_SUPPLY_C( NAME, TYPE, NAME, ARGS, NAME, CALL )
#define CXXTEST_SUPPLY_VOID_GLOBAL_C( NAME, ARGS, CALL ) \
CXXTEST_SUPPLY_VOID_C( NAME, NAME, ARGS, NAME, CALL )
//
// What to return when no mock object has been created.
// The default value of 0 usually works, but some cases may need this.
//
#define CXXTEST_MOCK_DEFAULT_VALUE( TYPE, VALUE ) \
namespace CXXTEST_MOCK_NAMESPACE \
{ \
template<> \
class MockTraits \
{ \
public: \
static TYPE defaultValue() { return VALUE; } \
}; \
} using namespace dummy_mock_ns
#endif // __cxxtest__Mock_h__
cxxtest-4.4/cxxtest/ParenPrinter.h 0000664 0000000 0000000 00000001725 12343514423 0017355 0 ustar 00root root 0000000 0000000 /*
-------------------------------------------------------------------------
CxxTest: A lightweight C++ unit testing library.
Copyright (c) 2008 Sandia Corporation.
This software is distributed under the LGPL License v3
For more information, see the COPYING file in the top CxxTest directory.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------
*/
#ifndef __cxxtest__ParenPrinter_h__
#define __cxxtest__ParenPrinter_h__
//
// The ParenPrinter is identical to the ErrorPrinter, except it
// prints the line number in a format expected by some compilers
// (notably, MSVC).
//
#include
namespace CxxTest
{
class ParenPrinter : public ErrorPrinter
{
public:
ParenPrinter(CXXTEST_STD(ostream) &o = CXXTEST_STD(cout)) : ErrorPrinter(o, "(", ")") {}
};
}
#endif // __cxxtest__ParenPrinter_h__
cxxtest-4.4/cxxtest/QtGui.h 0000664 0000000 0000000 00000016651 12343514423 0016001 0 ustar 00root root 0000000 0000000 /*
-------------------------------------------------------------------------
CxxTest: A lightweight C++ unit testing library.
Copyright (c) 2008 Sandia Corporation.
This software is distributed under the LGPL License v3
For more information, see the COPYING file in the top CxxTest directory.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------
*/
#ifndef __cxxtest__QtGui_h__
#define __cxxtest__QtGui_h__
//
// The QtGui displays a simple progress bar using the Qt Toolkit. It
// has been tested with versions 2.x and 3.x.
//
// Apart from normal Qt command-line arguments, it accepts the following options:
// -minimized Start minimized, pop up on error
// -keep Don't close the window at the end
// -title TITLE Set the window caption
//
// If both are -minimized and -keep specified, GUI will only keep the
// window if it's in focus.
//
#include
#include
#include
#include
#include
#include
#include
#include
#include
namespace CxxTest
{
class QtGui : public GuiListener
{
public:
void enterGui(int &argc, char **argv)
{
parseCommandLine(argc, argv);
createApplication(argc, argv);
}
void enterWorld(const WorldDescription &wd)
{
createWindow(wd);
processEvents();
}
void guiEnterSuite(const char *suiteName)
{
showSuiteName(suiteName);
}
void guiEnterTest(const char *suiteName, const char *testName)
{
setCaption(suiteName, testName);
advanceProgressBar();
showTestName(testName);
showTestsDone(_progressBar->progress());
processEvents();
}
void yellowBar()
{
setColor(255, 255, 0);
setIcon(QMessageBox::Warning);
getTotalTests();
processEvents();
}
void redBar()
{
if (_startMinimized && _mainWindow->isMinimized())
{
showNormal();
}
setColor(255, 0, 0);
setIcon(QMessageBox::Critical);
getTotalTests();
processEvents();
}
void leaveGui()
{
if (keep())
{
showSummary();
_application->exec();
}
else
{
_mainWindow->close(true);
}
}
private:
QString _title;
bool _startMinimized, _keep;
unsigned _numTotalTests;
QString _strTotalTests;
QApplication *_application;
QWidget *_mainWindow;
QVBoxLayout *_layout;
QProgressBar *_progressBar;
QStatusBar *_statusBar;
QLabel *_suiteName, *_testName, *_testsDone;
void parseCommandLine(int argc, char **argv)
{
_startMinimized = _keep = false;
_title = argv[0];
for (int i = 1; i < argc; ++ i)
{
QString arg(argv[i]);
if (arg == "-minimized")
{
_startMinimized = true;
}
else if (arg == "-keep")
{
_keep = true;
}
else if (arg == "-title" && (i + 1 < argc))
{
_title = argv[++i];
}
}
}
void createApplication(int &argc, char **argv)
{
_application = new QApplication(argc, argv);
}
void createWindow(const WorldDescription &wd)
{
getTotalTests(wd);
createMainWindow();
createProgressBar();
createStatusBar();
setMainWidget();
if (_startMinimized)
{
showMinimized();
}
else
{
showNormal();
}
}
void getTotalTests()
{
getTotalTests(tracker().world());
}
void getTotalTests(const WorldDescription &wd)
{
_numTotalTests = wd.numTotalTests();
char s[WorldDescription::MAX_STRLEN_TOTAL_TESTS];
_strTotalTests = wd.strTotalTests(s);
}
void createMainWindow()
{
_mainWindow = new QWidget();
_layout = new QVBoxLayout(_mainWindow);
}
void createProgressBar()
{
_layout->addWidget(_progressBar = new QProgressBar(_numTotalTests, _mainWindow));
_progressBar->setProgress(0);
setColor(0, 255, 0);
setIcon(QMessageBox::Information);
}
void createStatusBar()
{
_layout->addWidget(_statusBar = new QStatusBar(_mainWindow));
_statusBar->addWidget(_suiteName = new QLabel(_statusBar), 2);
_statusBar->addWidget(_testName = new QLabel(_statusBar), 4);
_statusBar->addWidget(_testsDone = new QLabel(_statusBar), 1);
}
void setMainWidget()
{
_application->setMainWidget(_mainWindow);
}
void showMinimized()
{
_mainWindow->showMinimized();
}
void showNormal()
{
_mainWindow->showNormal();
centerWindow();
}
void setCaption(const QString &suiteName, const QString &testName)
{
_mainWindow->setCaption(_title + " - " + suiteName + "::" + testName + "()");
}
void showSuiteName(const QString &suiteName)
{
_suiteName->setText("class " + suiteName);
}
void advanceProgressBar()
{
_progressBar->setProgress(_progressBar->progress() + 1);
}
void showTestName(const QString &testName)
{
_testName->setText(testName + "()");
}
void showTestsDone(unsigned testsDone)
{
_testsDone->setText(asString(testsDone) + " of " + _strTotalTests);
}
static QString asString(unsigned n)
{
return QString::number(n);
}
void setColor(int r, int g, int b)
{
QPalette palette = _progressBar->palette();
palette.setColor(QColorGroup::Highlight, QColor(r, g, b));
_progressBar->setPalette(palette);
}
void setIcon(QMessageBox::Icon icon)
{
#if QT_VERSION >= 0x030000
_mainWindow->setIcon(QMessageBox::standardIcon(icon));
#else // Qt version < 3.0.0
_mainWindow->setIcon(QMessageBox::standardIcon(icon, QApplication::style().guiStyle()));
#endif // QT_VERSION
}
void processEvents()
{
_application->processEvents();
}
void centerWindow()
{
QWidget *desktop = QApplication::desktop();
int xCenter = desktop->x() + (desktop->width() / 2);
int yCenter = desktop->y() + (desktop->height() / 2);
int windowWidth = (desktop->width() * 4) / 5;
int windowHeight = _mainWindow->height();
_mainWindow->setGeometry(xCenter - (windowWidth / 2), yCenter - (windowHeight / 2), windowWidth, windowHeight);
}
bool keep()
{
if (!_keep)
{
return false;
}
if (!_startMinimized)
{
return true;
}
return (_mainWindow == _application->activeWindow());
}
void showSummary()
{
QString summary = _strTotalTests + (_numTotalTests == 1 ? " test" : " tests");
if (tracker().failedTests())
{
summary = "Failed " + asString(tracker().failedTests()) + " of " + summary;
}
else
{
summary = summary + " passed";
}
_mainWindow->setCaption(_title + " - " + summary);
_statusBar->removeWidget(_suiteName);
_statusBar->removeWidget(_testName);
_testsDone->setText(summary);
}
};
}
#endif // __cxxtest__QtGui_h__
cxxtest-4.4/cxxtest/RealDescriptions.cpp 0000664 0000000 0000000 00000023410 12343514423 0020544 0 ustar 00root root 0000000 0000000 /*
-------------------------------------------------------------------------
CxxTest: A lightweight C++ unit testing library.
Copyright (c) 2008 Sandia Corporation.
This software is distributed under the LGPL License v3
For more information, see the COPYING file in the top CxxTest directory.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------
*/
#ifndef __cxxtest__RealDescriptions_cpp__
#define __cxxtest__RealDescriptions_cpp__
//
// NOTE: If an error occur during world construction/deletion, CxxTest cannot
// know where the error originated.
//
#include
namespace CxxTest
{
RealTestDescription::RealTestDescription()
{
}
RealTestDescription::RealTestDescription(List &argList,
SuiteDescription &argSuite,
unsigned argLine,
const char *argTestName)
{
initialize(argList, argSuite, argLine, argTestName);
}
void RealTestDescription::initialize(List &argList,
SuiteDescription &argSuite,
unsigned argLine,
const char *argTestName)
{
_suite = &argSuite;
_line = argLine;
_testName = argTestName;
attach(argList);
}
bool RealTestDescription::setUp()
{
if (!suite())
{
return false;
}
for (GlobalFixture *gf = GlobalFixture::firstGlobalFixture(); gf != 0; gf = gf->nextGlobalFixture())
{
bool ok;
_TS_TRY { ok = gf->setUp(); }
_TS_LAST_CATCH( { ok = false; });
if (!ok)
{
doFailTest(file(), line(), "Error in GlobalFixture::setUp()");
return false;
}
}
_TS_TRY
{
bool ok = false;
_TSM_ASSERT_THROWS_NOTHING(file(), line(), "Exception thrown from setUp()", suite()->setUp(); ok = true);
if (ok == false) { return ok; }
}
_TS_CATCH_ABORT( { return false; })
_TS_CATCH_SKIPPED( { return false; });
return true;
}
bool RealTestDescription::tearDown()
{
if (!suite())
{
return false;
}
_TS_TRY
{
_TSM_ASSERT_THROWS_NOTHING(file(), line(), "Exception thrown from tearDown()", suite()->tearDown());
}
_TS_CATCH_ABORT( { return false; })
_TS_CATCH_SKIPPED( { return false; });
for (GlobalFixture *gf = GlobalFixture::lastGlobalFixture(); gf != 0; gf = gf->prevGlobalFixture())
{
bool ok;
_TS_TRY { ok = gf->tearDown(); }
_TS_LAST_CATCH( { ok = false; });
if (!ok)
{
doFailTest(file(), line(), "Error in GlobalFixture::tearDown()");
return false;
}
}
return true;
}
const char *RealTestDescription::file() const { return _suite->file(); }
int RealTestDescription::line() const { return _line; }
const char *RealTestDescription::testName() const { return _testName; }
const char *RealTestDescription::suiteName() const { return _suite->suiteName(); }
TestDescription *RealTestDescription::next() { return (RealTestDescription *)Link::next(); }
const TestDescription *RealTestDescription::next() const { return (const RealTestDescription *)Link::next(); }
TestSuite *RealTestDescription::suite() const { return _suite->suite(); }
void RealTestDescription::run()
{
_TS_TRY { runTest(); }
_TS_CATCH_ABORT( {})
_TS_CATCH_SKIPPED( {})
___TSM_CATCH(file(), line(), "Exception thrown from test");
}
RealSuiteDescription::RealSuiteDescription() {}
RealSuiteDescription::RealSuiteDescription(const char *argFile,
unsigned argLine,
const char *argSuiteName,
List &argTests)
{
initialize(argFile, argLine, argSuiteName, argTests);
}
void RealSuiteDescription::initialize(const char *argFile,
unsigned argLine,
const char *argSuiteName,
List &argTests)
{
_file = argFile;
_line = argLine;
_suiteName = argSuiteName;
_tests = &argTests;
attach(_suites);
}
const char *RealSuiteDescription::file() const { return _file; }
int RealSuiteDescription::line() const { return _line; }
const char *RealSuiteDescription::suiteName() const { return _suiteName; }
TestDescription *RealSuiteDescription::firstTest() { return (RealTestDescription *)_tests->head(); }
const TestDescription *RealSuiteDescription::firstTest() const { return (const RealTestDescription *)_tests->head(); }
SuiteDescription *RealSuiteDescription::next() { return (RealSuiteDescription *)Link::next(); }
const SuiteDescription *RealSuiteDescription::next() const { return (const RealSuiteDescription *)Link::next(); }
unsigned RealSuiteDescription::numTests() const { return _tests->size(); }
const TestDescription &RealSuiteDescription::testDescription(unsigned i) const
{
return *(RealTestDescription *)_tests->nth(i);
}
void RealSuiteDescription::activateAllTests()
{
_tests->activateAll();
}
bool RealSuiteDescription::leaveOnly(const char *testName)
{
for (TestDescription *td = firstTest(); td != 0; td = td->next())
{
if (stringsEqual(td->testName(), testName))
{
_tests->leaveOnly(*td);
return true;
}
}
return false;
}
StaticSuiteDescription::StaticSuiteDescription() {}
StaticSuiteDescription::StaticSuiteDescription(const char *argFile, unsigned argLine,
const char *argSuiteName, TestSuite &argSuite,
List &argTests) :
RealSuiteDescription(argFile, argLine, argSuiteName, argTests)
{
doInitialize(argSuite);
}
void StaticSuiteDescription::initialize(const char *argFile, unsigned argLine,
const char *argSuiteName, TestSuite &argSuite,
List &argTests)
{
RealSuiteDescription::initialize(argFile, argLine, argSuiteName, argTests);
doInitialize(argSuite);
}
void StaticSuiteDescription::doInitialize(TestSuite &argSuite)
{
_suite = &argSuite;
}
TestSuite *StaticSuiteDescription::suite() const
{
return _suite;
}
bool StaticSuiteDescription::setUp() { return true; }
bool StaticSuiteDescription::tearDown() { return true; }
CommonDynamicSuiteDescription::CommonDynamicSuiteDescription() {}
CommonDynamicSuiteDescription::CommonDynamicSuiteDescription(const char *argFile, unsigned argLine,
const char *argSuiteName, List &argTests,
unsigned argCreateLine, unsigned argDestroyLine) :
RealSuiteDescription(argFile, argLine, argSuiteName, argTests)
{
doInitialize(argCreateLine, argDestroyLine);
}
void CommonDynamicSuiteDescription::initialize(const char *argFile, unsigned argLine,
const char *argSuiteName, List &argTests,
unsigned argCreateLine, unsigned argDestroyLine)
{
RealSuiteDescription::initialize(argFile, argLine, argSuiteName, argTests);
doInitialize(argCreateLine, argDestroyLine);
}
void CommonDynamicSuiteDescription::doInitialize(unsigned argCreateLine, unsigned argDestroyLine)
{
_createLine = argCreateLine;
_destroyLine = argDestroyLine;
}
List &RealWorldDescription::suites()
{
return RealSuiteDescription::_suites;
}
unsigned RealWorldDescription::numSuites(void) const
{
return suites().size();
}
unsigned RealWorldDescription::numTotalTests(void) const
{
unsigned count = 0;
for (const SuiteDescription *sd = firstSuite(); sd != 0; sd = sd->next())
{
count += sd->numTests();
}
return count;
}
SuiteDescription *RealWorldDescription::firstSuite()
{
return (RealSuiteDescription *)suites().head();
}
const SuiteDescription *RealWorldDescription::firstSuite() const
{
return (const RealSuiteDescription *)suites().head();
}
const SuiteDescription &RealWorldDescription::suiteDescription(unsigned i) const
{
return *(const RealSuiteDescription *)suites().nth(i);
}
void RealWorldDescription::activateAllTests()
{
suites().activateAll();
for (SuiteDescription *sd = firstSuite(); sd != 0; sd = sd->next())
{
sd->activateAllTests();
}
}
bool RealWorldDescription::leaveOnly(const char *suiteName, const char *testName)
{
for (SuiteDescription *sd = firstSuite(); sd != 0; sd = sd->next())
{
if (stringsEqual(sd->suiteName(), suiteName))
{
if (testName)
{
if (!sd->leaveOnly(testName))
{
return false;
}
}
suites().leaveOnly(*sd);
return true;
}
}
return false;
}
bool RealWorldDescription::setUp()
{
for (GlobalFixture *gf = GlobalFixture::firstGlobalFixture(); gf != 0; gf = gf->nextGlobalFixture())
{
bool ok;
_TS_TRY
{
ok = gf->setUpWorld();
if (tracker().testFailed())
{
tracker().initialize();
ok = false;
}
}
_TS_LAST_CATCH( { ok = false; });
if (!ok)
{
reportError("Error setting up world");
return false;
}
}
return true;
}
bool RealWorldDescription::tearDown()
{
for (GlobalFixture *gf = GlobalFixture::lastGlobalFixture(); gf != 0; gf = gf->prevGlobalFixture())
{
bool ok;
_TS_TRY { ok = gf->tearDownWorld(); }
_TS_LAST_CATCH( { ok = false; });
if (!ok)
{
reportError("Error tearing down world");
return false;
}
}
return true;
}
void RealWorldDescription::reportError(const char *message)
{
doWarn(__FILE__, 5, message);
}
void activateAllTests()
{
RealWorldDescription().activateAllTests();
}
bool leaveOnly(const char *suiteName, const char *testName)
{
return RealWorldDescription().leaveOnly(suiteName, testName);
}
}
#endif // __cxxtest__RealDescriptions_cpp__
cxxtest-4.4/cxxtest/RealDescriptions.h 0000664 0000000 0000000 00000015222 12343514423 0020213 0 ustar 00root root 0000000 0000000 /*
-------------------------------------------------------------------------
CxxTest: A lightweight C++ unit testing library.
Copyright (c) 2008 Sandia Corporation.
This software is distributed under the LGPL License v3
For more information, see the COPYING file in the top CxxTest directory.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------
*/
#ifndef __cxxtest__RealDescriptions_h__
#define __cxxtest__RealDescriptions_h__
//
// The "real" description classes
//
#include
#include
#include
namespace CxxTest
{
class RealTestDescription : public TestDescription
{
public:
RealTestDescription();
RealTestDescription(List &argList, SuiteDescription &argSuite, unsigned argLine, const char *argTestName);
void initialize(List &argList, SuiteDescription &argSuite, unsigned argLine, const char *argTestName);
const char *file() const;
int line() const;
const char *testName() const;
const char *suiteName() const;
TestDescription *next();
const TestDescription *next() const;
TestSuite *suite() const;
bool setUp();
void run();
bool tearDown();
private:
RealTestDescription(const RealTestDescription &);
RealTestDescription &operator=(const RealTestDescription &);
virtual void runTest() = 0;
SuiteDescription *_suite;
int _line;
const char *_testName;
};
class RealSuiteDescription : public SuiteDescription
{
public:
RealSuiteDescription();
RealSuiteDescription(const char *argFile, unsigned argLine, const char *argSuiteName, List &argTests);
void initialize(const char *argFile, unsigned argLine, const char *argSuiteName, List &argTests);
const char *file() const;
int line() const;
const char *suiteName() const;
TestDescription *firstTest();
const TestDescription *firstTest() const;
SuiteDescription *next();
const SuiteDescription *next() const;
unsigned numTests() const;
const TestDescription &testDescription(unsigned i) const;
void activateAllTests();
bool leaveOnly(const char *testName);
private:
RealSuiteDescription(const RealSuiteDescription &);
RealSuiteDescription &operator=(const RealSuiteDescription &);
const char *_file;
int _line;
const char *_suiteName;
List *_tests;
static List _suites;
friend class RealWorldDescription;
};
class StaticSuiteDescription : public RealSuiteDescription
{
public:
StaticSuiteDescription();
StaticSuiteDescription(const char *argFile, unsigned argLine,
const char *argSuiteName, TestSuite &argSuite,
List &argTests);
void initialize(const char *argFile, unsigned argLine,
const char *argSuiteName, TestSuite &argSuite,
List &argTests);
TestSuite *suite() const;
bool setUp();
bool tearDown();
private:
StaticSuiteDescription(const StaticSuiteDescription &);
StaticSuiteDescription &operator=(const StaticSuiteDescription &);
void doInitialize(TestSuite &argSuite);
TestSuite *_suite;
};
class CommonDynamicSuiteDescription : public RealSuiteDescription
{
public:
CommonDynamicSuiteDescription();
CommonDynamicSuiteDescription(const char *argFile, unsigned argLine,
const char *argSuiteName, List &argTests,
unsigned argCreateLine, unsigned argDestroyLine);
void initialize(const char *argFile, unsigned argLine,
const char *argSuiteName, List &argTests,
unsigned argCreateLine, unsigned argDestroyLine);
protected:
unsigned _createLine, _destroyLine;
private:
void doInitialize(unsigned argCreateLine, unsigned argDestroyLine);
};
template
class DynamicSuiteDescription : public CommonDynamicSuiteDescription
{
public:
DynamicSuiteDescription() {}
DynamicSuiteDescription(const char *argFile, unsigned argLine,
const char *argSuiteName, List &argTests,
S *&argSuite, unsigned argCreateLine,
unsigned argDestroyLine) :
CommonDynamicSuiteDescription(argFile, argLine, argSuiteName, argTests, argCreateLine, argDestroyLine)
{
_suite = &argSuite;
}
void initialize(const char *argFile, unsigned argLine,
const char *argSuiteName, List &argTests,
S *&argSuite, unsigned argCreateLine,
unsigned argDestroyLine)
{
CommonDynamicSuiteDescription::initialize(argFile, argLine,
argSuiteName, argTests,
argCreateLine, argDestroyLine);
_suite = &argSuite;
}
TestSuite *suite() const { return realSuite(); }
bool setUp();
bool tearDown();
private:
S *realSuite() const { return *_suite; }
void setSuite(S *s) { *_suite = s; }
void createSuite()
{
setSuite(S::createSuite());
}
void destroySuite()
{
S *s = realSuite();
setSuite(0);
S::destroySuite(s);
}
S **_suite;
};
template
bool DynamicSuiteDescription::setUp()
{
_TS_TRY
{
_TSM_ASSERT_THROWS_NOTHING(file(), _createLine, "Exception thrown from createSuite()", createSuite());
_TSM_ASSERT(file(), _createLine, "createSuite() failed", suite() != 0);
}
_TS_CATCH_ABORT( { return false; })
_TS_CATCH_SKIPPED( { return false; });
return (suite() != 0);
}
template
bool DynamicSuiteDescription::tearDown()
{
if (!_suite)
{
return true;
}
_TS_TRY
{
_TSM_ASSERT_THROWS_NOTHING(file(), _destroyLine, "destroySuite() failed", destroySuite());
}
_TS_CATCH_ABORT( { return false; })
_TS_CATCH_SKIPPED( { return false; });
return true;
}
class RealWorldDescription : public WorldDescription
{
public:
static List &suites();
const char *worldName() const { return _worldName;}
unsigned numSuites(void) const;
unsigned numTotalTests(void) const;
SuiteDescription *firstSuite();
const SuiteDescription *firstSuite() const;
const SuiteDescription &suiteDescription(unsigned i) const;
void activateAllTests();
bool leaveOnly(const char *suiteName, const char *testName = 0);
bool setUp();
bool tearDown();
static void reportError(const char *message);
static const char *_worldName;
};
void activateAllTests();
bool leaveOnly(const char *suiteName, const char *testName = 0);
}
#endif // __cxxtest__RealDescriptions_h__
cxxtest-4.4/cxxtest/Root.cpp 0000664 0000000 0000000 00000001745 12343514423 0016224 0 ustar 00root root 0000000 0000000 /*
-------------------------------------------------------------------------
CxxTest: A lightweight C++ unit testing library.
Copyright (c) 2008 Sandia Corporation.
This software is distributed under the LGPL License v3
For more information, see the COPYING file in the top CxxTest directory.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------
*/
#ifndef __cxxtest__Root_cpp__
#define __cxxtest__Root_cpp__
//
// This file holds the "root" of CxxTest, i.e.
// the parts that must be in a source file file.
//
#include
#include
#include
#include
#include
#include
#include
#include
#endif // __cxxtest__Root_cpp__
cxxtest-4.4/cxxtest/SelfTest.h 0000664 0000000 0000000 00000001227 12343514423 0016472 0 ustar 00root root 0000000 0000000 /*
-------------------------------------------------------------------------
CxxTest: A lightweight C++ unit testing library.
Copyright (c) 2008 Sandia Corporation.
This software is distributed under the LGPL License v3
For more information, see the COPYING file in the top CxxTest directory.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------
*/
#ifndef __cxxtest_SelfTest_h__
#define __cxxtest_SelfTest_h__
#define CXXTEST_SUITE(name)
#define CXXTEST_CODE(member)
#endif // __cxxtest_SelfTest_h__
cxxtest-4.4/cxxtest/StdHeaders.h 0000664 0000000 0000000 00000001711 12343514423 0016765 0 ustar 00root root 0000000 0000000 /*
-------------------------------------------------------------------------
CxxTest: A lightweight C++ unit testing library.
Copyright (c) 2008 Sandia Corporation.
This software is distributed under the LGPL License v3
For more information, see the COPYING file in the top CxxTest directory.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------
*/
#ifndef __cxxtest_StdHeaders_h__
#define __cxxtest_StdHeaders_h__
//
// This file basically #includes the STL headers.
// It exists to support warning level 4 in Visual C++
//
#ifdef _MSC_VER
# pragma warning( push, 1 )
#endif // _MSC_VER
#include
#include
#include
#include