Skip to content

Commit

Permalink
version: Reduce usage of the current version number (OSGeo#2340)
Browse files Browse the repository at this point in the history
When the current version is used, it needs to be updated usually every minor release. This reduces how much the current version is used where it is not essential.

* When in variable name, use more general variable name.
* When in comment or doc, use '<version>' or VV when no specific example is needed.
* When a specific version is need for an example, use 3.y.z which is obviously an example.
* When not essential in the context, remove it completely.
* Use build-time replacement for version on macOS.
* Use short variable name in Python example to keep the lines short.
  • Loading branch information
wenzeslaus authored Aug 28, 2022
1 parent 5745705 commit 46cbb38
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ Installation order:

GRASS source code is currently distributed in 2 forms:

1) Officially released source code (e.g. grass-8.2.0.tar.gz or later)
1) Officially released source code (e.g. grass-3.7.0.tar.gz)

The full source code version contains all the GRASS source code
required for compilation. It is distributed as one file (*.tar.gz
package) and the version is composed of 3 numbers, e.g. 8.2.0, 8.2.1
package) and the version is composed of 3 numbers, e.g. 3.7.0, 3.7.1
etc. See
https://github.com/OSGeo/grass/releases

Expand All @@ -54,7 +54,7 @@ GRASS source code is currently distributed in 2 forms:
repository (https://github.com/OSGeo/grass/) or as a auto-generated snapshot
(*.tar.gz package) of the GitHub repository. The snapshot name
contains the date when the snapshot was created (checked out from
the GitHub repository), e.g. grass-8.3.git_src_snapshot_2022_04_27.tar.gz
the GitHub repository), e.g. grass-3.7.git_src_snapshot_2022_04_27.tar.gz
from https://grass.osgeo.org/grass-devel/source/snapshot/
Further instructions at https://trac.osgeo.org/grass/wiki/DownloadSource

Expand Down
2 changes: 1 addition & 1 deletion mswindows/crosscompile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Usage: crosscompile.sh [OPTIONS]
(default: /usr/include/freetype2)
--update update the current branch
--package package the cross-compiled build as
grass83-x86_64-w64-mingw32-YYYYMMDD.zip
grassVV-x86_64-w64-mingw32-YYYYMMDD.zip
EOT
exit
;;
Expand Down
11 changes: 5 additions & 6 deletions python/grass/gunittest/multirunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,21 +117,20 @@ def main():
# TODO: create directory according to date and revision and create reports there

# some predefined variables, name of the GRASS launch script + location/mapset
# grass8bin = 'C:\Program Files (x86)\GRASS GIS 8.2.git\grass.bat'
grass8bin = args.grassbin # TODO: can be used if pressent
grass_executable = args.grassbin

# Software
# query GRASS GIS 8 itself for its GISBASE
# we assume that GRASS GIS' start script is available and in the PATH
# query GRASS GIS itself for its GISBASE
# we assume that the start script is available and in the PATH
# the shell=True is here because of MS Windows? (code taken from wiki)
startcmd = grass8bin + " --config path"
startcmd = grass_executable + " --config path"
p = subprocess.Popen(
startcmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
out, err = p.communicate()
if p.returncode != 0:
print(
"ERROR: Cannot find GRASS GIS 8 start script (%s):\n%s" % (startcmd, err),
"ERROR: Cannot find GRASS GIS start script (%s):\n%s" % (startcmd, err),
file=sys.stderr,
)
return 1
Expand Down
15 changes: 8 additions & 7 deletions python/grass/script/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,20 @@
# query GRASS itself for its GISBASE
# (with fixes for specific platforms)
# needs to be edited by the user
grass8bin = "grass"
executable = "grass"
if sys.platform.startswith("win"):
# MS Windows
grass8bin = r"C:\OSGeo4W\bin\grass.bat"
executable = r"C:\OSGeo4W\bin\grass.bat"
# uncomment when using standalone WinGRASS installer
# grass8bin = r'C:\Program Files (x86)\GRASS GIS 8.2.0\grass.bat'
# this can be avoided if GRASS executable is added to PATH
# executable = r'C:\Program Files (x86)\GRASS GIS <version>\grass.bat'
# this can be skipped if GRASS executable is added to PATH
elif sys.platform == "darwin":
# Mac OS X
grass8bin = "/Applications/GRASS-8.2.app/Contents/Resources/bin/grass"
version = "@GRASS_VERSION_MAJOR@.@GRASS_VERSION_MINOR@"
executable = f"/Applications/GRASS-{version}.app/Contents/Resources/bin/grass"
# query GRASS GIS itself for its Python package path
grass_cmd = [grass8bin, "--config", "python_path"]
grass_cmd = [executable, "--config", "python_path"]
process = subprocess.run(grass_cmd, check=True, text=True, stdout=subprocess.PIPE)
# define GRASS-Python environment
Expand Down Expand Up @@ -64,7 +65,7 @@
session.finish()
(C) 2010-2021 by the GRASS Development Team
(C) 2010-2022 by the GRASS Development Team
This program is free software under the GNU General Public
License (>=v2). Read the file COPYING that comes with GRASS
for details.
Expand Down

0 comments on commit 46cbb38

Please sign in to comment.