Commit ce98119d authored by François Fortin's avatar François Fortin
Browse files

Merge branch 'sasa_xml_2_spaces_indentation_along_with_minor_modifications' into 'master'

reformated the indentation of xml files and made some minor changes on test_suite.py

See merge request !10
parents 09c69e3f ef3a4d28
Pipeline #196306 passed with stage
in 1 minute and 26 seconds
......@@ -4,6 +4,7 @@
macadam.py
metro.log
.idea/
usr/bin/
src/frontend/model
usr/share/metro/data/selftest/roadcast.xml
......@@ -11,4 +11,4 @@ test:
- python3 ./metro --selftest
- diff --ignore-matching-lines=".*<production-date>.*</production-date>" ../share/metro/data/selftest/roadcast.xml ../share/metro/data/selftest/roadcast_reference.xml
- cd /usr/local/metro/usr/share/metro/data/test_suite
- python3 test_suite.py -s case031, case034, case040, case046, case049
- python3 test_suite.py
......@@ -12,7 +12,7 @@ init_devel.sh
-------------
You need to run the 'init_devel.sh' script to prepare your working directory.
If the script complain about the environment variable "PYTHON_INCLUDE":
you need to set it to a valid value. Usualy, it will be something like:
you need to set it to a valid value. Usually, it will be something like:
'export PYTHON_INCLUDE=/usr/include/pythonX.X' where the X's are the
version numbers. You only need to run the 'init_devel.sh' script one time.
......@@ -35,11 +35,10 @@ To compile the Fortran model you will need to perform the following action:
======================
1) Change the METRo version number in the following files:
README
scripts/do_macadam
src/frontend/metro_config.py
2) Change realease date in the following files:
2) Change release date in the following files:
README
src/frontend/metro_config.py
......@@ -64,24 +63,29 @@ To compile the Fortran model you will need to perform the following action:
== Release ==
=============
1) Make a tag in SVN for the release of that version. You will need an access to the metro project on GNA to do that.
The following is an exemple of the user Francois Fortin making a tags for the 3.2.4 version
1) Make a tag in SVN for the release of that version.
You will need an access to the metro project on GNA to do that.
The following is an example of the user Francois Fortin making a tags
for the 3.2.4 version
svn copy svn+ssh://francois_fortin@svn.gna.org/svn/metro/metro/trunk \
svn+ssh://francois_fortin@svn.gna.org/svn/metro/metro/tags/metro-3.2.4
svn copy svn+ssh://francois_fortin@svn.gna.org/svn/metro/metro/trunk \
svn+ssh://francois_fortin@svn.gna.org/svn/metro/metro/tags/metro-3.2.4
2) Upload package to the GNA web site (http://download.gna.org/metro/)
scp metro-3.2.4.tar.bz2 metro-3.2.4.tar.bz2.sig francois_fortin@download.gna.org:/upload/metro/
scp metro-3.2.4.tar.bz2 metro-3.2.4.tar.bz2.sig
francois_fortin@download.gna.org:/upload/metro/
3) Create a new LATEST_RELEASE file with the new version number. The content of the file is:
3) Create a new LATEST_RELEASE file with the new version number.
The content of the file is:
------------------------------------- cut here --------------------------------
Please note:
------------------------------------- cut here --------------------------------
Please note:
- The latest stable version of the METRo package is:
metro-3.2.4
------------------------------------- cut here --------------------------------
- The latest stable version of the METRo package is:
metro-3.2.4
------------------------------------- cut here --------------------------------
4) Upload the LATEST_RELEASE file to the GNA web site (http://download.gna.org/metro/)
4) Upload the LATEST_RELEASE file to the GNA web site
(http://download.gna.org/metro/)
scp LATEST_RELEASE francois_fortin@download.gna.org:/upload/metro/
......@@ -48,7 +48,7 @@ mkdir -p usr/bin
ln -sTf ../../src/frontend/metro.py usr/bin/metro
echo ""
if which python-config >/dev/null; then
if which python3-config >/dev/null; then
PYTHON_INC=`python3-config --includes`
echo "* Python include path = "$PYTHON_INC
fi
......
......@@ -34,10 +34,10 @@
progname=`basename $0`
METRO_VERSION=3.3.3
METRO_VERSION=4.0.0
if [[ $1 = clean ]]; then
if [[ $1 = clean ]]; then
echo "* Cleaning last METRo model build attempt if necessary..."
rm -f _macadam.so *.o macadam.py macadam_wrap.c
exit 0
......@@ -116,7 +116,7 @@ if [ -z $FC ]; then
fi
echo " Fortran compilation"
$FC -Wall -Wsurprising -W -c -fPIC $FORTRAN_DEFAULT_INTEGER lib_gen.f grille.f array2matrix.f initial.f coupla.f lib_therm.f flxsurfz.f balanc.f constPhys.f
$FC -Wall -Wsurprising -W -c -fPIC $FORTRAN_DEFAULT_INTEGER lib_gen.f grille.f array2matrix.f initial.f coupla.f lib_therm.f flxsurfz.f balanc.f constPhys.f
echo " Link"
......
......@@ -14,7 +14,6 @@
#
# $LastChangedDate$
# $LastChangedRevision$
#
########################################################################
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -78,7 +77,7 @@ then
echo "Ex: ./setup.sh /usr/local/"
echo " ./setup.sh /home/user/program/"
exit 0
fi
fi
while getopts "cv" Option
......@@ -90,7 +89,7 @@ do
echo "Usage: $progname [OPTION] destination_path"
echo ""
echo "-c : Will compile the METRo physic model instead of using"
echo " the provided binary. Need gfortran compiler."
echo " the provided binary. Need gfortran compiler."
echo " DEPRECATED, no longer do anything, setup.sh will"
echo " always compile the METRo physic model."
echo ""
......@@ -136,7 +135,7 @@ if ! locate libgfortran.so.1; then
bCompile=1
fi
echo ""
mkdir -p $destination_path/usr/share/metro/model/
mkdir -p $destination_path/usr/lib/metro/
if [ $bCompile == 1 ]; then
......@@ -206,7 +205,7 @@ cd $installation_dir
mkdir -p $destination_path/usr/bin
echo "* Make link to METRo executable:"
echo " $destination_path/usr/bin/metro -> $destination_path/usr/share/metro/metro.py"
ln -sf ../share/metro/metro.py $destination_path/usr/bin/metro
ln -sf ../share/metro/metro.py $destination_path/usr/bin/metro
echo ""
echo "---------------------------------------------------"
......@@ -218,7 +217,7 @@ echo ""
echo "To test the installation of METRo"
echo "---------------------------------"
echo "Go into the METRo directory:"
echo " 'cd $destination_path/usr/bin/'"
echo " 'cd $destination_path/usr/bin/'"
echo "Launch METRo selftest:"
echo " 'python metro --selftest'"
echo "Compare the files:"
......
......@@ -136,7 +136,7 @@ class Metro_data_station(Metro_data):
else:
dStation_header = self.get_header()
fStation_sst_depth = dStation_header['SST_DEPTH']
if fStation_sst_depth == "None" or fStation_sst_depth > 1.4 or fStation_sst_depth < 0.01:
if fStation_sst_depth is None or fStation_sst_depth > 1.4 or fStation_sst_depth < 0.01:
sMessage = _("Sensor SST depth value in station config file is not between 0.01 m and 1.4 m. "
"Given value: '%s' m.") % fStation_sst_depth
metro_logger.print_message(metro_logger.LOGGER_MSG_STOP, sMessage)
......
......@@ -50,7 +50,7 @@ class Metro_dom2metro(Metro_module):
domStation = None
domHorizon = None
# Overwritten methodes
# Overwritten methods
def start(self):
Metro_module.start(self)
......
......@@ -69,7 +69,8 @@ class Metro_model(Metro_module):
roadcast_data = self.__create_roadcast_collection(forecast_data, observation_data, station_data)
else:
roadcast_data = None
metro_logger.print_message(metro_logger.LOGGER_MSG_INFORMATIVE, _("Bypassing METRo core, roadcast not created."))
metro_logger.print_message(metro_logger.LOGGER_MSG_INFORMATIVE,
_("Bypassing METRo core, roadcast not created."))
pForecast.set_data_collection(forecast_data)
pObservation.set_data_collection(observation_data)
......
......@@ -55,7 +55,8 @@ class Metro_read_observation_ref(Metro_read):
metro_logger.print_message(metro_logger.LOGGER_MSG_CRITICAL, sError_message)
else:
# creer et ajouter infdata
infdata_observation_ref = metro_infdata.Metro_infdata( 'OBSERVATION_REF', metro_infdata.DATATYPE_METRO_DATA_COLLECTION)
infdata_observation_ref = metro_infdata.Metro_infdata( 'OBSERVATION_REF',
metro_infdata.DATATYPE_METRO_DATA_COLLECTION)
infdata_observation_ref.set_input_information(sFile_content)
self.add_infdata(infdata_observation_ref)
else:
......
......@@ -92,7 +92,8 @@ class Metro_validate(Metro_module):
try:
return metro_xml.validate_string(sXml_content)
except metro_error.Metro_xml_error as inst:
metro_logger.print_message(metro_logger.LOGGER_MSG_DEBUG, _("Error when validating ") + _("XML string."))
metro_logger.print_message(metro_logger.LOGGER_MSG_DEBUG,
_("Error when validating ") + _("XML string."))
raise metro_error.Metro_xml_error(str(inst))
else:
sMessage = _("No XML string to validate")
......
......@@ -9,7 +9,8 @@ class Plist_writer:
def __write_header(self):
self.output.write('<?xml version="1.0" encoding="UTF-8"?>\n')
self.output.write('<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n')
self.output.write('<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" '
'"http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n')
self.output.write('<plist version="1.0">\n')
def __write_footer(self):
......
......@@ -55,8 +55,8 @@ _ = metro_util.init_translation('metro_config')
METRO_CONFIG_GETTEXT_PACKAGE = "metro_config"
METRO_CONFIG_GETTEXT_LOCALEDIR = "./locale"
# Constant definition
CFG_METRO_VERSION = "3.3.3"
# Constant definition
CFG_METRO_VERSION = "4.0.0"
CFG_METRO_DATE = "2019-11-06"
# Origin of the value (command line, config file, hardcoded value,
......
......@@ -97,7 +97,8 @@ def get_metro_root_path():
# Nothing have been found
sError = _("The executable 'metro.py' must be in one of the following directory:\n") + \
_("metro_directory/src/frontend' or 'metro_directory/usr/lib/metro'.\n") + \
_("The following path is not valid: '%s'.\n\n") % (sys.path[0]) + _("Aborting execution of METRo.\n")
_("The following path is not valid: '%s'.\n\n") % (sys.path[0]) + \
_("Aborting execution of METRo.\n")
print(sError)
sys.exit(1)
return sRoot_path
......
......@@ -62,7 +62,8 @@ def init(sMetro_xml_lib=""):
sMessage = _("Fatal error! Can't import '%s' xml library") % sMetro_xml_lib
metro_logger.print_init_message(metro_logger.LOGGER_INIT_ERROR, sMessage)
else:
metro_logger.print_init_message(metro_logger.LOGGER_INIT_SUCCESS, _("XML library '%s' will be use.") % sMetro_xml_lib)
metro_logger.print_init_message(metro_logger.LOGGER_INIT_SUCCESS,
_("XML library '%s' will be use.") % sMetro_xml_lib)
metro_xml_lib = __import__(sMetro_xml_lib)
else:
......@@ -282,7 +283,8 @@ def create_node_tree_from_dict(domDoc, nodeParent, lDefs, dWriteHandlers, dData)
append_child(nodeParent, nodeData)
def create_node_tree_from_matrix(domDoc, nodeParent, sPrediction_xpath, lDefs, dWriteHandlers, metro_data_object, npMatrix):
def create_node_tree_from_matrix(domDoc, nodeParent, sPrediction_xpath, lDefs,
dWriteHandlers, metro_data_object, npMatrix):
"""
Each prediction will be contained in a node that will have the name given by sPrediction_xpath.
"""
......
{
"description": "This is the description message.",
"addition_to_command_line": null,
"expected_running_result": "FAILURE"
}
\ No newline at end of file
}
<?xml version="1.0"?>
<?xml version="1.0" encoding="utf-8"?>
<station>
<header>
<version>1.0</version>
<road-station>rya</road-station>
<time-zone>AST4ADT</time-zone>
<production-date>2003-09-26T15:34Z</production-date>
<coordinate>
<latitude>43.9847</latitude>
<longitude>-66.1222</longitude>
</coordinate>
<station-type>road</station-type>
</header>
<roadlayer-list>
<roadlayer>
<position>1</position>
<type>asphalt</type>
<thickness>0.1905</thickness>
</roadlayer>
<roadlayer>
<position>2</position>
<type>cement</type>
<thickness>0.4570</thickness>
</roadlayer>
</roadlayer-list>
<header>
<version>1.0</version>
<road-station>rya</road-station>
<time-zone>AST4ADT</time-zone>
<production-date>2003-09-26T15:34Z</production-date>
<coordinate>
<latitude>43.9847</latitude>
<longitude>-66.1222</longitude>
</coordinate>
<station-type>road</station-type>
</header>
<roadlayer-list>
<roadlayer>
<position>1</position>
<type>asphalt</type>
<thickness>0.1905</thickness>
</roadlayer>
<roadlayer>
<position>2</position>
<type>cement</type>
<thickness>0.4570</thickness>
</roadlayer>
</roadlayer-list>
</station>
{
"description": "This is the description message.",
"addition_to_command_line": null,
"expected_running_result": "SUCCESS"
}
\ No newline at end of file
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment