Skip to content

Commit

Permalink
Merge branch 'master' into feature/9778_normToMonitorReturns
Browse files Browse the repository at this point in the history
  • Loading branch information
abuts committed Sep 5, 2014
2 parents 507fc6c + 2272a66 commit d0052bd
Show file tree
Hide file tree
Showing 1,034 changed files with 176,946 additions and 100,773 deletions.
26 changes: 26 additions & 0 deletions Code/Mantid/Build/CMake/FindSphinx.cmake
Expand Up @@ -6,13 +6,39 @@
# set:
# SPHINX_FOUND
# SPHINX_EXECUTABLE
#
#=============================================================
# main()
#=============================================================

find_program( SPHINX_EXECUTABLE NAME sphinx-build
PATHS ${CMAKE_LIBRARY_PATH}/Python27/Scripts
PATH_SUFFIXES bin
DOC "Sphinx documentation generator"
)

if (SPHINX_EXECUTABLE)
# run sphinx-build to attempt to get the version
execute_process (COMMAND ${SPHINX_EXECUTABLE} --version
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE version_string
ERROR_VARIABLE version_error_string
ERROR_STRIP_TRAILING_WHITESPACE)

# if it wasn't successful it is hiding in stderr
if (NOT version_string)
if ( version_error_string )
string (REGEX REPLACE "\n" ";" version_string ${version_error_string})
list (GET version_string 0 version_string)
else ( version_error_string )
set ( version_string "1.1.0" )
endif ( version_error_string )
endif (NOT version_string)

# chop out the version number
string (REGEX REPLACE ".*([0-9]+\\.[0-9]+\\.[0-9]+).*" "\\1" SPHINX_VERSION ${version_string})
endif (SPHINX_EXECUTABLE)

include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(Sphinx DEFAULT_MSG SPHINX_EXECUTABLE )
Expand Down
35 changes: 20 additions & 15 deletions Code/Mantid/Build/Jenkins/buildscript
Expand Up @@ -18,15 +18,24 @@ cmake --version
# OS X setup steps
###############################################################################
if [[ $(uname) == 'Darwin' ]]; then
cd $WORKSPACE/Code
./fetch_Third_Party.sh
cd $WORKSPACE
# Setup environment variables
source /opt/intel/bin/iccvars.sh intel64
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$WORKSPACE/Code/Third_Party/lib/mac64:/Library/Frameworks
# Make sure we pick up the Intel compiler
export CC=icc
export CXX=icpc
if [[ ${JOB_NAME} == *clang* ]]; then
# Assuming we are using the clang compiler
echo "Using clang/llvm compiler."
clang --version
else
# Assuming we are using the Intel compiler
cd $WORKSPACE/Code
./fetch_Third_Party.sh
cd $WORKSPACE
# Setup environment variables
source /opt/intel/bin/iccvars.sh intel64
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$WORKSPACE/Code/Third_Party/lib/mac64:/Library/Frameworks
# Make sure we pick up the Intel compiler
export CC=icc
export CXX=icpc
echo "Using Intel compiler."
icpc --version
fi
fi

###############################################################################
Expand Down Expand Up @@ -102,14 +111,10 @@ $SCL_ON_RHEL6 "ctest --output-on-failure -R MantidPlot"

###############################################################################
# Documentation
# Only run tests on RHEL6 incremental but have to build html on all platforms
# for a clean build so that it can be packaged
# Build Qt help on all platforms for a clean build so that it can be packaged
###############################################################################
if [[ "$ON_RHEL6" == true ]]; then
$SCL_ON_RHEL6 "make docs-test"
fi
if [[ "$CLEANBUILD" == true ]]; then
# Workaround so that the html target can find the properties file
# Workaround so that the target can find the properties file
# CMake doesn't easily allow environment variables on custom targets
if [[ $(uname) == 'Darwin' ]]; then
export MANTIDPATH=$PWD/bin
Expand Down
92 changes: 46 additions & 46 deletions Code/Mantid/Build/class_maker.py
Expand Up @@ -22,9 +22,9 @@ def write_header(subproject, classname, filename, args):
"""Write a class header file"""
print "Writing header file to %s" % filename
f = open(filename, 'w')

guard = "MANTID_%s_%s_H_" % (subproject.upper(), classname.upper())

# Create an Algorithm header; will not use it if not an algo
algorithm_header = """
virtual const std::string name() const;
Expand All @@ -44,15 +44,15 @@ def write_header(subproject, classname, filename, args):
author = commands.getoutput('git config user.name')
except:
pass

alg_class_declare = " : public API::Algorithm"
alg_include = '#include "MantidAPI/Algorithm.h"'

if not args.alg:
algorithm_header = ""
alg_class_declare = ""
alg_include = ""

# The full text
s = """#ifndef %s
#define %s
Expand All @@ -66,7 +66,7 @@ def write_header(subproject, classname, filename, args):
{
/** %s : TODO: DESCRIPTION
Copyright © %s ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
This file is part of Mantid.
Expand Down Expand Up @@ -116,23 +116,23 @@ def write_source(subproject, classname, filename, args):
"""Write a class source file"""
print "Writing source file to %s" % filename
f = open(filename, 'w')

algorithm_top = """
using Mantid::Kernel::Direction;
using Mantid::API::WorkspaceProperty;
// Register the algorithm into the AlgorithmFactory
DECLARE_ALGORITHM(%s)
""" % (classname)

algorithm_source = """
//----------------------------------------------------------------------------------------------
/// Algorithm's version for identification. @see Algorithm::version
int %s::version() const { return 1;};
/// Algorithm's category for identification. @see Algorithm::category
const std::string %s::category() const { return TODO: FILL IN A CATEGORY;}
Expand All @@ -156,13 +156,13 @@ def write_source(subproject, classname, filename, args):
// TODO Auto-generated execute stub
}
""" % (classname, classname, classname, classname, classname)
""" % (classname, classname, classname, classname, classname)

if not args.alg:
algorithm_top = ""
algorithm_source = ""

# ------- Now the normal class text ------------------------------
# ------- Now the normal class text ------------------------------
s = """#include "Mantid%s/%s%s.h"
namespace Mantid
Expand All @@ -177,14 +177,14 @@ def write_source(subproject, classname, filename, args):
%s::%s()
{
}
//----------------------------------------------------------------------------------------------
/** Destructor
*/
%s::~%s()
{
}
%s
} // namespace %s
Expand All @@ -195,7 +195,7 @@ def write_source(subproject, classname, filename, args):
f.close()



#======================================================================
def write_test(subproject, classname, filename, args):
"""Write a class test file"""
Expand All @@ -210,36 +210,36 @@ def write_test(subproject, classname, filename, args):
TS_ASSERT_THROWS_NOTHING( alg.initialize() )
TS_ASSERT( alg.isInitialized() )
}
void test_exec()
{
// Name of the output workspace.
std::string outWSName("%sTest_OutputWS");
%s alg;
TS_ASSERT_THROWS_NOTHING( alg.initialize() )
TS_ASSERT( alg.isInitialized() )
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("REPLACE_PROPERTY_NAME_HERE!!!!", "value") );
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputWorkspace", outWSName) );
TS_ASSERT_THROWS_NOTHING( alg.execute(); );
TS_ASSERT( alg.isExecuted() );
// Retrieve the workspace from data service. TODO: Change to your desired type
Workspace_sptr ws;
TS_ASSERT_THROWS_NOTHING( ws = AnalysisDataService::Instance().retrieveWS<Workspace>(outWSName) );
TS_ASSERT(ws);
if (!ws) return;
// TODO: Check the results
// Remove workspace from the data service.
AnalysisDataService::Instance().remove(outWSName);
}
""" % (classname,classname,classname);

if not args.alg:
algorithm_test = ""

s = """#ifndef %s
#define %s
Expand Down Expand Up @@ -274,18 +274,18 @@ class %sTest : public CxxTest::TestSuite
algorithm_test, guard)
f.write(s)
f.close()






#======================================================================
def write_rst(subproject, classname, filename, args):
"""Write an algorithm rst documentation file"""
print "Writing rst file to %s" % filename
f = open(filename, 'w')

s = """
.. algorithm::
Expand All @@ -298,13 +298,13 @@ def write_rst(subproject, classname, filename, args):
Description
-----------
TODO: Enter a full rst-markup description of your algorithm here.
TODO: Enter a full rst-markup description of your algorithm here.
Usage
-----
.. Try not to use files in your examples,
but if you cannot avoid it then the (small) files must be added to
.. Try not to use files in your examples,
but if you cannot avoid it then the (small) files must be added to
autotestdata\UsageData and the following tag unindented
.. include:: ../usagedata-note.txt
Expand All @@ -324,7 +324,7 @@ def write_rst(subproject, classname, filename, args):
Output:
.. testoutput:: %sExample
.. testoutput:: %sExample
The output workspace has ?? spectra
Expand All @@ -338,17 +338,17 @@ def write_rst(subproject, classname, filename, args):

#======================================================================
def generate(subproject, classname, overwrite, args):

# Directory at base of subproject
basedir, header_folder = find_basedir(args.project, subproject)

headerfile = os.path.join(basedir, "inc", header_folder, args.subfolder + classname + ".h")
sourcefile = os.path.join(basedir, "src", args.subfolder + classname + ".cpp")
testfile = os.path.join(basedir, "test", classname + "Test.h")
#up two from the subproject basedir and then docs\source\algorithms
mantiddir = os.path.dirname(os.path.dirname(basedir))
rstfile = os.path.join(mantiddir, "docs", "source", "algorithms", classname + "-v1.rst")

if args.header and not overwrite and os.path.exists(headerfile):
print "\nError! Header file %s already exists. Use --force to overwrite.\n" % headerfile
return
Expand All @@ -361,7 +361,7 @@ def generate(subproject, classname, overwrite, args):
if args.rst and args.alg and not overwrite and os.path.exists(rstfile):
print "\nError! Rst documentation file %s already exists. Use --force to overwrite.\n" % rstfile
return

print
if args.header:
write_header(subproject, classname, headerfile, args)
Expand All @@ -371,24 +371,24 @@ def generate(subproject, classname, overwrite, args):
write_test(subproject, classname, testfile, args)
if args.rst and args.alg:
write_rst(subproject, classname, rstfile, args)

# Insert into the cmake list
add_to_cmake(subproject, classname, args, args.subfolder)

print "\n Files were added to Framework/%s/CMakeLists.txt !" % (subproject)
print
print
# if not test_only:
# print "\tsrc/%s.cpp" % (classname)
# print "\tinc/Mantid%s/%s.h" % (subproject, classname)
# print "\ttest/%sTest.h" % (classname)
# print
# print



#======================================================================
if __name__ == "__main__":
parser = None

if useArgparse:
parser = argparse.ArgumentParser(description='Utility to create Mantid class files: header, source and test. version ' + VERSION)
parser.add_argument('subproject', metavar='SUBPROJECT', type=str,
Expand All @@ -413,10 +413,10 @@ def generate(subproject, classname, overwrite, args):
parser.add_argument('--alg', dest='alg', action='store_const',
const=True, default=False,
help='Create an Algorithm stub. This adds some methods common to algorithms.')
parser.add_argument('--subfolder', dest='subfolder',
parser.add_argument('--subfolder', dest='subfolder',
default="",
help='Put the source under a subfolder below the main part of the project, e.g. Geometry/Instrument.')
parser.add_argument('--project', dest='project',
parser.add_argument('--project', dest='project',
default="Framework",
help='The project in which this goes. Default: Framework. Can be MantidQt, Vates')
else:
Expand All @@ -440,10 +440,10 @@ def generate(subproject, classname, overwrite, args):
parser.add_option('--alg', dest='alg', action='store_const',
const=True, default=False,
help='Create an Algorithm stub. This adds some methods common to algorithms.')
parser.add_option('--subfolder', dest='subfolder',
parser.add_option('--subfolder', dest='subfolder',
default="",
help='Put the source under a subfolder below the main part of the project, e.g. Geometry/Instrument.')
parser.add_option('--project', dest='project',
parser.add_option('--project', dest='project',
default="Framework",
help='The project in which this goes. Default: Framework. Can be MantidQt, Vates')

Expand All @@ -464,5 +464,5 @@ def generate(subproject, classname, overwrite, args):
if args.subfolder != "":
if args.subfolder[-1:] != "/":
args.subfolder += "/"

generate(subproject, classname, overwrite, args)

0 comments on commit d0052bd

Please sign in to comment.