Skip to content

Commit

Permalink
import 3rd party script to support for local copies
Browse files Browse the repository at this point in the history
  • Loading branch information
carsten-forty2 committed Aug 22, 2022
1 parent f16439a commit 4cf06f6
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 5 deletions.
29 changes: 29 additions & 0 deletions core/scripts/buildThirdParty.sh
Expand Up @@ -171,19 +171,44 @@ SetCLANG_TOOLSET(){
fi
}

function copySRC_From_EXT_PATH(){
echo "GIMLI_THIRDPARTY_SRC: $GIMLI_THIRDPARTY_SRC"
if [ ! -d $_SRC_ ]; then
NAME=`basename $_SRC_`
echo "BASNAME=$NAME"
if [ ! -z $GIMLI_THIRDPARTY_SRC ]; then
echo "checking GIMLI_THIRDPARTY_SRC: $GIMLI_THIRDPARTY_SRC/$NAME"
if [ -d $GIMLI_THIRDPARTY_SRC/$NAME ]; then
echo "Found external Thirdparty Sources .. using them instead of downloading."
echo "cp -r $GIMLI_THIRDPARTY_SRC/$NAME $_SRC_"
cp -r $GIMLI_THIRDPARTY_SRC/$NAME $_SRC_
else
echo ".. not found."
fi
else
echo "GIMLI_THIRDPARTY_SRC no set"
fi
else
echo "$_SRC_ already exists"
fi
}

getWITH_WGET(){
_URL_=$1
_SRC_=$2
_PAC_=$3

echo "** get with wget ** " $_URL_ $_SRC_ $_PAC_
echo "wget -nc -nd $_URL_/$_PAC_"
echo "--------------------------------------------------"

if [ -n "$CLEAN" ]; then
rm -rf $_SRC_
#rm -rf $_PAC_
fi

copySRC_From_EXT_PATH

if [ ! -d $_SRC_ ]; then
echo "Copying sources into $_SRC_"
pushd $SRC_DIR
Expand Down Expand Up @@ -275,6 +300,8 @@ getWITH_GIT(){
echo "----GIT--$_URL_ -> $_SRC_ : $_BRANCH_----------------"
echo "--------------------------------------------------"

copySRC_From_EXT_PATH

if ( [ -d $_SRC_ ] ); then
pushd $_SRC_
"$GIT" stash
Expand All @@ -285,6 +312,8 @@ getWITH_GIT(){
"$GIT" clone $_URL_ $_SRC_
popd
fi


if [ -n $_BRANCH_ ]; then
pushd $_SRC_
echo $_SRC_ $_BRANCH_
Expand Down
21 changes: 17 additions & 4 deletions pygimli/core/load.py
Expand Up @@ -155,6 +155,9 @@ def load(fname, verbose=False, testAll=True, realName=None):
".xy": np.loadtxt, #
}

if fname.startswith('https://') or fname.startswith('http://'):
return getExampleData(fname)

if not os.path.exists(fname):
raise Exception("File or directory named %s does not exist." % (fname))

Expand Down Expand Up @@ -294,14 +297,24 @@ def getExampleFile(path, load=False, force=False, verbose=False, **kwargs):
repo = kwargs.pop('githubRepo', __gimliExampleDataRepo__)
branch = kwargs.pop('branch', 'master')

url = '/'.join(('https://raw.githubusercontent.com/', # RAW files
repo, branch, path))
fileName = ''
if not path.startswith('http://'):
url = '/'.join(('https://raw.githubusercontent.com/', # RAW files
repo, branch, path))

pg.info(f'Looking for {path} in {repo}')
pg.info(f'Looking for {path} in {repo}')

fileName = os.path.join(getCachePath(),
fileName = os.path.join(getCachePath(),
__gimliExampleDataBase__,
repo, branch, path)
else:
url = path
fileName = os.path.join(getCachePath(),
__gimliExampleDataBase__,
*url.split('http://')[1].split('/'),
)

pg.info(f'Looking for {url}')

if not os.path.exists(fileName) or force is True:
if verbose:
Expand Down
2 changes: 1 addition & 1 deletion pygimli/physics/ert/ertManager.py
Expand Up @@ -200,7 +200,7 @@ def simulate(self, mesh, scheme, res, **kwargs):
# >>> rhoa = data.get('rhoa').array()
# >>> phia = data.get('phia').array()
"""
pg.critical('Obsolete, do not use!. Use ert.simulate instead')
#pg.critical('Obsolete, do not use!. Use ert.simulate instead')

verbose = kwargs.pop('verbose', self.verbose)
calcOnly = kwargs.pop('calcOnly', False)
Expand Down
5 changes: 5 additions & 0 deletions pygimli/testing/test_show.py
Expand Up @@ -211,6 +211,11 @@ def testShowPV():
# Run from notebook
import pygimli as pg
from pygimli.testing.test_show import testShowPV
import pyvista as pv
print(pv.__version__)
import panel as pnl
print(pnl.__version__)
testShowPV()
"""
m1 = mt.createCube()
Expand Down

0 comments on commit 4cf06f6

Please sign in to comment.