Skip to content

Commit

Permalink
Merge branch 'v1.5.0-release'
Browse files Browse the repository at this point in the history
  • Loading branch information
bam241 committed Dec 13, 2016
2 parents cff7a61 + dce012c commit b85396d
Show file tree
Hide file tree
Showing 52 changed files with 4,739 additions and 828 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Expand Up @@ -32,3 +32,10 @@ src/pyne_decay.cc
src/hdf5_back.cc
share/dbtypes.json
tests/db.h5
cyclus/cpp_typesystem.pxd
cyclus/typesystem.pxd
cyclus/typesystem.pyx
tests/libcyclus-orig.h5
tests/libcyclus-orig.sqlite
tests/libcyclus-test.h5
tests/libcyclus-test.sqlite
62 changes: 56 additions & 6 deletions CMakeLists.txt
Expand Up @@ -40,7 +40,7 @@ IF(NOT CYCLUS_DOC_ONLY)
RESULT_VARIABLE res_var)

IF(NOT "${res_var}" STREQUAL "0")
message(FATAL_ERROR "fetching decay source code failed, res_var = '${res_var}'")
message(FATAL_ERROR "fetching decay source code failed, res_var = '${res_var}'")
ENDIF()

##############################################################################################
Expand All @@ -57,6 +57,7 @@ IF(NOT CYCLUS_DOC_ONLY)
SET(CYCLUS_TEST_DIR "${PROJECT_SOURCE_DIR}/tests")
SET(CYCLUS_AGENTS_DIR "${PROJECT_SOURCE_DIR}/agents")
SET(CYCLUS_CMAKE_DIR "${PROJECT_SOURCE_DIR}/cmake")
SET(CYCLUS_PYSOURCE_DIR "${PROJECT_SOURCE_DIR}/cyclus")

# set cycpp var
SET(CYCPP "${CYCLUS_CLI_DIR}/cycpp.py")
Expand Down Expand Up @@ -134,14 +135,17 @@ IF(NOT CYCLUS_DOC_ONLY)
MESSAGE("-- Dependency Root Dir (DEPS_ROOT_DIR): ${DEPS_ROOT_DIR}")
if (DEPS_ROOT_DIR)
SET(DEPS_HINTS HINTS "${DEPS_ROOT_DIR}")
SET(DEPS_BIN_HINTS ${DEPS_HINTS} "${DEPS_ROOT_DIR}/bin")
SET(DEPS_LIB_HINTS ${DEPS_HINTS} "${DEPS_ROOT_DIR}/lib")
SET(DEPS_INCLUDE_HINTS HINTS "${DEPS_ROOT_DIR}/include")
else (DEPS_ROOT_DIR)
SET(DEPS_HINTS)
SET(DEPS_bin_HINTS)
SET(DEPS_LIB_HINTS)
SET(DEPS_INCLUDE_HINTS)
endif (DEPS_ROOT_DIR)
MESSAGE("-- Dependency Hints (DEPS_HINTS): ${DEPS_HINTS}")
MESSAGE("-- Dependency Binary Hints (DEPS_BIN_HINTS): ${DEPS_BIN_HINTS}")
MESSAGE("-- Dependency Library Hints (DEPS_LIB_HINTS): ${DEPS_LIB_HINTS}")
MESSAGE("-- Dependency Include Hints (DEPS_INCLUDE_HINTS): ${DEPS_INCLUDE_HINTS}")

Expand Down Expand Up @@ -251,6 +255,40 @@ IF(NOT CYCLUS_DOC_ONLY)
set(LIBS ${LIBS} ${ICUUC_LIBRARIES})
ENDIF(ICUUC_LIBRARIES)

#
# Cython & Python Bindings
#
# Use new Python library finder
find_package(PythonInterp)
find_package(PythonLibs)
message("-- PYTHON_EXECUTABLE: ${PYTHON_EXECUTABLE}")

# Include the CMake script UseCython.cmake. This defines add_cython_module().
# Instruction for use can be found at the top of cmake/UseCython.cmake.

FIND_PACKAGE(Cython)
message("-- Found Cython: ${Cython_FOUND}")
if(Cython_FOUND)
include(UseCython)
execute_process(COMMAND "${CYTHON_EXECUTABLE}" "-V"
ERROR_VARIABLE CYTHON_VERSION
ERROR_STRIP_TRAILING_WHITESPACE)
message(STATUS "Cython Version: ${CYTHON_VERSION}")

find_package(Numpy REQUIRED)
find_package(Jinja2 REQUIRED)

# With CMake, a clean separation can be made between the source tree and the
# build tree. When all source is compiled, as with pure C/C++, the source is
# no-longer needed in the build tree. However, with pure *.py source, the
# source is processed directly. To handle this, we reproduce the availability
# of the source files in the build tree.
add_custom_target(ReplicatePythonSourceTree ALL "${CMAKE_COMMAND}" -P
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/ReplicatePythonSourceTree.cmake"
"${CMAKE_CURRENT_BINARY_DIR}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
endif(Cython_FOUND)

##############################################################################################
#################################### end find libraries ######################################
##############################################################################################
Expand All @@ -270,7 +308,9 @@ IF(NOT CYCLUS_DOC_ONLY)
"${HDF5_INCLUDE_DIRS}"
"${Boost_INCLUDE_DIR}"
"${COIN_INCLUDE_DIRS}")

if(Cython_FOUND)
INCLUDE_DIRECTORIES("${NUMPY_INCLUDE_DIRS}")
endif(Cython_FOUND)
# set core version, one way or the other
IF(NOT "${CORE_VERSION}" STREQUAL "")
SET(core_version "${CORE_VERSION}")
Expand All @@ -280,23 +320,27 @@ IF(NOT CYCLUS_DOC_ONLY)
OUTPUT_STRIP_TRAILING_WHITESPACE)
ENDIF(NOT "${CORE_VERSION}" STREQUAL "")
IF("${core_version}" STREQUAL "")
MESSAGE(WARNING "Unable to read current core version, falling back to previous version. Core version will be set to -1")
SET(core_version "-1")
MESSAGE(WARNING "Unable to read current core version, falling back to previous version. Core version will be set to -1")
SET(core_version "-1")
ENDIF()
MESSAGE("-- core version set to: ${core_version}")
SET(ENV{CYCLUS_CORE_VERSION} "${core_version}")
MESSAGE("-- core version ($CYCLUS_CORE_VERSION) set to: ${core_version}")

ADD_SUBDIRECTORY("${CYCLUS_SHARE_DIR}")
ADD_SUBDIRECTORY("${CYCLUS_SOURCE_DIR}")
ADD_SUBDIRECTORY("${CYCLUS_TEST_DIR}")
ADD_SUBDIRECTORY("${CYCLUS_AGENTS_DIR}")
ADD_SUBDIRECTORY("${CYCLUS_CLI_DIR}")
ADD_SUBDIRECTORY("${CYCLUS_CMAKE_DIR}")
if(Cython_FOUND)
ADD_SUBDIRECTORY("${CYCLUS_PYSOURCE_DIR}")
endif(Cython_FOUND)

##############################################################################################
####################################### end includes #########################################
##############################################################################################

################# stub files #################################################################
################# custom install files #######################################################
INSTALL(
FILES
stubs/CMakeLists.txt
Expand Down Expand Up @@ -325,6 +369,12 @@ IF(NOT CYCLUS_DOC_ONLY)
DESTINATION share/cyclus/stubs/src
COMPONENT stubs
)

if(Cython_FOUND)
set(pyinstallscript "${CMAKE_CURRENT_BINARY_DIR}/cmake/SetupPyInstall.cmake")
configure_file(cmake/SetupPyInstall.cmake.in ${pyinstallscript} @ONLY)
install(SCRIPT ${pyinstallscript})
endif(Cython_FOUND)
##############################################################################################
################################## begin uninstall target ####################################
##############################################################################################
Expand Down
61 changes: 53 additions & 8 deletions DEPENDENCIES.rst
Expand Up @@ -37,7 +37,7 @@ Package Minimum Version

.. website_include_end
On some platforms, such as Ubuntu 14.04, the following are also necessary:
On some platforms, such as Ubuntu 16.04, the following are also necessary:

==================== ==================
Package Minimum Version
Expand All @@ -54,12 +54,20 @@ And a few optional dependencies:
Package Minimum Version
==================== ==================
doxygen (for docs) 1.7.6.1
tcmalloc (for speed) any?
tcmalloc (for speed) any
Cython 0.13.1
Python (dev version) 2.7 or 3.3+
Jinja2 any
NumPy 1.9+
Pandas any
==================== ==================

*Note that the Debian/Ubuntu package ``libtcmalloc`` is NOT discovered correctly
by our build system. Instead use ``libgoogle-perftools-dev``.*

*Also note that the development version of Python, Jinja2, NumPy, and Pandas are
only needed if Cython is installed.*

***********************
Installing Dependencies
***********************
Expand All @@ -73,7 +81,7 @@ Installing Dependencies (Linux and Unix)
This guide assumes that the user has root access (to issue ``sudo`` commands) and
access to a package manager or has some other suitable method of automatically
installing established libraries. This process was tested using a fresh install
of Ubuntu versions 14.04 and 16.04, using ``apt-get`` as the package
of Ubuntu versions 16.04, using ``apt-get`` as the package
manager (scroll down further for Mac OSX instructions).

The command to install a dependency takes the form of:
Expand Down Expand Up @@ -106,19 +114,56 @@ and (optionally):
#. libblas-dev
#. liblapack-dev
#. libgoogle-perftools-dev
#. python-dev or python3-dev
#. python-tables or python3-tables
#. python-pandas or python3-pandas
#. python-numpy or python3-numpy
#. python-nose or python3-nose
#. python-jinja2 or python3-jinja2
#. cython or cython3

For example, in order to install libxml++ (and libxml2) on your system, type:

.. code-block:: bash
sudo apt-get install libxml++2.6-dev
If you'd prefer to copy/paste, the following line will install all *Cyclus*
dependencies:
If you'd prefer to copy/paste, the following line will install all **required**
*Cyclus* dependencies:

.. code-block:: bash
sudo apt-get install -y cmake make libboost-all-dev libxml2-dev libxml++2.6-dev \
libsqlite3-dev libhdf5-serial-dev libbz2-dev coinor-libcbc-dev coinor-libcoinutils-dev \
coinor-libosi-dev coinor-libclp-dev coinor-libcgl-dev
And to install all *Cyclus* dependencies (**required and optional**):

- if using python 2.x:

.. code-block:: bash
sudo apt-get install -y cmake make libboost-all-dev libxml2-dev libxml++2.6-dev \
libsqlite3-dev libhdf5-serial-dev libbz2-dev coinor-libcbc-dev coinor-libcoinutils-dev \
coinor-libosi-dev coinor-libclp-dev coinor-libcgl-dev libblas-dev liblapack-dev g++ \
libgoogle-perftools-dev python-dev python-tables python-pandas python-numpy python-nose \
python-jinja2 cython
- if using python 3.x:

.. code-block:: bash
sudo apt-get install -y cmake make libboost-all-dev libxml2-dev libxml++2.6-dev \
libsqlite3-dev libhdf5-serial-dev libbz2-dev coinor-libcbc-dev coinor-libcoinutils-dev \
coinor-libosi-dev coinor-libclp-dev coinor-libcgl-dev libblas-dev liblapack-dev g++ \
libgoogle-perftools-dev python3-dev python3-tables python3-pandas python3-numpy python3-nose \
python3-jinja2 cython3
To determine which version of Python is already installed on your computer, run:

.. code-block:: bash
sudo apt-get install -y cmake make libboost-all-dev libxml2-dev libxml++2.6-dev libsqlite3-dev libhdf5-serial-dev libbz2-dev coinor-libcbc-dev coinor-libcoinutils-dev coinor-libosi-dev coinor-libclp-dev coinor-libcgl-dev libblas-dev liblapack-dev g++ libgoogle-perftools-dev
python -V
Boost Note
^^^^^^^^^^
Expand Down Expand Up @@ -173,9 +218,9 @@ required library package names is:

Then install Coin-Cbc from source. They can be downloaded to any directory on
your computer:

**Coin-Cbc**: Download and build using the svn command in the terminal:

.. code-block:: bash
svn co https://projects.coin-or.org/svn/Cbc/stable/2.8 Coin-Cbc
Expand Down
9 changes: 9 additions & 0 deletions INSTALL.rst
Expand Up @@ -56,6 +56,15 @@ You need to add ``~/.local/bin`` to the front of your ``$PATH``:
echo 'export PATH="$HOME/.local/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
On MacOSX you also need to add ~/.local/lib/pythonX.Y/site-packages to your
``$PYTHONPATH``:

.. code-block:: bash
echo "export PYTHONPATH=\"\$HOME/.local/lib/python`python -c 'import sys; \
print(".".join(map(str, sys.version_info[:2])))'`/site-packages:\$PYTHONPATH\"" >> ~/.bashrc
source ~/.bashrc
.. website_include_end
.. website_custom_start
Expand Down
4 changes: 3 additions & 1 deletion README.rst
Expand Up @@ -83,8 +83,10 @@ on the source code from github is fairly straightforward:
- to install Cyclus locally (in ``~/.local/``) just run: ``python install.py``
from the ``cyclus`` folder,

- finally, add the following Cyclus installation path (``~/.local/cyclus``) to
- finally, add the following Cyclus installation path (``~/.local/bin``) to
the **front** on your ``$PATH``.
- additionnaly if you are using MacOSX, also add
``~/.local/lib/pythonX.Y/site-packages`` to your ``$PYTHONPATH``

For more detailed installation procedure, and/or custom installation please
refer to the `INSTALLATION guide <INSTALL.rst>`_.
Expand Down
5 changes: 1 addition & 4 deletions circle.yml
Expand Up @@ -26,10 +26,7 @@ deployment:
- docker tag cyclus/cyclus:latest cyclus/cyclus:stable # creation
- docker push cyclus/cyclus:stable # push to docker depot
## DEB GENERATION
#ubuntu 14.04
- docker/deb-ci/build_upload_deb.sh 14 :
timeout: 1200 # set 20 minute timeout (to avoid CI to fail)
# Ubuntu 16.04
# Ubuntu 16.04
- docker/deb-ci/build_upload_deb.sh 16 :
timeout: 1200 # set 20 minute timeout (to avoid CI to fail)
## END DEB GENERATION
49 changes: 48 additions & 1 deletion cli/cycpp.py
Expand Up @@ -492,6 +492,7 @@ def transform_pass2(self, statement, sep):
annotations['type'] = state.canonize_type(vtype, vname,
statement=statement)
annotations['index'] = len(state.context[classname]['vars'])
annotations['shape'] = state.canonize_shape(annotations)
state.context[classname]['vars'][vname] = annotations
if 'alias' in annotations:
alias = annotations['alias']
Expand Down Expand Up @@ -813,12 +814,58 @@ def canonize_type(self, t, name="<member variable>", statement=None):
p=pformat(self.supported_types))
raise TypeError(msg)
return t

def _canonize_targs(self, newtname, targs):
newt = [newtname]
newt += [self.canonize_type(targ) for targ in targs]
return tuple(newt)

def canonize_shape(self, ann_dict):
"""This canonizes a shape. We take a look at the current shape, and
standardize its format if necessary. We append -1's to the shape if
its length does not match our expected length. Returns the new shape
or raises an error if the given shape was longer than expected.
"""
type_canon = ann_dict['type']
try:
current_shape = ann_dict['shape']
except KeyError:
ann_dict['shape'] = None
current_shape = ann_dict['shape']
new_shape = []
# Flatten list dimensions
if isinstance(type_canon, str):
result = [type_canon]
else:
result = list(type_canon)
i = 0
while i < len(result):
if isinstance(result[i], str):
i += 1
else:
temp = result[i][1:]
i += 1
for j in range(len(temp)):
result.insert(i+j, temp[j])
expected_shape_length = len(result)
# Shape wasn't given.
if current_shape is None:
new_shape = [-1] * expected_shape_length
# Shape is correct as is.
elif len(current_shape) == expected_shape_length:
new_shape = current_shape
# Shape is too short.
elif len(current_shape) < expected_shape_length:
diff = expected_shape_length - len(current_shape)
new_shape = current_shape.extend([-1] * diff)
# Shape is too long- we throw an error.
elif len(current_shape) > expected_shape_length:
err_string = ("Shape array for type {t} is not formatted correctly."
" Expected length {length} or less.")
raise ValueError(err_string.format(t=str(type_canon),
length=str(expected_shape_length)))
return new_shape

def canonize_class(self, cls, _usens=True):
"""This canonizes a classname. The class name need not be the current
class whose scope we are in, but may be any class whatsoever. Returns
Expand Down
22 changes: 5 additions & 17 deletions cmake/CMakeLists.txt
@@ -1,18 +1,6 @@
INSTALL(
FILES
FindCOIN.cmake
FindCyclus.cmake
FindGlib.cmake
FindGlibmm.cmake
FindHDF5.cmake
FindLibXML++.cmake
FindSigC++.cmake
FindSqlite3.cmake
FindTcmalloc.cmake
LibFindMacros.cmake
UseCyclus.cmake
cmake_uninstall.cmake.in
DESTINATION share/cyclus/cmake
COMPONENT core
)
file(GLOB find_use_files "*.cmake")
INSTALL(FILES ${find_use_files} cmake_uninstall.cmake.in
DESTINATION share/cyclus/cmake
COMPONENT core
)

0 comments on commit b85396d

Please sign in to comment.