Unverified Commit 200964a6 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Added log info. Improved some code. Updated version info.


Signed-off-by: Daniel Scheffler's avatardanschef <daniel.scheffler@gfz-potsdam.de>
parent e97d63fb
Pipeline #6023 passed with stage
in 35 seconds
......@@ -424,7 +424,7 @@ class EnPTAlgorithm(QgsProcessingAlgorithm):
return out, exitcode, err
@staticmethod
def locate_EnPT_Anaconda_environment(user_root):
def _locate_EnPT_Anaconda_environment(user_root):
anaconda_rootdir = None
if user_root and os.path.exists(user_root):
......@@ -453,12 +453,28 @@ class EnPTAlgorithm(QgsProcessingAlgorithm):
return anaconda_rootdir
@staticmethod
def _locate_enpt_run_script():
try:
if os.name == 'nt':
# Windows
return check_output('where enpt_run_cmd.bat', shell=True).decode('UTF-8').strip()
# return "D:\\Daten\\Code\\python\\enpt_enmapboxapp\\bin\\enpt_run_cmd.bat"
else:
# Linux / OSX
return check_output('which enpt_run_cmd.sh', shell=True).decode('UTF-8').strip()
# return 'enpt_run_cmd.sh '
except CalledProcessError:
raise EnvironmentError('The EnPT run script could not be found. Please make sure, that enpt_enmapboxapp '
'is correctly installed into your QGIS Python environment.')
def processAlgorithm(self, parameters, context, feedback):
assert isinstance(parameters, dict)
assert isinstance(context, QgsProcessingContext)
assert isinstance(feedback, QgsProcessingFeedback)
anaconda_root = self.locate_EnPT_Anaconda_environment(parameters[self.P_anaconda_root])
anaconda_root = self._locate_EnPT_Anaconda_environment(parameters[self.P_anaconda_root])
feedback.pushInfo('Found Anaconda installation at %s.' % anaconda_root)
# remove all parameters not to be forwarded to the EnPT CLI
......@@ -483,21 +499,13 @@ class EnPTAlgorithm(QgsProcessingAlgorithm):
if "PYTHONPATH" in my_env.keys():
del my_env["PYTHONPATH"]
try:
if os.name == 'nt':
# Windows
path_enpt_runscript = check_output('where enpt_run_cmd.bat', shell=True).decode('UTF-8').strip()
# path_enpt_runscript = "D:\\Daten\\Code\\python\\enpt_enmapboxapp\\bin\\enpt_run_cmd.bat"
else:
# Linux / OSX
path_enpt_runscript = check_output('which enpt_run_cmd.sh', shell=True).decode('UTF-8').strip()
# path_enpt_runscript = 'enpt_run_cmd.sh '
except CalledProcessError:
raise EnvironmentError('The EnPT run script could not be found. Please make sure, that enpt_enmapboxapp '
'is correctly installed into your QGIS Python environment.')
path_enpt_runscript = self._locate_enpt_run_script()
# run EnPT in subprocess that activates the EnPT Anaconda environment
print('Using %s to start EnPT.' % path_enpt_runscript)
feedback.pushInfo("The log messages of the EnMAP processing tool cannot be shown here, yet. However, you "
"may inspect the *.log file that is written to the specified output folder.")
output, exitcode, err = \
self._run_cmd("%s %s" % (path_enpt_runscript, keyval_str),
no_stdout=True,
......
......@@ -22,6 +22,6 @@
# You should have received a copy of the GNU Lesser General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
__version__ = '0.2.0'
__versionalias__ = '20200117.02'
__version__ = '0.2.1'
__versionalias__ = '20200124.01'
__author__ = 'Daniel Scheffler'
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