Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions lib/init/testsuite/test_grass_tmp_mapset.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,21 @@
class TestTmpMapset(unittest.TestCase):
"""Tests --tmp-mapset option of grass command"""

# TODO: here we need a name of or path to the main GRASS executable
# TODO: support OSGeo4W executable with:
# executable = "grass" if os.name != "nt" else "grass86.bat"
executable = "grass" if os.name != "nt" else "grass.bat"
# On Windows, GISBASE itself (where the grass.bat launcher lives) is
# never added to PATH, only GISBASE\bin is, so a bare "grass.bat" is
# not found when this test runs inside an existing GRASS session (e.g.
# under grass.gunittest.main). Resolve the full path via GISBASE when
# available and fall back to the bare name otherwise.
# Note: on an OSGeo4W package install, the launcher name is versioned
# (e.g. grass86.bat instead of grass.bat), so this resolution does not
# apply there; it only covers a from-source build's layout.
_gisbase = os.environ.get("GISBASE")
if os.name != "nt":
executable = "grass"
elif _gisbase:
executable = os.path.join(_gisbase, "grass.bat")
else:
executable = "grass.bat"
# an arbitrary, but identifiable and fairly unique name
location = "test_tmp_mapset_xy"

Expand Down
4 changes: 1 addition & 3 deletions scripts/db.univar/db.univar.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ def sortfile(infile, outfile):
else:
# FIXME: we need a large-file sorting function
gs.warning(_("'sort' not found: sorting in memory"))
lines = inf.readlines()
for i in range(len(lines)):
lines[i] = float(lines[i].rstrip("\r\n"))
lines = [float(line) for line in (line.strip() for line in inf) if line]
lines.sort()
outf.writelines(str(line) + "\n" for line in lines)

Expand Down
Loading