kopia lustrzana https://github.com/OpenDroneMap/WebODM
Better GRASS detection on Windows, fixed GRASS engine reference bug
rodzic
de2aafa670
commit
b13fe89f8f
|
@ -12,11 +12,17 @@ logger = logging.getLogger('app.logger')
|
||||||
class GrassEngine:
|
class GrassEngine:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.grass_binary = shutil.which('grass7') or \
|
self.grass_binary = shutil.which('grass7') or \
|
||||||
|
shutil.which('grass7.bat') or \
|
||||||
shutil.which('grass72') or \
|
shutil.which('grass72') or \
|
||||||
|
shutil.which('grass72.bat') or \
|
||||||
shutil.which('grass74') or \
|
shutil.which('grass74') or \
|
||||||
|
shutil.which('grass74.bat') or \
|
||||||
shutil.which('grass76') or \
|
shutil.which('grass76') or \
|
||||||
|
shutil.which('grass76.bat') or \
|
||||||
shutil.which('grass78') or \
|
shutil.which('grass78') or \
|
||||||
shutil.which('grass80')
|
shutil.which('grass78.bat') or \
|
||||||
|
shutil.which('grass80') or \
|
||||||
|
shutil.which('grass80.bat')
|
||||||
|
|
||||||
if self.grass_binary is None:
|
if self.grass_binary is None:
|
||||||
logger.warning("Could not find a GRASS 7 executable. GRASS scripts will not work.")
|
logger.warning("Could not find a GRASS 7 executable. GRASS scripts will not work.")
|
||||||
|
@ -34,7 +40,7 @@ class GrassContext:
|
||||||
if tmpdir is None:
|
if tmpdir is None:
|
||||||
tmpdir = os.path.basename(tempfile.mkdtemp('_grass_engine', dir=settings.MEDIA_TMP))
|
tmpdir = os.path.basename(tempfile.mkdtemp('_grass_engine', dir=settings.MEDIA_TMP))
|
||||||
self.tmpdir = tmpdir
|
self.tmpdir = tmpdir
|
||||||
self.script_opts = script_opts
|
self.script_opts = script_opts.copy()
|
||||||
self.location = location
|
self.location = location
|
||||||
self.auto_cleanup = auto_cleanup
|
self.auto_cleanup = auto_cleanup
|
||||||
|
|
||||||
|
@ -95,7 +101,7 @@ class GrassContext:
|
||||||
try:
|
try:
|
||||||
out = subprocess.check_output(command, cwd=self.get_cwd()).decode('utf-8').strip()
|
out = subprocess.check_output(command, cwd=self.get_cwd()).decode('utf-8').strip()
|
||||||
success = True
|
success = True
|
||||||
except subprocess.CalledProcessError:
|
except:
|
||||||
success = False
|
success = False
|
||||||
err = out
|
err = out
|
||||||
else:
|
else:
|
||||||
|
|
Ładowanie…
Reference in New Issue