Skip to content

Commit

Permalink
converts from 4-space indents to 2-space indents
Browse files Browse the repository at this point in the history
  • Loading branch information
j-bryan committed Oct 11, 2024
1 parent 79d191f commit 9d8dc6c
Show file tree
Hide file tree
Showing 24 changed files with 1,144 additions and 1,144 deletions.
36 changes: 18 additions & 18 deletions package/build_force.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
# Have users point to the location of their conda installation so we can properly activate the
# conda environment that is being made. Use the "--conda-defs" option to specify this path.
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
--conda-defs)
CONDA_DEFS="$2"
shift
shift
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
key="$1"
case $key in
--conda-defs)
CONDA_DEFS="$2"
shift
shift
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done

# Establish conda environment
Expand All @@ -24,18 +24,18 @@ conda activate force_build_310

# Check that the conda environment is active. If not, exit.
if [[ $CONDA_DEFAULT_ENV != "force_build_310" ]]; then
echo "Conda environment not activated. Maybe the path to the conda installation is incorrect?"
echo "Provided conda path: $CONDA_DEFS"
exit 1
echo "Conda environment not activated. Maybe the path to the conda installation is incorrect?"
echo "Provided conda path: $CONDA_DEFS"
exit 1
fi

pip install cx_Freeze
pip install raven-framework heron-ravenframework teal-ravenframework
# If on macOS, use conda to install ipopt
if [[ "$OSTYPE" == "darwin"* ]]; then
# Note: The PyPI version of ipopt is not maintained and is severl major version
# behind the conda-forge distribution.
conda install -c conda-forge ipopt -y
# Note: The PyPI version of ipopt is not maintained and is severl major version
# behind the conda-forge distribution.
conda install -c conda-forge ipopt -y
fi

# Build the FORCE executables
Expand Down
10 changes: 5 additions & 5 deletions package/build_mac_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ cp -Rp docs /Volumes/FORCE/
# Move the "examples" and "docs" directories from the FORCE app bundle to the top level of the disk
# image to make them more accessible.
if [ -d FORCE.app/Contents/Resources/examples ]; then
mv /Volumes/FORCE/FORCE.app/Contents/Resources/examples /Volumes/FORCE/
mv /Volumes/FORCE/FORCE.app/Contents/Resources/examples /Volumes/FORCE/
else
echo "WARNING: No examples directory found in FORCE.app bundle"
echo "WARNING: No examples directory found in FORCE.app bundle"
fi
if [ -d FORCE.app/Contents/Resources/docs ]; then
mv FORCE.app/Contents/Resources/docs /Volumes/FORCE/
mv FORCE.app/Contents/Resources/docs /Volumes/FORCE/
else
echo "WARNING: No docs directory found in FORCE.app bundle"
echo "WARNING: No docs directory found in FORCE.app bundle"
fi

# Add .son file to Workbench app to provide a default HERON configuration
Expand All @@ -59,7 +59,7 @@ hdiutil detach /Volumes/FORCE

# Convert to read-only compressed image
if [ -f FORCE.dmg ]; then
rm FORCE.dmg
rm FORCE.dmg
fi
hdiutil convert force_build.dmg -format UDZO -o FORCE.dmg

Expand Down
50 changes: 25 additions & 25 deletions package/copy_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@ EXAMPLES_DIR="$SCRIPT_DIR/examples"

while [[ $# -gt 0 ]]
do
key="$1"
case $key in
--raven-dir)
RAVEN_DIR="$2"
shift
shift
;;
--heron-dir)
HERON_DIR="$2"
shift
shift
;;
--dest)
EXAMPLES_DIR="$2"
shift
shift
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
key="$1"
case $key in
--raven-dir)
RAVEN_DIR="$2"
shift
shift
;;
--heron-dir)
HERON_DIR="$2"
shift
shift
;;
--dest)
EXAMPLES_DIR="$2"
shift
shift
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done

# The examples we want to copy are the RAVEN user_guide tests, the HERON workshop tests, and the
Expand All @@ -40,17 +40,17 @@ EXAMPLES=($RAVEN_DIR/tests/framework/user_guide $HERON_DIR/data $HERON_DIR/tests
mkdir -p $EXAMPLES_DIR

for ex in ${EXAMPLES[@]}; do
cp -R "$ex" "$EXAMPLES_DIR"
cp -R "$ex" "$EXAMPLES_DIR"
done

# Clean up the copied examples, removing files and directories created when running the tests.
DIRS_TO_REMOVE=("__pycache__" "gold" "*_o")
for dirname in ${DIRS_TO_REMOVE[@]}; do
find $EXAMPLES_DIR -type d -name $dirname -exec rm -r {} \; 2>/dev/null
find $EXAMPLES_DIR -type d -name $dirname -exec rm -r {} \; 2>/dev/null
done
FILES_TO_REMOVE=("tests" "moped_input.xml" "outer.xml" "inner.xml" "cash.xml" "*.lib" "write_inner.py" "*.heron" "*.heron.xml")
for filename in ${FILES_TO_REMOVE[@]}; do
find $EXAMPLES_DIR -name $filename -exec rm {} \; 2>/dev/null
find $EXAMPLES_DIR -name $filename -exec rm {} \; 2>/dev/null
done

# If building on Mac, replace the %HERON_DATA% magic string with a relative path to the data
Expand Down
42 changes: 21 additions & 21 deletions package/heron.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,27 @@


if __name__ == '__main__':
# Adds the "local/bin" directory to the system path in order to find ipopt and other executables
add_local_bin_to_path()
# Adds the "local/bin" directory to the system path in order to find ipopt and other executables
add_local_bin_to_path()

# Parse the command line arguments
import argparse
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
parser = argparse.ArgumentParser(description='HERON')
parser.add_argument('-w', action='store_true', default=False, required=False, help='Run in the GUI')
parser.add_argument('--definition', action="store_true", dest="definition", help='HERON input file definition compatible with the NEAMS Workbench')
parser.add_argument('input', nargs='?', help='HERON input file')
args, unknown = parser.parse_known_args()
# Parse the command line arguments
import argparse
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
parser = argparse.ArgumentParser(description='HERON')
parser.add_argument('-w', action='store_true', default=False, required=False, help='Run in the GUI')
parser.add_argument('--definition', action="store_true", dest="definition", help='HERON input file definition compatible with the NEAMS Workbench')
parser.add_argument('input', nargs='?', help='HERON input file')
args, unknown = parser.parse_known_args()

# if the input file is not an xml file, assume it's an unknown argument
if args.input and not args.input.endswith('.xml'):
unknown.insert(0, args.input)
args.input = None
# remove the -w argument from sys.argv so it doesn't interfere with HERON's argument parsing
if args.w:
sys.argv.remove('-w')
# if the input file is not an xml file, assume it's an unknown argument
if args.input and not args.input.endswith('.xml'):
unknown.insert(0, args.input)
args.input = None
# remove the -w argument from sys.argv so it doesn't interfere with HERON's argument parsing
if args.w:
sys.argv.remove('-w')

if (args.w or not args.input) and not args.definition: # if asked to or if no file is passed, run the GUI
run_from_gui(main)
else:
main()
if (args.w or not args.input) and not args.definition: # if asked to or if no file is passed, run the GUI
run_from_gui(main)
else:
main()
86 changes: 43 additions & 43 deletions package/make_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,34 @@ NO_BUILD=0
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
--raven-dir)
RAVEN_DIR="$2"
shift
shift
;;
--heron-dir)
HERON_DIR="$2"
shift
shift
;;
--teal-dir)
TEAL_DIR="$2"
shift
shift
;;
--no-build)
NO_BUILD=1
shift
;;
--dest)
DOC_DIR="$2"
shift
shift
;;
*)
echo "Unknown option: $1"
exit 1
;;
--raven-dir)
RAVEN_DIR="$2"
shift
shift
;;
--heron-dir)
HERON_DIR="$2"
shift
shift
;;
--teal-dir)
TEAL_DIR="$2"
shift
shift
;;
--no-build)
NO_BUILD=1
shift
;;
--dest)
DOC_DIR="$2"
shift
shift
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done

Expand Down Expand Up @@ -80,27 +80,27 @@ for loc in RAVEN_DIR HERON_DIR TEAL_DIR; do

# If the build flag is set, build the documentation.
if [ $NO_BUILD -eq 0 ]; then
echo "Building documentation for $(basename ${!loc})"
if [[ -f "Makefile" ]] && command -v "make" >/dev/null 2>&1; then
make
elif [[ -f "make_docs.bat" ]] && [[ $OSTYPE == "msys" ]]; then
./make_docs.bat
elif [[ -f "make_docs.sh" ]]; then
bash make_docs.sh
else
echo "ERROR: No Makefile or make_docs.sh script found in $(basename ${!loc}) doc directory."
exit 1
fi
echo "Building documentation for $(basename ${!loc})"
if [[ -f "Makefile" ]] && command -v "make" >/dev/null 2>&1; then
make
elif [[ -f "make_docs.bat" ]] && [[ $OSTYPE == "msys" ]]; then
./make_docs.bat
elif [[ -f "make_docs.sh" ]]; then
bash make_docs.sh
else
echo "ERROR: No Makefile or make_docs.sh script found in $(basename ${!loc}) doc directory."
exit 1
fi
fi

# The PDFs that are generated are located in either a "pdfs" or "pdf" directory
if [ -d pdfs ]; then
cp pdfs/*.pdf $DOC_DIR
cp pdfs/*.pdf $DOC_DIR
elif [ -d pdf ]; then
cp pdf/*.pdf $DOC_DIR
cp pdf/*.pdf $DOC_DIR
else
echo "ERROR: No PDFs found in $(basename ${!loc}) doc directory."
exit 1
echo "ERROR: No PDFs found in $(basename ${!loc}) doc directory."
exit 1
fi

popd > /dev/null
Expand Down
66 changes: 33 additions & 33 deletions package/raven_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,36 @@


if __name__ == '__main__':
# For Windows, this is required to avoid an infinite loop when running a multiprocessing script from a frozen executable.
# cx_Freeze provides a hook for this that is supposed to be called automatically to fix this issue on all platforms,
# but for now, it doesn't seem to resolve the issue on macOS.
multiprocessing.freeze_support()

# Adds the "local/bin" directory to the system path in order to find ipopt and other executables
add_local_bin_to_path()

# Parse the command line arguments
import argparse
parser = argparse.ArgumentParser(description='RAVEN')
parser.add_argument('-w', action='store_true', default=False, required=False,help='Run in the GUI')
parser.add_argument('input', nargs='*', help='RAVEN input file')
args, unknown = parser.parse_known_args()

# More than one argument may be parsed for "input". Move any arguments that aren't an XML file to
# the unknown arguments list.
args_to_move = []
for arg in args.input:
if not arg.endswith('.xml'):
args_to_move.append(arg)
for arg in args_to_move:
args.input.remove(arg)
unknown.insert(0, arg)

# sys.argv is used by the main function, so we need to remove the -w argument
if args.w:
sys.argv.remove('-w')

if args.w or not args.input: # run the GUI if asked to (-w) or if no input file is given
run_from_gui(main, checkLibraries=True)
else:
sys.exit(main(True))
# For Windows, this is required to avoid an infinite loop when running a multiprocessing script from a frozen executable.
# cx_Freeze provides a hook for this that is supposed to be called automatically to fix this issue on all platforms,
# but for now, it doesn't seem to resolve the issue on macOS.
multiprocessing.freeze_support()

# Adds the "local/bin" directory to the system path in order to find ipopt and other executables
add_local_bin_to_path()

# Parse the command line arguments
import argparse
parser = argparse.ArgumentParser(description='RAVEN')
parser.add_argument('-w', action='store_true', default=False, required=False,help='Run in the GUI')
parser.add_argument('input', nargs='*', help='RAVEN input file')
args, unknown = parser.parse_known_args()

# More than one argument may be parsed for "input". Move any arguments that aren't an XML file to
# the unknown arguments list.
args_to_move = []
for arg in args.input:
if not arg.endswith('.xml'):
args_to_move.append(arg)
for arg in args_to_move:
args.input.remove(arg)
unknown.insert(0, arg)

# sys.argv is used by the main function, so we need to remove the -w argument
if args.w:
sys.argv.remove('-w')

if args.w or not args.input: # run the GUI if asked to (-w) or if no input file is given
run_from_gui(main, checkLibraries=True)
else:
sys.exit(main(True))
Loading

0 comments on commit 9d8dc6c

Please sign in to comment.