Skip to content

Commit

Permalink
Making single setup.py (#1773)
Browse files Browse the repository at this point in the history
AMSC is now in different location.
Removing crow/setup.py
Since directories were moved, changing in readme.
fixed library_report to find framework directory.
  • Loading branch information
joshua-cogliati-inl authored Feb 21, 2022
1 parent f8a2d72 commit 7342001
Show file tree
Hide file tree
Showing 37 changed files with 55 additions and 93 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ This project is supported by [Idaho National Laboratory](https://www.inl.gov/).

### License

Files in /crow/contrib and /framework/contrib are third party libraries that are not part of Raven and are provided here for covenience. These are under their own, seperate licensing which is described in those directories.
Files in crow/contrib, src/contrib and framework/contrib are third party libraries that are not part of Raven and are provided here for covenience. These are under their own, seperate licensing which is described in those directories.

Raven itself is licensed as follows:

Expand Down
4 changes: 1 addition & 3 deletions build_raven
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ if test `uname` = Darwin; then
fi

PIP_COMMAND=pip3
(cd $CROW_DIR && ${PIP_COMMAND} --verbose install . --upgrade --target ./install)

(cd $RAVEN_BUILD_DIR && ${PIP_COMMAND} --verbose install . --upgrade --target ./framework/contrib/AMSC)
(cd $RAVEN_BUILD_DIR && ${PIP_COMMAND} --verbose install . --upgrade --target ./install)

(cd $PYTHON_FMU_DIR && ./build_pythonfmu || echo PythonFMU build failed)

Expand Down
7 changes: 4 additions & 3 deletions clean_raven
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ rm -f ${RAVEN_DIR}/framework/contrib/AMSC/_amsc*.so \
${RAVEN_DIR}/src/contrib/amsc_wrap.cxx \
${RAVEN_DIR}/src/contrib/amsc_wrap.cpp \
${RAVEN_DIR}/src/contrib/amsc.py \
${RAVEN_DIR}/src/contrib/amsc.pyc \
${RAVE_DIR}/cow/install/
rm -Rf ${RAVEN_DIR}/build
${RAVEN_DIR}/src/contrib/amsc.pyc
rm -Rf ${RAVEN_DIR}/build \
${RAVEN_DIR}/crow/install/ \
${RAVEN_DIR}/install/
find ${RAVEN_DIR}/framework -name '*.pyc' -exec rm '{}' \;
find ${RAVEN_DIR}/scripts -name '*.pyc' -exec rm '{}' \;
find ${RAVEN_DIR}/rook -name '*.pyc' -exec rm '{}' \;
Expand Down
64 changes: 0 additions & 64 deletions crow/setup.py

This file was deleted.

1 change: 0 additions & 1 deletion framework/CustomDrivers/DriverUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ def setupCpp():
frameworkDir = findFramework()
from utils import utils
utils.find_crow(frameworkDir)
utils.add_path(os.path.join(frameworkDir,'contrib','AMSC'))
utils.add_path(os.path.join(frameworkDir,'contrib'))
##TODO REMOVE PP3 WHEN RAY IS AVAILABLE FOR WINDOWS
utils.add_path_recursively(os.path.join(frameworkDir,'contrib','pp'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def run(self, inputIn):

## Possibly load this here in case people have trouble building it, so it
## only errors if they try to use it?
from AMSC_Object import AMSC_Object
from AMSC.AMSC_Object import AMSC_Object

if self.__amsc is None:
self.__amsc = AMSC_Object(X=self.inputData, Y=self.outputData,
Expand Down
2 changes: 1 addition & 1 deletion framework/Samplers/LimitSurfaceSearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from math import ceil

import Distributions
from AMSC_Object import AMSC_Object
from AMSC.AMSC_Object import AMSC_Object
from utils import randomUtils
from utils import InputData, InputTypes
from .AdaptiveSampler import AdaptiveSampler
Expand Down
2 changes: 1 addition & 1 deletion framework/SupervisedLearning/MSR.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def __trainLocal__(self,featureVals,targetVals):

# # Possibly load this here in case people have trouble building it, so it
# # only errors if they try to use it?
from AMSC_Object import AMSC_Object
from AMSC.AMSC_Object import AMSC_Object

self.X = featureVals[:][:]
self.Y = targetVals
Expand Down
2 changes: 1 addition & 1 deletion framework/UI/TopologyWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

from sys import path

from AMSC_Object import QAMSC_Object
from AMSC.AMSC_Object import QAMSC_Object
from .BaseTopologicalView import BaseTopologicalView
from .TopologyMapView import TopologyMapView
from .SensitivityView import SensitivityView
Expand Down
3 changes: 2 additions & 1 deletion framework/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,8 @@ def find_crow(framework_dir):
ravenDir = os.path.dirname(framework_dir)
#Add the module directory to the search path.
crowDirs = [os.path.join(ravenDir,"crow"),
os.path.join(os.path.dirname(ravenDir),"crow")]
os.path.join(os.path.dirname(ravenDir),"crow"),
ravenDir]
if "CROW_DIR" in os.environ:
crowDirs.insert(0,os.path.join(os.environ["CROW_DIR"]))
for crowDir in crowDirs:
Expand Down
2 changes: 1 addition & 1 deletion scripts/TestHarness/testers/RavenFramework.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
RAVENDIR = os.path.abspath(os.path.join(myDir, '..', '..', '..', 'framework'))

#Need to add the directory for AMSC for doing module checks.
os.environ["PYTHONPATH"] = os.path.join(RAVENDIR, 'contrib') +\
os.environ["PYTHONPATH"] = os.path.join(RAVENDIR, '..', 'install') +\
os.pathsep + os.environ.get("PYTHONPATH", "")

scriptDir = os.path.abspath(os.path.join(RAVENDIR, '..', 'scripts'))
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion scripts/library_report
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ for module, found, message, version in report_list:
print(module,version,"\n",message,"\n")
else:
print(module+' not found\n')
framework_dir = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]),"framework"))
framework_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])),"framework"))
utils.find_crow(framework_dir)
try:
distribution1D = utils.findCrowModule('distribution1D')
Expand Down
55 changes: 41 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

BOOST_INCLUDE_DIR = os.path.join(CROW_DIR,'contrib','include')
RAVEN_INCLUDE_DIR = os.path.join('include','contrib')
DIST_INCLUDE_DIR = os.path.join(CROW_DIR,'include', 'distributions')
UTIL_INCLUDE_DIR = os.path.join(CROW_DIR,'include', 'utilities')

# We need a custom build order in order to ensure that amsc.py is available
# before we try to copy it to the target location
Expand All @@ -34,19 +36,44 @@ class CustomBuild(build):
('build_clib', build.has_c_libraries),
('build_scripts', build.has_scripts)]

include_dirs=[RAVEN_INCLUDE_DIR,BOOST_INCLUDE_DIR]
if sys.version_info.major > 2:
swig_opts=['-c++','-I'+RAVEN_INCLUDE_DIR, '-I'+BOOST_INCLUDE_DIR,'-py3']
else:
swig_opts=['-c++','-I'+RAVEN_INCLUDE_DIR, '-I'+BOOST_INCLUDE_DIR]

include_dirs=[RAVEN_INCLUDE_DIR,BOOST_INCLUDE_DIR, DIST_INCLUDE_DIR, UTIL_INCLUDE_DIR]
swig_opts=['-c++','-I'+RAVEN_INCLUDE_DIR, '-I'+BOOST_INCLUDE_DIR,'-I'+DIST_INCLUDE_DIR, '-I'+UTIL_INCLUDE_DIR, '-py3']
extra_compile_args=['-std=c++11']
setup(name='amsc',
version='0.0',
description='A library for computing the Approximate Morse-Smale Complex (AMSC)',
ext_modules=[Extension('_amsc',['src/contrib/amsc.i',
'src/contrib/UnionFind.cpp',
'src/contrib/AMSC.cpp'],
include_dirs=include_dirs, swig_opts=swig_opts,extra_compile_args=extra_compile_args)],
package_dir={'':'src/contrib'},
py_modules=['amsc'],
try:
eigen_flags = subprocess.check_output(["./scripts/find_eigen.py"]).decode("ascii")
except:
eigen_flags = ""
if eigen_flags.startswith("-I"):
include_dirs.append(eigen_flags[2:].rstrip())
setup(name='raven_cxx',
version='2.1',
description='RAVEN c++ dependenciences including A library for computing the Approximate Morse-Smale Complex (AMSC) and Crow probability tools',
package_dir={'AMSC': 'src/contrib/AMSC', 'crow_modules': 'src/crow_modules'},
ext_modules=[
Extension('crow_modules._distribution1D',
['src/crow_modules/distribution1D.i',
'src/distributions/distribution.cxx',
'src/utilities/MDreader.cxx',
'src/utilities/inverseDistanceWeigthing.cxx',
'src/utilities/microSphere.cxx',
'src/utilities/NDspline.cxx',
'src/utilities/ND_Interpolation_Functions.cxx',
'src/distributions/distributionNDBase.cxx',
'src/distributions/distributionNDNormal.cxx',
'src/distributions/distributionFunctions.cxx',
'src/distributions/DistributionContainer.cxx',
'src/distributions/distribution_1D.cxx',
'src/distributions/randomClass.cxx',
'src/distributions/distributionNDCartesianSpline.cxx'],
include_dirs=include_dirs,
swig_opts=swig_opts,
extra_compile_args=extra_compile_args),
Extension('crow_modules._randomENG',['src/crow_modules/randomENG.i','src/distributions/randomClass.cxx'],include_dirs=include_dirs,swig_opts=swig_opts,extra_compile_args=extra_compile_args),
Extension('crow_modules._interpolationND',['src/crow_modules/interpolationND.i','src/utilities/ND_Interpolation_Functions.cxx','src/utilities/NDspline.cxx','src/utilities/microSphere.cxx','src/utilities/inverseDistanceWeigthing.cxx','src/utilities/MDreader.cxx','src/distributions/randomClass.cxx'],include_dirs=include_dirs,swig_opts=swig_opts,extra_compile_args=extra_compile_args),
Extension('AMSC._amsc',['src/contrib/AMSC/amsc.i',
'src/contrib/AMSC/UnionFind.cpp',
'src/contrib/AMSC/AMSC.cpp'],
include_dirs=include_dirs, swig_opts=swig_opts,extra_compile_args=extra_compile_args)],
py_modules=['AMSC.amsc','crow_modules.distribution1D','crow_modules.randomENG','crow_modules.interpolationND', 'AMSC.AMSC_Object'],#+setuptools.find_packages('framework'),
cmdclass={'build': CustomBuild})
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added src/contrib/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 7342001

Please sign in to comment.