From e37730b936cf4ed27878b2ded63c7fe68b8d979e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 2 Nov 2024 11:31:34 -0400 Subject: [PATCH 01/14] style: Sort package lists, configure options, and other various sortable files (#4563) * style: Sort packages in Vagrantfile * style: Sort configure flags in package.nix * style: Sort .gunittest.cfg * style: Sort Travis build files * style: Sort python optional_requirements.txt * style: Sort configure flags in GitHub workflows * style: Sort packages and configure flags for binder * style: Sort packages, configure flags, cmake flags and wget downloads in Dockerfiles * style: Sort configure flags in Vagrant script * style: Sort svn author name files with linux sort command * style: Sort contributors.csv and contributors_extra.csv * style: Sort rpm package spec * style: Sort packages and configure flags in mswindows build scripts * style: Sort macosx build script Readme * style: Sort singularity file * Apply changes from https://src.fedoraproject.org/rpms/grass/blob/rawhide/f/grass.spec --- .github/workflows/build_ubuntu-22.04.sh | 24 +-- .../workflows/build_ubuntu-22.04_without_x.sh | 26 +-- .github/workflows/coverity.yml | 27 +-- .github/workflows/macos_install.sh | 64 +++---- .github/workflows/optional_requirements.txt | 2 +- .gunittest.cfg | 2 +- .travis/linux.script.sh | 28 ++-- Dockerfile | 2 +- Vagrantfile | 24 +-- binder/apt.txt | 1 - binder/postBuild | 12 +- contributors.csv | 32 ++-- contributors_extra.csv | 6 +- docker/alpine/Dockerfile | 2 +- docker/debian/Dockerfile | 18 +- docker/ubuntu/Dockerfile | 2 +- docker/ubuntu_wxgui/Dockerfile | 20 +-- macosx/ReadMe.md | 112 +++++++++---- mswindows/crosscompile.sh | 44 ++--- mswindows/osgeo4w/build_osgeo4w.sh | 57 ++++--- mswindows/osgeo4w/package.sh | 90 +++++----- package.nix | 2 +- rpm/grass.spec | 156 +++++++++++------- singularity/debian/singularityfile_debian | 30 ++-- utils/svn_name_git_author.csv | 2 +- utils/svn_name_github_name.csv | 52 +++--- utils/vagrant/compile.sh | 32 ++-- 27 files changed, 478 insertions(+), 391 deletions(-) diff --git a/.github/workflows/build_ubuntu-22.04.sh b/.github/workflows/build_ubuntu-22.04.sh index 3beeccf9bbd..677c46d5f33 100755 --- a/.github/workflows/build_ubuntu-22.04.sh +++ b/.github/workflows/build_ubuntu-22.04.sh @@ -31,26 +31,26 @@ set -u export INSTALL_PREFIX=$1 ./configure \ - --prefix="$INSTALL_PREFIX/" \ --enable-largefile \ - --with-cxx \ - --with-zstd \ - --with-bzlib \ + --prefix="$INSTALL_PREFIX/" \ --with-blas \ + --with-bzlib \ + --with-cxx \ + --with-fftw \ + --with-freetype \ + --with-freetype-includes="/usr/include/freetype2/" \ + --with-geos \ --with-lapack \ --with-libsvm \ - --with-readline \ + --with-netcdf \ --with-openmp \ --with-pdal \ - --with-pthread \ - --with-tiff \ - --with-freetype \ - --with-freetype-includes="/usr/include/freetype2/" \ --with-proj-share=/usr/share/proj \ - --with-geos \ + --with-pthread \ + --with-readline \ --with-sqlite \ - --with-fftw \ - --with-netcdf + --with-tiff \ + --with-zstd eval $makecmd make install diff --git a/.github/workflows/build_ubuntu-22.04_without_x.sh b/.github/workflows/build_ubuntu-22.04_without_x.sh index 5df3a0b7e33..7e05457a4ee 100755 --- a/.github/workflows/build_ubuntu-22.04_without_x.sh +++ b/.github/workflows/build_ubuntu-22.04_without_x.sh @@ -30,25 +30,25 @@ set -u export INSTALL_PREFIX=$1 ./configure \ - --prefix="$INSTALL_PREFIX/" \ --enable-largefile \ - --with-cxx \ - --with-zstd \ - --with-bzlib \ + --prefix="$INSTALL_PREFIX/" \ --with-blas \ - --with-lapack \ - --with-readline \ - --without-openmp \ - --with-pdal \ - --without-pthread \ - --with-tiff \ + --with-bzlib \ + --with-cxx \ + --with-fftw \ --with-freetype \ --with-freetype-includes="/usr/include/freetype2/" \ - --with-proj-share=/usr/share/proj \ --with-geos \ + --with-lapack \ + --with-netcdf \ + --with-pdal \ + --with-proj-share=/usr/share/proj \ + --with-readline \ --with-sqlite \ - --with-fftw \ - --with-netcdf + --with-tiff \ + --with-zstd \ + --without-openmp \ + --without-pthread eval $makecmd make install diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index 51ab83015ca..5253a9ee7a4 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -58,25 +58,26 @@ jobs: echo "CFLAGS=${{ env.CFLAGS }}" >> $GITHUB_ENV echo "CXXFLAGS=${{ env.CXXFLAGS }}" >> $GITHUB_ENV ./configure \ - --prefix="$HOME/install/" \ --enable-largefile \ - --with-cxx \ - --with-zstd \ - --with-bzlib \ + --prefix="$HOME/install/" \ --with-blas \ - --with-lapack \ - --with-readline \ - --without-openmp \ - --with-pdal \ - --without-pthread \ - --with-tiff \ + --with-bzlib \ + --with-cxx \ + --with-fftw \ --with-freetype \ --with-freetype-includes="/usr/include/freetype2/" \ - --with-proj-share=/usr/share/proj \ --with-geos \ + --with-lapack \ + --with-netcdf \ + --with-pdal \ + --with-proj-share=/usr/share/proj \ + --with-readline \ --with-sqlite \ - --with-fftw \ - --with-netcdf + --with-tiff \ + --with-zstd \ + --without-openmp \ + --without-pthread + env: CFLAGS: -fPIC -g CXXFLAGS: -fPIC -g diff --git a/.github/workflows/macos_install.sh b/.github/workflows/macos_install.sh index 8a94bc15c6a..31d7d23ce8d 100755 --- a/.github/workflows/macos_install.sh +++ b/.github/workflows/macos_install.sh @@ -12,51 +12,51 @@ INSTALL_PREFIX=$1 CONFIGURE_FLAGS="\ --prefix=${INSTALL_PREFIX} \ - --with-opengl=aqua \ - --with-openmp \ - --without-x \ + --with-blas=openblas \ + --with-bzlib \ + --with-bzlib-includes=${CONDA_PREFIX}/include \ + --with-bzlib-libs=${CONDA_PREFIX}/lib \ + --with-cairo \ + --with-cairo-includes=${CONDA_PREFIX}/include/cairo \ + --with-cairo-ldflags="-lcairo" \ + --with-cairo-libs=${CONDA_PREFIX}/lib \ + --with-cxx \ + --with-fftw-includes=${CONDA_PREFIX}/include \ + --with-fftw-libs=${CONDA_PREFIX}/lib \ --with-freetype \ --with-freetype-includes=${CONDA_PREFIX}/include/freetype2 \ --with-freetype-libs=${CONDA_PREFIX}/lib \ --with-gdal=${CONDA_PREFIX}/bin/gdal-config \ - --with-proj-includes=${CONDA_PREFIX}/include \ - --with-proj-libs=${CONDA_PREFIX}/lib \ - --with-proj-share=${CONDA_PREFIX}/share/proj \ --with-geos=${CONDA_PREFIX}/bin/geos-config \ + --with-includes=${CONDA_PREFIX}/include \ + --with-lapack=openblas \ --with-libpng=${CONDA_PREFIX}/bin/libpng-config \ - --with-tiff-includes=${CONDA_PREFIX}/include \ - --with-tiff-libs=${CONDA_PREFIX}/lib \ - --with-postgres=yes \ - --with-postgres-includes=${CONDA_PREFIX}/include \ - --with-postgres-libs=${CONDA_PREFIX}/lib \ - --without-mysql \ - --with-sqlite \ - --with-sqlite-libs=${CONDA_PREFIX}/lib \ - --with-sqlite-includes=${CONDA_PREFIX}/include \ - --with-fftw-includes=${CONDA_PREFIX}/include \ - --with-fftw-libs=${CONDA_PREFIX}/lib \ - --with-cxx \ - --with-cairo \ - --with-cairo-includes=${CONDA_PREFIX}/include/cairo \ - --with-cairo-libs=${CONDA_PREFIX}/lib \ - --with-cairo-ldflags="-lcairo" \ - --with-zstd \ - --with-zstd-libs=${CONDA_PREFIX}/lib \ - --with-zstd-includes=${CONDA_PREFIX}/include \ - --with-bzlib \ - --with-bzlib-libs=${CONDA_PREFIX}/lib \ - --with-bzlib-includes=${CONDA_PREFIX}/include \ + --with-libs=${CONDA_PREFIX}/lib \ --with-netcdf=${CONDA_PREFIX}/bin/nc-config \ - --with-blas=openblas \ - --with-lapack=openblas \ --with-netcdf=${CONDA_PREFIX}/bin/nc-config \ --with-nls \ - --with-libs=${CONDA_PREFIX}/lib \ - --with-includes=${CONDA_PREFIX}/include \ + --with-opengl=aqua \ + --with-openmp \ --with-pdal \ + --with-postgres-includes=${CONDA_PREFIX}/include \ + --with-postgres-libs=${CONDA_PREFIX}/lib \ + --with-postgres=yes \ + --with-proj-includes=${CONDA_PREFIX}/include \ + --with-proj-libs=${CONDA_PREFIX}/lib \ + --with-proj-share=${CONDA_PREFIX}/share/proj \ --with-readline \ --with-readline-includes=${CONDA_PREFIX}/include/readline \ --with-readline-libs=${CONDA_PREFIX}/lib + --with-sqlite \ + --with-sqlite-includes=${CONDA_PREFIX}/include \ + --with-sqlite-libs=${CONDA_PREFIX}/lib \ + --with-tiff-includes=${CONDA_PREFIX}/include \ + --with-tiff-libs=${CONDA_PREFIX}/lib \ + --with-zstd \ + --with-zstd-includes=${CONDA_PREFIX}/include \ + --with-zstd-libs=${CONDA_PREFIX}/lib \ + --without-mysql \ + --without-x \ " export CFLAGS="-O2 -pipe -arch ${CONDA_ARCH} -DGL_SILENCE_DEPRECATION -Wall -Wextra -Wpedantic -Wvla" diff --git a/.github/workflows/optional_requirements.txt b/.github/workflows/optional_requirements.txt index 244a75e2933..078e9fadfb8 100644 --- a/.github/workflows/optional_requirements.txt +++ b/.github/workflows/optional_requirements.txt @@ -1,4 +1,4 @@ folium +ipyleaflet jupyter PyVirtualDisplay -ipyleaflet diff --git a/.gunittest.cfg b/.gunittest.cfg index 2117fde9d7a..45ae87c12a4 100644 --- a/.gunittest.cfg +++ b/.gunittest.cfg @@ -12,8 +12,8 @@ exclude = python/grass/temporal/testsuite/unittests_temporal_raster_algebra_equal_ts.py python/grass/temporal/testsuite/unittests_temporal_raster_conditionals_complement_else.py raster/r.in.lidar/testsuite/test_base_resolution.sh - temporal/t.connect/testsuite/test_distr_tgis_db_raster3d.py temporal/t.connect/testsuite/test_distr_tgis_db_raster.py + temporal/t.connect/testsuite/test_distr_tgis_db_raster3d.py temporal/t.connect/testsuite/test_distr_tgis_db_vector.py temporal/t.info/testsuite/test.t.info.sh temporal/t.rast.aggregate/testsuite/test_aggregation_relative.py diff --git a/.travis/linux.script.sh b/.travis/linux.script.sh index 4944f7e894e..f2ab000dfc3 100755 --- a/.travis/linux.script.sh +++ b/.travis/linux.script.sh @@ -11,28 +11,28 @@ echo "MAKEFLAGS is '$MAKEFLAGS'" ./configure --host=x86_64-linux-gnu \ --build=x86_64-linux-gnu \ + --enable-largefile \ + --enable-shared \ --prefix=/usr/lib \ - --sysconfdir=/etc \ --sharedstatedir=/var \ - --enable-shared \ - --with-postgres \ + --sysconfdir=/etc \ + --with-blas \ + --with-cairo \ --with-cxx \ - --with-gdal \ --with-freetype \ - --with-readline \ - --with-nls \ - --with-odbc \ + --with-freetype-includes=/usr/include/freetype2/ \ + --with-gdal \ --with-geos \ --with-lapack \ --with-netcdf \ - --with-blas \ - --with-sqlite \ - --with-zstd \ - --enable-largefile \ - --with-freetype-includes=/usr/include/freetype2/ \ + --with-nls \ + --with-odbc \ + --with-pdal \ + --with-postgres \ --with-postgres-includes=/usr/include/postgresql/ \ --with-proj-share=/usr/share/proj \ - --with-cairo \ - --with-pdal + --with-readline \ + --with-sqlite \ + --with-zstd make CFLAGS="$CFLAGS $GRASS_EXTRA_CFLAGS" CXXFLAGS="$CXXFLAGS $GRASS_EXTRA_CXXFLAGS" diff --git a/Dockerfile b/Dockerfile index 6b928fb46c9..a3645bc558d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -131,9 +131,9 @@ ARG GRASS_CONFIG="\ " ARG GRASS_PYTHON_PACKAGES="\ - Pillow \ matplotlib \ numpy \ + Pillow \ pip \ ply \ psycopg2 \ diff --git a/Vagrantfile b/Vagrantfile index 035bb0c64cb..99c373e82ef 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -43,11 +43,11 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| packageList = [ "autoconf2.69", "autotools-dev", - "make", + "bison", + "flex", "g++", "gettext", - "flex", - "bison", + "libblas-dev", "libcairo2-dev", "libfftw3-dev", "libfreetype6-dev", @@ -55,27 +55,27 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| "libgeos-dev", "libglu1-mesa-dev", "libjpeg-dev", - "libpng-dev", - "libtiff-dev", + "liblapack-dev", "libmysqlclient-dev", "libncurses5-dev", + "libnetcdf-dev", + "libpng-dev", "libpq-dev", "libproj-dev", - "proj-bin", "libreadline-dev", "libsqlite3-dev", + "libtiff-dev", "libxmu-dev", + "make", + "netcdf-bin", + "proj-bin", "python3", - "python3-wxgtk4.0", "python3-dateutil", "python3-dev", "python3-numpy", - "python3-ply", "python3-pil", - "libnetcdf-dev", - "netcdf-bin", - "libblas-dev", - "liblapack-dev", + "python3-ply", + "python3-wxgtk4.0", "unixodbc-dev", "zlib1g-dev", # "libpdal-dev" diff --git a/binder/apt.txt b/binder/apt.txt index 1ee0d6836f9..7f4a3500c82 100644 --- a/binder/apt.txt +++ b/binder/apt.txt @@ -19,7 +19,6 @@ liblapack-dev libncurses5-dev libnetcdf-dev libpdal-dev -libgeos-dev libpng-dev libpq-dev libproj-dev diff --git a/binder/postBuild b/binder/postBuild index 138326daa18..fd462729ec3 100755 --- a/binder/postBuild +++ b/binder/postBuild @@ -5,15 +5,15 @@ set -e # compile ./configure \ - --with-nls \ - --with-cxx \ - --with-readline \ --with-bzlib \ - --with-proj-share=/usr/share/proj \ - --with-geos=/usr/bin/geos-config \ --with-cairo \ - --with-opengl-libs=/usr/include/GL \ + --with-cxx \ --with-freetype=yes --with-freetype-includes="/usr/include/freetype2/" \ + --with-geos=/usr/bin/geos-config \ + --with-nls \ + --with-opengl-libs=/usr/include/GL \ + --with-proj-share=/usr/share/proj \ + --with-readline \ --with-sqlite=yes \ --without-pdal make diff --git a/contributors.csv b/contributors.csv index 5f501d9f077..c9236bb1aea 100644 --- a/contributors.csv +++ b/contributors.csv @@ -1,25 +1,25 @@ cvs_id,name,email,country,osgeo_id,rfc2_agreed,orcid --,Ivan Shmakov,,Russia,1gray,yes,- --,Eric Patton,,Canada,epatton,yes,- --,Laura Toma,,USA,ltoma,yes,- --,Markus Metz,,Germany,mmetz,yes,0000-0002-4038-8754 --,Maris Nartiss,,Latvia,marisn,yes,0000-0002-3875-740X --,Marco Pasetti,,Italy,marcopx,yes,- --,Yann Chemin,,France,ychemin,yes,0000-0001-9232-5512 --,Colin Nielsen,,USA,cnielsen,yes,- +-,Anna Petrášová,,Czech Republic,annakrat,yes,0000-0002-5120-5538 -,Anne Ghisla,,Italy,aghisla,yes,- +-,Colin Nielsen,,USA,cnielsen,yes,- +-,Eric Patton,,Canada,epatton,yes,- -,Helmut Kudrnovsky,,Austria,hellik,yes,0000-0001-6622-7169 --,Anna Petrášová,,Czech Republic,annakrat,yes,0000-0002-5120-5538 +-,Ivan Shmakov,,Russia,1gray,yes,- +-,Laura Toma,,USA,ltoma,yes,- -,Luca Delucchi,,Italy,lucadelu,yes,0000-0002-0493-3516 --,Václav Petráš,,Czech Republic,wenzeslaus,yes,0000-0001-5566-9236 --,Pietro Zambelli,,Italy,zarch,yes,0000-0002-6187-3572 --,Štěpán Turek,,Czech Republic,turek,yes,- +-,Marco Pasetti,,Italy,marcopx,yes,- -,Margherita Di Leo,,Italy,madi,yes,0000-0002-0279-7557 --,Veronica Andreo,,Argentina,veroandreo,yes,0000-0002-4633-2161 --,Stefan Blumentrath,,Norway,sbl,yes,0000-0001-6675-1331 +-,Maris Nartiss,,Latvia,marisn,yes,0000-0002-3875-740X +-,Markus Metz,,Germany,mmetz,yes,0000-0002-4038-8754 +-,Nicklas Larsson,,Hungary/Sweden,nilason,yes,- -,Ondřej Pešek,,Czech Republic,pesekon2,yes,0000-0002-2363-8002 +-,Pietro Zambelli,,Italy,zarch,yes,0000-0002-6187-3572 +-,Stefan Blumentrath,,Norway,sbl,yes,0000-0001-6675-1331 +-,Štěpán Turek,,Czech Republic,turek,yes,- -,Tomáš Zigo,,Slovak Republic,tmszi,yes,- --,Nicklas Larsson,,Hungary/Sweden,nilason,yes,- +-,Václav Petráš,,Czech Republic,wenzeslaus,yes,0000-0001-5566-9236 +-,Veronica Andreo,,Argentina,veroandreo,yes,0000-0002-4633-2161 +-,Yann Chemin,,France,ychemin,yes,0000-0001-9232-5512 alex,Alex Shevlakov,,Russia,-,-,- andreas,Andreas Lange,,Germany,-,-,- benjamin,Benjamin Ducke,,Germany,benducke,yes,0000-0002-0560-4749 @@ -52,9 +52,9 @@ michel,Michel Wurtz,,France,-,-,- mike,Mike Thomas,,Australia,-,-,- moritz,Moritz Lennert,,Belgium,mlennert,yes,0000-0002-2870-4515 msieczka,Maciej Sieczka,,Poland,msieczka,yes,- +pallech,Serena Pallecchi,,Italy,-,-,- paul,Paul Kelly,,UK,pkelly,yes,- paulo,Paulo Marcondes,,Brazil,pmarcondes,-,- -pallech,Serena Pallecchi,,Italy,-,-,- radim,Radim Blazek,,Czech Republic,rblazek,-,- roberto,Roberto Micarelli,,Italy,-,-,- robertoa,Roberto Antolin,,Spain,rantolin,yes,- diff --git a/contributors_extra.csv b/contributors_extra.csv index 5bcbcaaa67d..1cfa5ac4a82 100644 --- a/contributors_extra.csv +++ b/contributors_extra.csv @@ -1,11 +1,11 @@ name,email,country,rfc2_agreed Adam Laža,,Czech Republic,yes +Aldo Clerici,,Italy,- Alfonso Vitti,,Italy,- -Anna Zanchetta,,Italy,yes Andrea Aime,,Italy,- Angus Carr,,Canada,- +Anna Zanchetta,,Italy,yes Antonio Galea,,Italy,- -Aldo Clerici,,Italy,- Ari Jolma,,Finland,- Bill Hughes,,USA,- Brook Milligan,,USA,- @@ -23,8 +23,8 @@ Eric Mitchell,,-,- Francesco Pirotti,,Italy,- Ivan Mincik,,Slovakia,- Jacques Bouchard,,France,- -Jarrett Keifer,,USA,- Jaro Hofierka,,Slovakia,- +Jarrett Keifer,,USA,- Jeshua Lacock,,USA,- Lars Ahlzen,,-,- Lorenzo Moretti,,Italy,- diff --git a/docker/alpine/Dockerfile b/docker/alpine/Dockerfile index b6dbebf6666..8163b5d9b08 100644 --- a/docker/alpine/Dockerfile +++ b/docker/alpine/Dockerfile @@ -29,11 +29,11 @@ ENV GRASS_RUN_PACKAGES="\ gdal-driver-JP2OpenJPEG \ gdal-driver-LIBKML \ gdal-driver-MSSQLSpatial \ + gdal-driver-netCDF \ gdal-driver-ODBC \ gdal-driver-PG \ gdal-driver-PNG \ gdal-driver-WMS \ - gdal-driver-netCDF \ gdal-tools \ geos \ geos-dev \ diff --git a/docker/debian/Dockerfile b/docker/debian/Dockerfile index 8021ccf409e..6df50c8e14d 100644 --- a/docker/debian/Dockerfile +++ b/docker/debian/Dockerfile @@ -88,15 +88,15 @@ RUN echo en_US.UTF-8 UTF-8 >> /etc/locale.gen && locale-gen WORKDIR /src RUN mkdir vdatum && \ cd vdatum && \ - wget -q http://download.osgeo.org/proj/vdatum/usa_geoid2012.zip && unzip -j -u usa_geoid2012.zip -d /usr/share/proj; \ - wget -q http://download.osgeo.org/proj/vdatum/usa_geoid2009.zip && unzip -j -u usa_geoid2009.zip -d /usr/share/proj; \ - wget -q http://download.osgeo.org/proj/vdatum/usa_geoid2003.zip && unzip -j -u usa_geoid2003.zip -d /usr/share/proj; \ + wget -q http://download.osgeo.org/proj/vdatum/egm08_25/egm08_25.gtx && mv egm08_25.gtx /usr/share/proj; \ + wget -q http://download.osgeo.org/proj/vdatum/egm96_15/egm96_15.gtx && mv egm96_15.gtx /usr/share/proj; \ wget -q http://download.osgeo.org/proj/vdatum/usa_geoid1999.zip && unzip -j -u usa_geoid1999.zip -d /usr/share/proj; \ + wget -q http://download.osgeo.org/proj/vdatum/usa_geoid2003.zip && unzip -j -u usa_geoid2003.zip -d /usr/share/proj; \ + wget -q http://download.osgeo.org/proj/vdatum/usa_geoid2009.zip && unzip -j -u usa_geoid2009.zip -d /usr/share/proj; \ + wget -q http://download.osgeo.org/proj/vdatum/usa_geoid2012.zip && unzip -j -u usa_geoid2012.zip -d /usr/share/proj; \ wget -q http://download.osgeo.org/proj/vdatum/vertcon/vertconc.gtx && mv vertconc.gtx /usr/share/proj; \ wget -q http://download.osgeo.org/proj/vdatum/vertcon/vertcone.gtx && mv vertcone.gtx /usr/share/proj; \ wget -q http://download.osgeo.org/proj/vdatum/vertcon/vertconw.gtx && mv vertconw.gtx /usr/share/proj; \ - wget -q http://download.osgeo.org/proj/vdatum/egm96_15/egm96_15.gtx && mv egm96_15.gtx /usr/share/proj; \ - wget -q http://download.osgeo.org/proj/vdatum/egm08_25/egm08_25.gtx && mv egm08_25.gtx /usr/share/proj; \ cd .. && \ rm -rf vdatum @@ -116,16 +116,16 @@ RUN wget -q \ -DCMAKE_C_COMPILER=gcc \ -DCMAKE_CXX_COMPILER=g++ \ -DCMAKE_MAKE_PROGRAM=make \ - -DBUILD_PLUGIN_PYTHON=ON \ + -DBUILD_PGPOINTCLOUD_TESTS=OFF \ -DBUILD_PLUGIN_CPD=OFF \ -DBUILD_PLUGIN_GREYHOUND=ON \ -DBUILD_PLUGIN_HEXBIN=ON \ - -DHEXER_INCLUDE_DIR=/usr/include/ \ - -DBUILD_PLUGIN_NITF=OFF \ -DBUILD_PLUGIN_ICEBRIDGE=ON \ + -DBUILD_PLUGIN_NITF=OFF \ -DBUILD_PLUGIN_PGPOINTCLOUD=OFF \ - -DBUILD_PGPOINTCLOUD_TESTS=OFF \ + -DBUILD_PLUGIN_PYTHON=ON \ -DBUILD_PLUGIN_SQLITE=ON \ + -DHEXER_INCLUDE_DIR=/usr/include/ \ -DWITH_LASZIP=OFF \ -DWITH_LAZPERF=ON \ -DWITH_TESTS=ON && \ diff --git a/docker/ubuntu/Dockerfile b/docker/ubuntu/Dockerfile index 6b928fb46c9..a3645bc558d 100644 --- a/docker/ubuntu/Dockerfile +++ b/docker/ubuntu/Dockerfile @@ -131,9 +131,9 @@ ARG GRASS_CONFIG="\ " ARG GRASS_PYTHON_PACKAGES="\ - Pillow \ matplotlib \ numpy \ + Pillow \ pip \ ply \ psycopg2 \ diff --git a/docker/ubuntu_wxgui/Dockerfile b/docker/ubuntu_wxgui/Dockerfile index 0d1ead788a3..80dbbb1d409 100644 --- a/docker/ubuntu_wxgui/Dockerfile +++ b/docker/ubuntu_wxgui/Dockerfile @@ -122,15 +122,15 @@ RUN echo en_US.UTF-8 UTF-8 >> /etc/locale.gen && locale-gen WORKDIR /src RUN mkdir vdatum && \ cd vdatum && \ - wget -q http://download.osgeo.org/proj/vdatum/usa_geoid2012.zip && unzip -j -u usa_geoid2012.zip -d /usr/share/proj; \ - wget -q http://download.osgeo.org/proj/vdatum/usa_geoid2009.zip && unzip -j -u usa_geoid2009.zip -d /usr/share/proj; \ - wget -q http://download.osgeo.org/proj/vdatum/usa_geoid2003.zip && unzip -j -u usa_geoid2003.zip -d /usr/share/proj; \ + wget -q http://download.osgeo.org/proj/vdatum/egm08_25/egm08_25.gtx && mv egm08_25.gtx /usr/share/proj; \ + wget -q http://download.osgeo.org/proj/vdatum/egm96_15/egm96_15.gtx && mv egm96_15.gtx /usr/share/proj; \ wget -q http://download.osgeo.org/proj/vdatum/usa_geoid1999.zip && unzip -j -u usa_geoid1999.zip -d /usr/share/proj; \ + wget -q http://download.osgeo.org/proj/vdatum/usa_geoid2003.zip && unzip -j -u usa_geoid2003.zip -d /usr/share/proj; \ + wget -q http://download.osgeo.org/proj/vdatum/usa_geoid2009.zip && unzip -j -u usa_geoid2009.zip -d /usr/share/proj; \ + wget -q http://download.osgeo.org/proj/vdatum/usa_geoid2012.zip && unzip -j -u usa_geoid2012.zip -d /usr/share/proj; \ wget -q http://download.osgeo.org/proj/vdatum/vertcon/vertconc.gtx && mv vertconc.gtx /usr/share/proj; \ wget -q http://download.osgeo.org/proj/vdatum/vertcon/vertcone.gtx && mv vertcone.gtx /usr/share/proj; \ wget -q http://download.osgeo.org/proj/vdatum/vertcon/vertconw.gtx && mv vertconw.gtx /usr/share/proj; \ - wget -q http://download.osgeo.org/proj/vdatum/egm96_15/egm96_15.gtx && mv egm96_15.gtx /usr/share/proj; \ - wget -q http://download.osgeo.org/proj/vdatum/egm08_25/egm08_25.gtx && mv egm08_25.gtx /usr/share/proj; \ cd .. && \ rm -rf vdatum @@ -150,16 +150,16 @@ RUN wget -q \ -DCMAKE_C_COMPILER=gcc \ -DCMAKE_CXX_COMPILER=g++ \ -DCMAKE_MAKE_PROGRAM=make \ - -DBUILD_PLUGIN_PYTHON=ON \ + -DBUILD_PGPOINTCLOUD_TESTS=OFF \ -DBUILD_PLUGIN_CPD=OFF \ -DBUILD_PLUGIN_GREYHOUND=ON \ -DBUILD_PLUGIN_HEXBIN=ON \ - -DHEXER_INCLUDE_DIR=/usr/include/ \ - -DBUILD_PLUGIN_NITF=OFF \ -DBUILD_PLUGIN_ICEBRIDGE=ON \ + -DBUILD_PLUGIN_NITF=OFF \ -DBUILD_PLUGIN_PGPOINTCLOUD=OFF \ - -DBUILD_PGPOINTCLOUD_TESTS=OFF \ + -DBUILD_PLUGIN_PYTHON=ON \ -DBUILD_PLUGIN_SQLITE=ON \ + -DHEXER_INCLUDE_DIR=/usr/include/ \ -DWITH_LASZIP=OFF \ -DWITH_LAZPERF=ON \ -DWITH_TESTS=ON && \ @@ -186,8 +186,8 @@ ENV CXXFLAGS "$MYCXXFLAGS" # Configure compile and install GRASS GIS # wxGUI require -# --with-x # --with-nls +# --with-x ENV NUMTHREADS=4 RUN make distclean || echo "nothing to clean" RUN /src/grass_build/configure \ diff --git a/macosx/ReadMe.md b/macosx/ReadMe.md index 86fb1c0ba38..085c09c691b 100644 --- a/macosx/ReadMe.md +++ b/macosx/ReadMe.md @@ -172,6 +172,11 @@ just remove the `--prefix` and `--enable-macosx-app` flags)*: ```bash ./configure \ + --enable-macosx-app \ + --prefix=/Applications \ + --with-cxx \ + --with-fftw-includes=/Library/Frameworks/FFTW3.framework/unix/include \ + --with-fftw-libs=/Library/Frameworks/FFTW3.framework/unix/lib \ --with-freetype \ --with-freetype-includes= \ "/Library/Frameworks/FreeType.framework/unix/include/freetype2 \ @@ -179,36 +184,31 @@ just remove the `--prefix` and `--enable-macosx-app` flags)*: --with-freetype-libs=/Library/Frameworks/FreeType.framework/unix/lib \ --with-gdal=/Library/Frameworks/GDAL.framework/Programs/gdal-config \ --with-geos=/Library/Frameworks/GEOS.framework/Programs/geos-config \ - --with-proj \ - --with-proj-includes=/Library/Frameworks/PROJ.framework/unix/include \ - --with-proj-libs=/Library/Frameworks/PROJ.framework/unix/lib \ - --with-proj-share=/Library/Frameworks/PROJ.framework/Resources/proj \ --with-jpeg-includes=/Library/Frameworks/UnixImageIO.framework/unix/include \ --with-jpeg-libs=/Library/Frameworks/UnixImageIO.framework/unix/lib \ + --with-odbc \ + --with-opengl=aqua \ --with-png-includes=/Library/Frameworks/UnixImageIO.framework/unix/include \ --with-png-libs=/Library/Frameworks/UnixImageIO.framework/unix/lib \ - --with-tiff-includes=/Library/Frameworks/UnixImageIO.framework/unix/include \ - --with-tiff-libs=/Library/Frameworks/UnixImageIO.framework/unix/lib \ - --without-postgres \ - --without-mysql \ - --with-odbc \ + --with-proj \ + --with-proj-includes=/Library/Frameworks/PROJ.framework/unix/include \ + --with-proj-libs=/Library/Frameworks/PROJ.framework/unix/lib \ + --with-proj-share=/Library/Frameworks/PROJ.framework/Resources/proj \ --with-sqlite \ - --with-sqlite-libs=/Library/Frameworks/SQLite3.framework/unix/lib \ --with-sqlite-includes=/Library/Frameworks/SQLite3.framework/unix/include \ - --with-fftw-includes=/Library/Frameworks/FFTW3.framework/unix/include \ - --with-fftw-libs=/Library/Frameworks/FFTW3.framework/unix/lib \ - --with-cxx \ + --with-sqlite-libs=/Library/Frameworks/SQLite3.framework/unix/lib \ --with-tcltk-includes="/Library/Frameworks/Tcl.framework/Headers \ /Library/Frameworks/Tk.framework/Headers \ /Library/Frameworks/Tk.framework/PrivateHeaders" \ --with-tcltk-libs=/usr/local/lib \ + --with-tiff-includes=/Library/Frameworks/UnixImageIO.framework/unix/include \ + --with-tiff-libs=/Library/Frameworks/UnixImageIO.framework/unix/lib \ --with-x \ - --without-motif \ --without-glw \ - --with-opengl=aqua \ - --without-readline \ - --prefix=/Applications \ - --enable-macosx-app + --without-motif \ + --without-mysql \ + --without-postgres \ + --without-readline ``` That's a long line, but you have to be very explicit in the GRASS configure @@ -533,10 +533,21 @@ For i386: ```sh cd build-i386 -../configure --enable-shared --disable-static --disable-debug \ - --disable-ffserver --disable-network --enable-gpl --enable-pthreads \ - --enable-swscale --disable-vhook --disable-ffplay --disable-ffmpeg \ - --disable-amd3dnow --arch=i386 --extra-cflags="-arch i386" \ +../configure \ + --arch=i386 \ + --disable-amd3dnow \ + --disable-debug \ + --disable-ffmpeg \ + --disable-ffplay \ + --disable-ffserver \ + --disable-network \ + --disable-static \ + --disable-vhook \ + --enable-gpl \ + --enable-pthreads \ + --enable-shared \ + --enable-swscale \ + --extra-cflags="-arch i386" \ --extra-ldflags="-arch i386" ``` @@ -555,10 +566,21 @@ Now, the PPC build: ```sh cd ../build-ppc -../configure --enable-shared --disable-static --disable-debug \ - --disable-ffserver --disable-network --enable-gpl --enable-pthreads \ - --enable-swscale --disable-vhook --disable-ffplay --disable-ffmpeg \ - --enable-altivec --arch=ppc --extra-cflags="-arch ppc" \ +../configure \ + --arch=ppc \ + --disable-debug \ + --disable-ffmpeg \ + --disable-ffplay \ + --disable-ffserver \ + --disable-network \ + --disable-static \ + --disable-vhook \ + --enable-altivec \ + --enable-gpl \ + --enable-pthreads \ + --enable-shared \ + --enable-swscale \ + --extra-cflags="-arch ppc" \ --extra-ldflags="-arch ppc" make ``` @@ -572,10 +594,21 @@ For x86_64: ```sh cd build-x86_64 -../configure --enable-shared --disable-static --disable-debug \ - --disable-ffserver --disable-network --enable-gpl --enable-pthreads \ - --enable-swscale --disable-vhook --disable-ffplay --disable-ffmpeg \ - --disable-amd3dnow --arch=x86_64 --extra-cflags="-arch x86\_64" \ +../configure \ + --arch=x86_64 \ + --disable-amd3dnow \ + --disable-debug \ + --disable-ffmpeg \ + --disable-ffplay \ + --disable-ffserver \ + --disable-network \ + --disable-static \ + --disable-vhook \ + --enable-gpl \ + --enable-pthreads \ + --enable-shared \ + --enable-swscale \ + --extra-cflags="-arch x86\_64" \ --extra-ldflags="-arch x86_64" ``` @@ -588,10 +621,21 @@ And ppc64: ```sh cd ../build-ppc64 -../configure --enable-shared --disable-static --disable-debug \ - --disable-ffserver --disable-network --enable-gpl --enable-pthreads \ - --enable-swscale --disable-vhook --disable-ffplay --disable-ffmpeg \ - --enable-altivec --arch=ppc64 --extra-cflags="-arch ppc64" \ +../configure \ + --arch=ppc64 \ + --disable-debug \ + --disable-ffmpeg \ + --disable-ffplay \ + --disable-ffserver \ + --disable-network \ + --disable-static \ + --disable-vhook \ + --enable-altivec \ + --enable-gpl \ + --enable-pthreads \ + --enable-shared \ + --enable-swscale \ + --extra-cflags="-arch ppc64" \ --extra-ldflags="-arch ppc64" ``` diff --git a/mswindows/crosscompile.sh b/mswindows/crosscompile.sh index d1b834df008..ec43dcab689 100755 --- a/mswindows/crosscompile.sh +++ b/mswindows/crosscompile.sh @@ -129,17 +129,17 @@ CFLAGS="-g -O2 -Wall" \ CXXFLAGS="-g -O2 -Wall" \ LDFLAGS="-lcurses" \ ./configure \ ---with-nls \ ---with-readline \ ---with-freetype-includes=$freetype_include \ ---with-bzlib \ ---with-postgres \ ---with-pthread \ ---with-openmp \ --with-blas \ ---with-lapack \ +--with-bzlib \ +--with-freetype-includes=$freetype_include \ --with-geos \ +--with-lapack \ --with-netcdf \ +--with-nls \ +--with-openmp \ +--with-postgres \ +--with-pthread \ +--with-readline \ >> /dev/stdout make clean default @@ -159,10 +159,10 @@ fi build_arch=`sed -n '/^ARCH[ \t]*=/{s/^.*=[ \t]*//; p}' include/Make/Platform.make` for i in \ config.log \ - include/Make/Platform.make \ + error.log \ include/Make/Doxyfile_arch_html \ include/Make/Doxyfile_arch_latex \ - error.log \ + include/Make/Platform.make \ ; do cp -a $i $i.$build_arch done @@ -186,19 +186,19 @@ PKG_CONFIG=$mxe_bin-pkg-config \ ./configure \ --build=$build_arch \ --host=$arch \ ---with-nls \ ---with-readline \ ---with-freetype-includes=$mxe_shared/include/freetype2 \ ---with-bzlib \ ---with-postgres \ ---with-pthread \ ---with-openmp \ --with-blas \ ---with-lapack \ +--with-bzlib \ +--with-freetype-includes=$mxe_shared/include/freetype2 \ +--with-gdal=$mxe_shared/bin/gdal-config \ --with-geos=$mxe_shared/bin/geos-config \ +--with-lapack \ --with-netcdf=$mxe_shared/bin/nc-config \ ---with-gdal=$mxe_shared/bin/gdal-config \ +--with-nls \ --with-opengl=windows \ +--with-openmp \ +--with-postgres \ +--with-pthread \ +--with-readline \ >> /dev/stdout make clean default @@ -217,10 +217,10 @@ fi arch=`sed -n '/^ARCH[ \t]*=/{s/^.*=[ \t]*//; p}' include/Make/Platform.make` for i in \ config.log \ - include/Make/Platform.make \ + error.log \ include/Make/Doxyfile_arch_html \ include/Make/Doxyfile_arch_latex \ - error.log \ + include/Make/Platform.make \ ; do cp -a $i $i.$arch done @@ -307,8 +307,8 @@ for i in \ done for i in \ - proj \ gdal \ + proj \ ; do rm -rf $dist/share/$i cp -a $mxe_shared/share/$i $dist/share/$i diff --git a/mswindows/osgeo4w/build_osgeo4w.sh b/mswindows/osgeo4w/build_osgeo4w.sh index d38354d4b78..98ed16aac1e 100755 --- a/mswindows/osgeo4w/build_osgeo4w.sh +++ b/mswindows/osgeo4w/build_osgeo4w.sh @@ -22,49 +22,48 @@ export PYTHONHOME=${OSGEO4W_ROOT_MSYS}/apps/Python312 export ARCH=x86_64-w64-mingw32 ./configure \ + --bindir=${OSGEO4W_ROOT_MSYS}/bin \ + --enable-largefile \ + --enable-shared \ --host=${ARCH} \ - --with-libs="${OSGEO4W_ROOT_MSYS}/lib ${OSGEO4W_ROOT_MSYS}/bin" \ - --with-includes=${OSGEO4W_ROOT_MSYS}/include \ + --includedir=${OSGEO4W_ROOT_MSYS}/include \ --libexecdir=${OSGEO4W_ROOT_MSYS}/bin \ --prefix=${OSGEO4W_ROOT_MSYS}/apps/grass \ - --bindir=${OSGEO4W_ROOT_MSYS}/bin \ - --includedir=${OSGEO4W_ROOT_MSYS}/include \ - --without-x \ + --with-blas \ + --with-bzlib \ + --with-cairo \ + --with-cairo-includes=${OSGEO4W_ROOT_MSYS}/include \ + --with-cairo-ldflags="-L${SRC}/mswindows/osgeo4w/lib -lcairo" \ + --with-cairo-libs=$OSGEO4W_ROOT_MSYS/lib \ --with-cxx \ - --enable-shared \ - --enable-largefile \ - --with-openmp \ --with-fftw \ - --with-nls \ - --with-readline \ - --with-blas \ - --with-lapack \ --with-freetype \ --with-freetype-includes=${OSGEO4W_ROOT_MSYS}/include/freetype2 \ - --with-proj-share=${OSGEO4W_ROOT_MSYS}/share/proj \ - --with-proj-includes=${OSGEO4W_ROOT_MSYS}/include \ - --with-proj-libs=${OSGEO4W_ROOT_MSYS}/lib \ + --with-gdal=${SRC}/mswindows/osgeo4w/gdal-config \ + --with-geos=${SRC}/mswindows/osgeo4w/geos-config \ + --with-includes=${OSGEO4W_ROOT_MSYS}/include \ + --with-lapack \ + --with-liblas=${SRC}/mswindows/osgeo4w/liblas-config \ + --with-libs="${OSGEO4W_ROOT_MSYS}/lib ${OSGEO4W_ROOT_MSYS}/bin" \ + --with-netcdf=${OSGEO4W_ROOT_MSYS}/bin/nc-config \ + --with-nls \ + --with-odbc \ + --with-opengl=windows \ + --with-openmp \ --with-postgres \ --with-postgres-includes=${OSGEO4W_ROOT_MSYS}/include \ --with-postgres-libs=${OSGEO4W_ROOT_MSYS}/lib \ - --with-gdal=${SRC}/mswindows/osgeo4w/gdal-config \ - --with-geos=${SRC}/mswindows/osgeo4w/geos-config \ + --with-proj-includes=${OSGEO4W_ROOT_MSYS}/include \ + --with-proj-libs=${OSGEO4W_ROOT_MSYS}/lib \ + --with-proj-share=${OSGEO4W_ROOT_MSYS}/share/proj \ + --with-readline \ + --with-regex \ --with-sqlite \ --with-sqlite-includes=${OSGEO4W_ROOT_MSYS}/include \ --with-sqlite-libs=${OSGEO4W_ROOT_MSYS}/lib \ - --with-regex \ - --with-nls \ --with-zstd \ - --with-odbc \ - --with-cairo \ - --with-cairo-includes=${OSGEO4W_ROOT_MSYS}/include \ - --with-cairo-libs=$OSGEO4W_ROOT_MSYS/lib \ - --with-cairo-ldflags="-L${SRC}/mswindows/osgeo4w/lib -lcairo" \ - --with-opengl=windows \ - --with-bzlib \ - --with-liblas=${SRC}/mswindows/osgeo4w/liblas-config \ - --with-netcdf=${OSGEO4W_ROOT_MSYS}/bin/nc-config \ - --without-pdal + --without-pdal \ + --without-x make diff --git a/mswindows/osgeo4w/package.sh b/mswindows/osgeo4w/package.sh index b3113292c99..c189cf92c93 100755 --- a/mswindows/osgeo4w/package.sh +++ b/mswindows/osgeo4w/package.sh @@ -107,32 +107,32 @@ fi exec 3>&1 > >(tee mswindows/osgeo4w/package.log) 2>&1 DLLS=" - /mingw64/bin/zlib1.dll - /mingw64/bin/libbz2-1.dll - /mingw64/bin/libiconv-2.dll - /mingw64/bin/libfontconfig-1.dll - /mingw64/bin/libgfortran-5.dll - /mingw64/bin/libbrotlidec.dll + /mingw64/bin/libblas.dll /mingw64/bin/libbrotlicommon.dll - /mingw64/bin/libintl-8.dll - /mingw64/bin/libsystre-0.dll - /mingw64/bin/libtre-5.dll - /mingw64/bin/libwinpthread-1.dll + /mingw64/bin/libbrotlidec.dll + /mingw64/bin/libbz2-1.dll /mingw64/bin/libcairo-2.dll - /mingw64/bin/libpixman-1-0.dll - /mingw64/bin/libpng16-16.dll + /mingw64/bin/libfftw3-3.dll + /mingw64/bin/libfontconfig-1.dll /mingw64/bin/libfreetype-6.dll - /mingw64/bin/libharfbuzz-0.dll + /mingw64/bin/libgcc_s_seh-1.dll + /mingw64/bin/libgfortran-5.dll /mingw64/bin/libglib-2.0-0.dll /mingw64/bin/libgomp-1.dll /mingw64/bin/libgraphite2.dll - /mingw64/bin/libpcre-1.dll - /mingw64/bin/libstdc++-6.dll - /mingw64/bin/libgcc_s_seh-1.dll - /mingw64/bin/libfftw3-3.dll - /mingw64/bin/libblas.dll + /mingw64/bin/libharfbuzz-0.dll + /mingw64/bin/libiconv-2.dll + /mingw64/bin/libintl-8.dll /mingw64/bin/liblapack.dll + /mingw64/bin/libpcre-1.dll + /mingw64/bin/libpixman-1-0.dll + /mingw64/bin/libpng16-16.dll /mingw64/bin/libquadmath-0.dll + /mingw64/bin/libstdc++-6.dll + /mingw64/bin/libsystre-0.dll + /mingw64/bin/libtre-5.dll + /mingw64/bin/libwinpthread-1.dll + /mingw64/bin/zlib1.dll " if ! [ -f mswindows/osgeo4w/configure-stamp ]; then @@ -153,47 +153,47 @@ if ! [ -f mswindows/osgeo4w/configure-stamp ]; then log configure ./configure \ + --bindir=$OSGEO4W_ROOT_MSYS/bin \ + --enable-largefile \ + --enable-shared \ --host=x86_64-w64-mingw32 \ - --with-libs="$OSGEO4W_ROOT_MSYS/lib" \ - --with-includes=$OSGEO4W_ROOT_MSYS/include \ + --includedir=$OSGEO4W_ROOT_MSYS/include \ --libexecdir=$OSGEO4W_ROOT_MSYS/bin \ --prefix=$OSGEO4W_ROOT_MSYS/apps/grass \ - --bindir=$OSGEO4W_ROOT_MSYS/bin \ - --includedir=$OSGEO4W_ROOT_MSYS/include \ - --with-opengl=windows \ - --without-x \ + --with-blas \ + --with-bzlib \ + --with-cairo \ + --with-cairo-includes=$OSGEO4W_ROOT_MSYS/include \ + --with-cairo-ldflags="-L$PWD/mswindows/osgeo4w/lib -lcairo -lfontconfig" \ --with-cxx \ - --enable-shared \ - --enable-largefile \ --with-fftw \ --with-freetype \ --with-freetype-includes=/mingw64/include/freetype2 \ - --with-proj-share=$OSGEO4W_ROOT_MSYS/share/proj \ - --with-proj-includes=$OSGEO4W_ROOT_MSYS/include \ - --with-proj-libs=$OSGEO4W_ROOT_MSYS/lib \ + --with-gdal=$PWD/mswindows/osgeo4w/gdal-config \ + --with-geos=$PWD/mswindows/osgeo4w/geos-config \ + --with-includes=$OSGEO4W_ROOT_MSYS/include \ + --with-lapack \ + --with-lapack-includes=/mingw64/include \ + --with-liblas=$PWD/mswindows/osgeo4w/liblas-config \ + --with-libs="$OSGEO4W_ROOT_MSYS/lib" \ + --with-netcdf=${OSGEO4W_ROOT_MSYS}/bin/nc-config \ + --with-nls \ + --with-odbc \ + --with-opengl=windows \ + --with-openmp \ --with-postgres \ --with-postgres-includes=$OSGEO4W_ROOT_MSYS/include \ --with-postgres-libs=$PWD/mswindows/osgeo4w/lib \ - --with-gdal=$PWD/mswindows/osgeo4w/gdal-config \ - --with-geos=$PWD/mswindows/osgeo4w/geos-config \ + --with-proj-includes=$OSGEO4W_ROOT_MSYS/include \ + --with-proj-libs=$OSGEO4W_ROOT_MSYS/lib \ + --with-proj-share=$OSGEO4W_ROOT_MSYS/share/proj \ + --with-regex \ --with-sqlite \ --with-sqlite-includes=$OSGEO4W_ROOT_MSYS/include \ --with-sqlite-libs=$PWD/mswindows/osgeo4w/lib \ - --with-regex \ - --with-nls \ --with-zstd \ - --with-odbc \ - --with-netcdf=${OSGEO4W_ROOT_MSYS}/bin/nc-config \ - --with-blas \ - --with-lapack \ - --with-lapack-includes=/mingw64/include \ - --with-openmp \ - --with-cairo \ - --with-cairo-includes=$OSGEO4W_ROOT_MSYS/include \ - --with-cairo-ldflags="-L$PWD/mswindows/osgeo4w/lib -lcairo -lfontconfig" \ - --with-bzlib \ - --with-liblas=$PWD/mswindows/osgeo4w/liblas-config \ - --without-pdal + --without-pdal \ + --without-x touch mswindows/osgeo4w/configure-stamp fi diff --git a/package.nix b/package.nix index 3f1d03697c7..edf1e3e18a4 100644 --- a/package.nix +++ b/package.nix @@ -100,8 +100,8 @@ stdenv.mkDerivation (finalAttrs: { "--with-cxx" "--with-fftw" "--with-freetype" - "--with-geos" "--with-gdal" + "--with-geos" "--with-lapack" "--with-libsvm" "--with-nls" diff --git a/rpm/grass.spec b/rpm/grass.spec index 90c79bc939f..3e4675db621 100644 --- a/rpm/grass.spec +++ b/rpm/grass.spec @@ -1,8 +1,8 @@ -%global shortver 83 +%global shortver 84 %global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d) Name: grass -Version: 8.3.0 +Version: 8.4.0 Release: 3%{?dist} Summary: GRASS GIS - Geographic Resources Analysis Support System @@ -37,64 +37,66 @@ BuildRequires: flexiblas-devel %else BuildRequires: blas-devel, lapack-devel %endif +BuildRequires: bzip2-devel BuildRequires: cairo-devel -BuildRequires: gcc-c++ BuildRequires: desktop-file-utils BuildRequires: fftw-devel BuildRequires: flex BuildRequires: freetype-devel +BuildRequires: gcc-c++ BuildRequires: gdal-devel BuildRequires: geos-devel BuildRequires: gettext BuildRequires: laszip-devel BuildRequires: libappstream-glib BuildRequires: libpng-devel +%if 0%{?rhel} && 0%{?rhel} == 7 +BuildRequires: postgresql-devel +%else +BuildRequires: libpq-devel +%endif BuildRequires: libtiff-devel BuildRequires: libXmu-devel -BuildRequires: mesa-libGL-devel -BuildRequires: mesa-libGLU-devel +BuildRequires: libzstd-devel +BuildRequires: make %if (0%{?rhel} > 7 || 0%{?fedora}) BuildRequires: mariadb-connector-c-devel openssl-devel %else BuildRequires: mysql-devel %endif +BuildRequires: mesa-libGL-devel +BuildRequires: mesa-libGLU-devel BuildRequires: netcdf-devel +BuildRequires: PDAL +BuildRequires: PDAL-devel +BuildRequires: PDAL-libs +BuildRequires: proj-devel BuildRequires: python3 %if 0%{?rhel} == 7 # EPEL7 -BuildRequires: python%{python3_version_nodots}-numpy -%else -BuildRequires: python3-numpy -%endif -%if 0%{?rhel} && 0%{?rhel} == 7 -BuildRequires: postgresql-devel +BuildRequires: python%{python3_version_nodots}-dateutil %else -BuildRequires: libpq-devel +BuildRequires: python3-dateutil %endif -BuildRequires: proj-devel +BuildRequires: python3-devel %if 0%{?rhel} == 7 # EPEL7 -BuildRequires: python%{python3_version_nodots}-dateutil +BuildRequires: python%{python3_version_nodots}-numpy %else -BuildRequires: python3-dateutil +BuildRequires: python3-numpy %endif -BuildRequires: python3-devel BuildRequires: python3-pillow -BuildRequires: PDAL -BuildRequires: PDAL-libs -BuildRequires: PDAL-devel BuildRequires: readline-devel BuildRequires: sqlite-devel BuildRequires: subversion BuildRequires: unixODBC-devel BuildRequires: zlib-devel -BuildRequires: bzip2-devel -BuildRequires: libzstd-devel -BuildRequires: make Requires: bzip2-libs -Requires: libzstd Requires: geos +Requires: libzstd +Requires: PDAL +Requires: PDAL-libs # fedora >= 34: Nothing %if (0%{?rhel} > 7 || 0%{?fedora} < 34) Requires: proj-datumgrid @@ -103,26 +105,23 @@ Requires: proj-datumgrid-world Requires: python3 %if 0%{?rhel} == 7 # EPEL7 -Requires: python%{python3_version_nodots}-numpy +Requires: python%{python3_version_nodots}-dateutil %else -Requires: python3-numpy +Requires: python3-dateutil %endif %if 0%{?rhel} == 7 # EPEL7 -Requires: python%{python3_version_nodots}-dateutil +Requires: python%{python3_version_nodots}-numpy %else -Requires: python3-dateutil +Requires: python3-numpy %endif Requires: python3-wxpython4 -Requires: PDAL -Requires: PDAL-libs %if "%{_lib}" == "lib" %global cpuarch 32 %else %global cpuarch 64 %endif - Requires: %{name}-libs%{?_isa} = %{version}-%{release} %description @@ -170,47 +169,50 @@ find -name \*.pl | xargs sed -i -e 's,#!/usr/bin/env perl,#!%{__perl},' %build %configure \ --prefix=%{_libdir} \ - --with-cxx \ - --with-tiff \ - --with-png \ - --with-postgres \ -%if 0%{?rhel} > 7 - --with-mysql=no \ -%else - --with-mysql \ -%endif - --with-opengl \ - --with-odbc \ - --with-fftw \ --with-blas \ - --with-lapack \ %if %{with flexiblas} --with-blas-includes=%{_includedir}/flexiblas \ - --with-lapack-includes=%{_includedir}/flexiblas \ %endif + --with-bzlib \ --with-cairo \ + --with-cairo-ldflags=-lfontconfig \ + --with-cxx \ + --with-fftw \ --with-freetype \ - --with-nls \ - --with-pdal \ - --with-readline \ - --with-regex \ - --with-openmp \ + --with-freetype-includes=%{_includedir}/freetype2 \ --with-gdal=%{_bindir}/gdal-config \ - --with-wxwidgets=%{_bindir}/wx-config \ --with-geos=%{_bindir}/geos-config \ - --with-netcdf=%{_bindir}/nc-config \ + --with-lapack \ +%if %{with flexiblas} + --with-lapack-includes=%{_includedir}/flexiblas \ +%endif +%if 0%{?rhel} > 7 + --with-mysql=no \ +%else + --with-mysql \ +%endif --with-mysql-includes=%{_includedir}/mysql \ %if (0%{?fedora} >= 27) --with-mysql-libs=%{_libdir} \ %else --with-mysql-libs=%{_libdir}/mysql \ %endif + --with-netcdf=%{_bindir}/nc-config \ + --with-nls \ + --with-odbc \ + --with-opengl \ + --with-openmp \ + --with-pdal \ + --with-png \ + --with-postgres \ --with-postgres-includes=%{_includedir}/pgsql \ - --with-cairo-ldflags=-lfontconfig \ - --with-freetype-includes=%{_includedir}/freetype2 \ - --with-bzlib \ - --with-zstd \ - --with-proj-share=%{_datadir}/proj + --with-proj-share=%{_datadir}/proj \ + --with-readline \ + --with-regex \ + --with-tiff \ + --with-wxwidgets=%{_bindir}/wx-config \ + --with-zstd + # .package_note hack for RHBZ #2084342 and RHBZ #2102895 sed -i "s+ -Wl,-dT,${RPM_BUILD_DIR}/grass-%{version}/.package_note-grass-%{version}-%{release}.%{_arch}.ld++g" include/Make/Platform.make @@ -338,6 +340,48 @@ fi %{_libdir}/%{name}%{shortver}/include %changelog +* Sat Oct 26 2024 Markus Neteler - 8.4.0-3 +- Sort requirements and flags (https://github.com/OSGeo/grass/pull/4563/ by Edouard Choinière) + +* Fri Sep 06 2024 Sandro Mani - 8.4.0-2 +- Rebuild (PDAL) + +* Sun Jul 28 2024 Markus Neteler - 8.4.0-1 +- Update to 8.4.0 + +* Thu Jul 18 2024 Fedora Release Engineering - 8.3.2-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Tue May 14 2024 Sandro Mani - 8.3.2-3 +- Rebuild (gdal) + +* Tue Mar 19 2024 Sandro Mani - 8.3.2-2 +- Rebuild (PDAL) + +* Thu Mar 07 2024 Markus Neteler - 8.3.2-1 +- Update to 8.3.2 (#2268514) + +* Wed Jan 24 2024 Fedora Release Engineering - 8.3.1-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sat Jan 20 2024 Fedora Release Engineering - 8.3.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Wed Jan 3 2024 Florian Weimer - 8.3.1-4 +- Fix C compatibility issue in MySQL port handling + +* Wed Nov 15 2023 Sandro Mani - 8.3.1-3 +- Rebuild (gdal) + +* Sat Oct 28 2023 Markus Neteler 8.3.1-2 +- fix obsolete configure parameters + +* Thu Oct 26 2023 Fedora Release Monitoring - 8.3.1-1 +- Update to GRASS GIS 8.3.1 (#2246359) + +* Sat Oct 14 2023 Sandro Mani - 8.3.0-4 +- Rebuild (PDAL) + * Sun Aug 06 2023 Alexandre Detiste - 8.3.0-3 - Remove support for RHEL6: Grass is now Python3 only diff --git a/singularity/debian/singularityfile_debian b/singularity/debian/singularityfile_debian index 267d7a74ad5..5858bec6911 100644 --- a/singularity/debian/singularityfile_debian +++ b/singularity/debian/singularityfile_debian @@ -17,8 +17,8 @@ Singularity container for GRASS GIS to be run into GRASS main directory # Install useful libraries apt-get -y update apt-get -y install \ - build-essential \ bison \ + build-essential \ bzip2 \ cmake \ curl \ @@ -40,10 +40,10 @@ Singularity container for GRASS GIS to be run into GRASS main directory libgsl-dev \ libjpeg-dev \ libjsoncpp-dev \ + libncurses5-dev \ + libnetcdf-dev \ libopenblas-base \ libopenblas-dev \ - libnetcdf-dev \ - libncurses5-dev \ libopenjp2-7 \ libopenjp2-7-dev \ libpdal-dev \ @@ -94,29 +94,29 @@ Singularity container for GRASS GIS to be run into GRASS main directory GRASS_PYTHON=/usr/bin/python3 ./configure \ --enable-largefile \ - --with-cxx \ - --with-nls \ - --with-readline \ - --with-sqlite \ --with-bzlib \ - --with-zstd \ --with-cairo \ --with-cairo-ldflags=-lfontconfig \ + --with-cxx \ + --with-fftw \ --with-freetype \ --with-freetype-includes="/usr/include/freetype2/" \ - --with-fftw \ + --with-geos=/usr/bin/geos-config \ --with-netcdf \ + --with-nls \ --with-pdal \ - --with-proj \ - --with-proj-share=/usr/share/proj \ - --with-geos=/usr/bin/geos-config \ --with-postgres \ --with-postgres-includes="/usr/include/postgresql" \ + --with-proj \ + --with-proj-share=/usr/share/proj \ + --with-readline \ + --with-sqlite \ + --with-zstd \ + --without-ffmpeg \ --without-mysql \ --without-odbc \ - --without-openmp \ - --without-ffmpeg \ - --without-opengl + --without-opengl \ + --without-openmp make -j 2 && make install && ldconfig # Create generic GRASS GIS binary name regardless of version number ln -sf `find /usr/local/bin -name "grass??" | sort | tail -n 1` /usr/local/bin/grass diff --git a/utils/svn_name_git_author.csv b/utils/svn_name_git_author.csv index 4811a539a82..ba1ac70d21d 100644 --- a/utils/svn_name_git_author.csv +++ b/utils/svn_name_git_author.csv @@ -130,7 +130,6 @@ paul,Paul Kelly pcav,Paolo Cavallini pesekon2,Ondřej Pešek pierreroudier,Pierre Roudier -rodrigopitanga,Rodrigo Rodrigues Da Silva pkelly,Paul Kelly pmarcondes,Paulo Marcondes @@ -146,6 +145,7 @@ robertomarzocchi,Roberto Marzocchi roberto,Roberto Flor roberto,Roberto Micarelli Robifag,Roberta Fagandini +rodrigopitanga,Rodrigo Rodrigues Da Silva roger,Roger S. Miller rorschach,Ben Hur sbl,Stefan Blumentrath diff --git a/utils/svn_name_github_name.csv b/utils/svn_name_github_name.csv index 55504c24d67..97f0f859267 100644 --- a/utils/svn_name_github_name.csv +++ b/utils/svn_name_github_name.csv @@ -1,56 +1,56 @@ svn_name,github_name 1gray,1gray aghisla,aghisla -benjamin,benducke +annakrat,petrasovaa +barton,cmbarton benducke,benducke +benjamin,benducke bernhard,bernhardreiter -cnielsen,cdwren -pvanbosgeo,ecodiv -radim,blazek -barton,cmbarton -cmbarton,cmbarton -michael,cmbarton -mic,zwischenloesung -maciej,czka -msieczka,czka +cepicky,jachym +chemin,YannChemin +cho,HuidaeCho clements,glynnc +cmbarton,cmbarton +cnielsen,cdwren +frankw,warmerdam glynn,glynnc hamish,HamishB -hellik,hellik +hcho,HuidaeCho helena,hmitaso -soeren,huhabla +hellik,hellik huhabla,huhabla -cho,HuidaeCho -hcho,HuidaeCho +isaacullah,isaacullah jachym,jachym -cepicky,jachym -william,kyngchaos kyngchaos,kyngchaos landa,landam -martinl,landam ltoma,lauratoma lucadelu,lucadelu +maciej,czka madi,madi -mmetz,metzm +markus,neteler +martinl,landam +michael,cmbarton +mic,zwischenloesung mlennert,mlennert +mmetz,metzm moritz,mlennert -markus,neteler +msieczka,czka neteler,neteler nikosa,NikosAlexandris -sbl,ninsbl -turek,ostepok paulo,paulomarcondes -annakrat,petrasovaa +pvanbosgeo,ecodiv +radim,blazek rantolin,rantolin robertoa,rantolin +sbl,ninsbl sholl,sholl +soeren,huhabla stephan,sholl +turek,ostepok +ullah,isaacullah veroandreo,veroandreo -frankw,warmerdam warmerdam,warmerdam wenzeslaus,wenzeslaus -chemin,YannChemin +william,kyngchaos ychemin,YannChemin zarch,zarch -ullah,isaacullah -isaacullah,isaacullah diff --git a/utils/vagrant/compile.sh b/utils/vagrant/compile.sh index 058eb70b1f9..5e1abc01735 100755 --- a/utils/vagrant/compile.sh +++ b/utils/vagrant/compile.sh @@ -19,31 +19,31 @@ cd /vagrant if [ ! -f "include/Make/Platform.make" ] ; then ./configure \ --bindir=/usr/bin \ - --srcdir=/vagrant \ - --prefix=/usr/lib \ + --enable-largefile \ --enable-shared \ - --with-postgres \ - --with-mysql \ + --prefix=/usr/lib \ + --srcdir=/vagrant \ + --with-blas \ + --with-bzlib \ + --with-cairo \ --with-cxx \ - --with-x \ + --with-freetype \ + --with-freetype-includes=/usr/include/freetype2 \ --with-gdal \ --with-geos \ - --with-freetype \ - --with-readline \ + --with-lapack \ + --with-mysql \ + --with-mysql-includes=`mysql_config --include | sed -e 's/-I//'` \ + --with-netcdf \ --with-nls \ --with-odbc \ - --with-netcdf \ - --with-blas \ - --with-lapack \ - --with-sqlite \ - --enable-largefile \ - --with-freetype-includes=/usr/include/freetype2 \ + --with-postgres \ --with-postgres-includes=`pg_config --includedir` \ - --with-mysql-includes=`mysql_config --include | sed -e 's/-I//'` \ --with-proj-share=/usr/share/proj \ - --with-cairo \ --with-pthread \ - --with-bzlib \ + --with-readline \ + --with-sqlite \ + --with-x \ --without-pdal fi From 35ebcb33a3275f335f6a86b283e8d5a65676a4e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sun, 3 Nov 2024 10:59:24 -0500 Subject: [PATCH 02/14] python: Add typing to RPC server and Messenger (#4639) * grass.pygrass.rpc.base: Add typing annotations for lock and conn * grass.pygrass.rpc.base: Use context manager for lock in dummy_server * grass.pygrass.rpc.base: Use context manager for threadLock in RPCServerBase * grass.pygrass.rpc.base: Remove release lock in context manager * grass.pygrass.rpc.base: Add more typing annotations * grass.pygrass.rpc.base: Check for None to satisfy mypy type checking * grass.pygrass.rpc.base: Remove release lock in context managers, as they would be released when unlocked (RuntimeError: release unlocked lock) * grass.pygrass.rpc.base: Sort imports * grass.temporal.c_libraries_interface: Use context manager for lock in c_library_server * grass.temporal.c_libraries_interface: Add typing annotations for lock and conn * grass.pygrass.rpc.base: Change date of file header * grass.pygrass.rpc.base: Update docs of conn argument to mention that it is a multiprocessing.Connection object obtained from multiprocessing.Pipe * grass.temporal.c_libraries_interface: Change date of file header * grass.pygrass.rpc: Sort imports * grass.temporal.c_libraries_interface: Sort imports * Update docs of conn argument to mention that it is a multiprocessing.Connection object obtained from multiprocessing.Pipe * grass.pygrass.messages: Sort imports * Update docs of conn argument to mention that it is a multiprocessing.connection.Connection object obtained from multiprocessing.Pipe * grass.pygrass.rpc: Use context manager to acquire and release the lock * Fix typo in python/grass/pygrass/messages/testsuite/test_pygrass_messages_doctests.py * grass.pygrass.messages: Fix typo in message_server * grass.pygrass.messages: Missing "IMPORTANT" message type in message_server * grass.pygrass.messages: Add return type to get_msgr * grass.pygrass.messages: Add types to signatures in Messenger class and rest of file * grass.pygrass.messages: Use context manager for acquiring the lock in message_server() * grass.pygrass.messages: Add types to message_types to track missing conditions * grass.pygrass.messages: Extract message only for message_types where the variable is used * grass.pygrass.messages: Add parameter descriptions to percent(self, n, d, s) * grass.pygrass.messages: Initialize Messenger fields without setting them to None * grass.pygrass.messages: Fix typo * grass.pygrass.messages: Change date of file header --- python/grass/pygrass/messages/__init__.py | 158 +++++++++--------- .../test_pygrass_messages_doctests.py | 2 +- python/grass/pygrass/rpc/__init__.py | 29 ++-- python/grass/pygrass/rpc/base.py | 107 ++++++------ .../grass/temporal/c_libraries_interface.py | 108 +++++++----- 5 files changed, 223 insertions(+), 181 deletions(-) diff --git a/python/grass/pygrass/messages/__init__.py b/python/grass/pygrass/messages/__init__.py index 54d9af1b1c5..b5fe052883c 100644 --- a/python/grass/pygrass/messages/__init__.py +++ b/python/grass/pygrass/messages/__init__.py @@ -6,34 +6,45 @@ Fast and exit-safe interface to GRASS C-library message functions -(C) 2013 by the GRASS Development Team +(C) 2013-2024 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. -@author Soeren Gebbert +@author Soeren Gebbert, Edouard Choinière """ +from __future__ import annotations + import sys -from multiprocessing import Process, Lock, Pipe +from multiprocessing import Lock, Pipe, Process +from typing import TYPE_CHECKING, Literal, NoReturn import grass.lib.gis as libgis - from grass.exceptions import FatalError +if TYPE_CHECKING: + from multiprocessing.connection import Connection + from multiprocessing.context import _LockLike + + _MessagesLiteral = Literal[ + "INFO", "IMPORTANT", "VERBOSE", "WARNING", "ERROR", "FATAL" + ] + -def message_server(lock, conn): +def message_server(lock: _LockLike, conn: Connection) -> NoReturn: """The GRASS message server function designed to be a target for multiprocessing.Process :param lock: A multiprocessing.Lock - :param conn: A multiprocessing.Pipe + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe This function will use the G_* message C-functions from grass.lib.gis to provide an interface to the GRASS C-library messaging system. - The data that is send through the pipe must provide an + The data that is sent through the pipe must provide an identifier string to specify which C-function should be called. The following identifiers are supported: @@ -52,9 +63,9 @@ def message_server(lock, conn): - "FATAL" Calls G_fatal_error(), this functions is only for testing purpose - The that is end through the pipe must be a list of values: + The data that is sent through the pipe must be a list of values: - - Messages: ["INFO|VERBOSE|WARNING|ERROR|FATAL", "MESSAGE"] + - Messages: ["INFO|IMPORTANT|VERBOSE|WARNING|ERROR|FATAL", "MESSAGE"] - Debug: ["DEBUG", level, "MESSAGE"] - Percent: ["PERCENT", n, d, s] @@ -65,44 +76,42 @@ def message_server(lock, conn): # Avoid busy waiting conn.poll(None) data = conn.recv() - message_type = data[0] + message_type: Literal[_MessagesLiteral, "DEBUG", "PERCENT", "STOP"] = data[0] # Only one process is allowed to write to stderr - lock.acquire() - - # Stop the pipe and the infinite loop - if message_type == "STOP": - conn.close() - lock.release() - libgis.G_debug(1, "Stop messenger server") - sys.exit() - - message = data[1] - - if message_type == "PERCENT": - n = int(data[1]) - d = int(data[2]) - s = int(data[3]) - libgis.G_percent(n, d, s) - elif message_type == "DEBUG": - level = data[1] - message = data[2] - libgis.G_debug(level, message) - elif message_type == "VERBOSE": - libgis.G_verbose_message(message) - elif message_type == "INFO": - libgis.G_message(message) - elif message_type == "IMPORTANT": - libgis.G_important_message(message) - elif message_type == "WARNING": - libgis.G_warning(message) - elif message_type == "ERROR": - libgis.G_important_message("ERROR: %s" % message) - # This is for testing only - elif message_type == "FATAL": - libgis.G_fatal_error(message) - - lock.release() + with lock: + # Stop the pipe and the infinite loop + if message_type == "STOP": + conn.close() + libgis.G_debug(1, "Stop messenger server") + sys.exit() + + if message_type == "PERCENT": + n = int(data[1]) + d = int(data[2]) + s = int(data[3]) + libgis.G_percent(n, d, s) + continue + if message_type == "DEBUG": + level = int(data[1]) + message_debug = data[2] + libgis.G_debug(level, message_debug) + continue + + message: str = data[1] + if message_type == "VERBOSE": + libgis.G_verbose_message(message) + elif message_type == "INFO": + libgis.G_message(message) + elif message_type == "IMPORTANT": + libgis.G_important_message(message) + elif message_type == "WARNING": + libgis.G_warning(message) + elif message_type == "ERROR": + libgis.G_important_message("ERROR: %s" % message) + # This is for testing only + elif message_type == "FATAL": + libgis.G_fatal_error(message) class Messenger: @@ -165,14 +174,19 @@ class Messenger: """ - def __init__(self, raise_on_error=False): - self.client_conn = None - self.server_conn = None - self.server = None + client_conn: Connection + server_conn: Connection + server: Process + + def __init__(self, raise_on_error: bool = False) -> None: self.raise_on_error = raise_on_error - self.start_server() + self.client_conn, self.server_conn = Pipe() + self.lock = Lock() + self.server = Process(target=message_server, args=(self.lock, self.server_conn)) + self.server.daemon = True + self.server.start() - def start_server(self): + def start_server(self) -> None: """Start the messenger server and open the pipe""" self.client_conn, self.server_conn = Pipe() self.lock = Lock() @@ -180,7 +194,7 @@ def start_server(self): self.server.daemon = True self.server.start() - def _check_restart_server(self): + def _check_restart_server(self) -> None: """Restart the server if it was terminated""" if self.server.is_alive() is True: return @@ -189,55 +203,50 @@ def _check_restart_server(self): self.start_server() self.warning("Needed to restart the messenger server") - def message(self, message): + def message(self, message: str) -> None: """Send a message to stderr :param message: the text of message - :type message: str G_message() will be called in the messenger server process """ self._check_restart_server() self.client_conn.send(["INFO", message]) - def verbose(self, message): + def verbose(self, message: str) -> None: """Send a verbose message to stderr :param message: the text of message - :type message: str G_verbose_message() will be called in the messenger server process """ self._check_restart_server() self.client_conn.send(["VERBOSE", message]) - def important(self, message): + def important(self, message: str) -> None: """Send an important message to stderr :param message: the text of message - :type message: str G_important_message() will be called in the messenger server process """ self._check_restart_server() self.client_conn.send(["IMPORTANT", message]) - def warning(self, message): + def warning(self, message: str) -> None: """Send a warning message to stderr :param message: the text of message - :type message: str G_warning() will be called in the messenger server process """ self._check_restart_server() self.client_conn.send(["WARNING", message]) - def error(self, message): + def error(self, message: str) -> None: """Send an error message to stderr :param message: the text of message - :type message: str G_important_message() with an additional "ERROR:" string at the start will be called in the messenger server process @@ -245,11 +254,10 @@ def error(self, message): self._check_restart_server() self.client_conn.send(["ERROR", message]) - def fatal(self, message): + def fatal(self, message: str) -> NoReturn: """Send an error message to stderr, call sys.exit(1) or raise FatalError :param message: the text of message - :type message: str This function emulates the behavior of G_fatal_error(). It prints an error message to stderr and calls sys.exit(1). If raise_on_error @@ -264,30 +272,29 @@ def fatal(self, message): raise FatalError(message) sys.exit(1) - def debug(self, level, message): + def debug(self, level: int, message: str) -> None: """Send a debug message to stderr :param message: the text of message - :type message: str G_debug() will be called in the messenger server process """ self._check_restart_server() self.client_conn.send(["DEBUG", level, message]) - def percent(self, n, d, s): + def percent(self, n: int, d: int, s: int) -> None: """Send a percentage to stderr - :param message: the text of message - :type message: str - + :param n: The current element + :param d: Total number of elements + :param s: Increment size G_percent() will be called in the messenger server process """ self._check_restart_server() self.client_conn.send(["PERCENT", n, d, s]) - def stop(self): + def stop(self) -> None: """Stop the messenger server and close the pipe""" if self.server is not None and self.server.is_alive(): self.client_conn.send( @@ -300,12 +307,11 @@ def stop(self): if self.client_conn is not None: self.client_conn.close() - def set_raise_on_error(self, raise_on_error=True): + def set_raise_on_error(self, raise_on_error: bool = True) -> None: """Set the fatal error behavior :param raise_on_error: if True a FatalError exception will be raised instead of calling sys.exit(1) - :type raise_on_error: bool - If raise_on_error == True, a FatalError exception will be raised if fatal() is called @@ -315,7 +321,7 @@ def set_raise_on_error(self, raise_on_error=True): """ self.raise_on_error = raise_on_error - def get_raise_on_error(self): + def get_raise_on_error(self) -> bool: """Get the fatal error behavior :returns: True if a FatalError exception will be raised or False if @@ -323,7 +329,7 @@ def get_raise_on_error(self): """ return self.raise_on_error - def test_fatal_error(self, message): + def test_fatal_error(self, message: str) -> None: """Force the messenger server to call G_fatal_error()""" import time @@ -338,7 +344,7 @@ def get_msgr( ], *args, **kwargs, -): +) -> Messenger: """Return a Messenger instance. :returns: the Messenger instance. diff --git a/python/grass/pygrass/messages/testsuite/test_pygrass_messages_doctests.py b/python/grass/pygrass/messages/testsuite/test_pygrass_messages_doctests.py index 72c20873cd6..67cd9cb3aed 100644 --- a/python/grass/pygrass/messages/testsuite/test_pygrass_messages_doctests.py +++ b/python/grass/pygrass/messages/testsuite/test_pygrass_messages_doctests.py @@ -28,7 +28,7 @@ def load_tests(loader, tests, ignore): # TODO: this must be somewhere when doctest is called, not here - # TODO: ultimate solution is not to use _ as a buildin in lib/python + # TODO: ultimate solution is not to use _ as a builtin in lib/python # for now it is the only place where it works grass.gunittest.utils.do_doctest_gettext_workaround() # this should be called at some top level diff --git a/python/grass/pygrass/rpc/__init__.py b/python/grass/pygrass/rpc/__init__.py index a6ab19b9369..e95c3453250 100644 --- a/python/grass/pygrass/rpc/__init__.py +++ b/python/grass/pygrass/rpc/__init__.py @@ -11,17 +11,18 @@ """ import sys -from multiprocessing import Process, Lock, Pipe from ctypes import CFUNCTYPE, c_void_p +from multiprocessing import Lock, Pipe, Process +import grass.lib.gis as libgis from grass.exceptions import FatalError +from grass.pygrass import utils +from grass.pygrass.gis.region import Region +from grass.pygrass.raster import RasterRow, raster2numpy_img from grass.pygrass.vector import VectorTopo from grass.pygrass.vector.basic import Bbox -from grass.pygrass.raster import RasterRow, raster2numpy_img -import grass.lib.gis as libgis + from .base import RPCServerBase -from grass.pygrass.gis.region import Region -from grass.pygrass import utils ############################################################################### ############################################################################### @@ -41,7 +42,8 @@ def _get_raster_image_as_np(lock, conn, data): a numpy array with RGB or Gray values. :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id, raster_name, extent, color] """ array = None @@ -87,7 +89,8 @@ def _get_vector_table_as_dict(lock, conn, data): """Get the table of a vector map layer as dictionary :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id, name, mapset, where] """ @@ -128,7 +131,8 @@ def _get_vector_features_as_wkb_list(lock, conn, data): point, centroid, line, boundary, area :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id,name,mapset,extent, feature_type, field] @@ -196,7 +200,8 @@ def data_provider_server(lock, conn): multiprocessing.Process :param lock: A multiprocessing.Lock - :param conn: A multiprocessing.Pipe + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe """ def error_handler(data): @@ -229,9 +234,8 @@ def error_handler(data): # Avoid busy waiting conn.poll(None) data = conn.recv() - lock.acquire() - functions[data[0]](lock, conn, data) - lock.release() + with lock: + functions[data[0]](lock, conn, data) test_vector_name = "data_provider_vector_map" @@ -461,6 +465,7 @@ def get_vector_features_as_wkb_list( if __name__ == "__main__": import doctest + from grass.pygrass.modules import Module Module("g.region", n=40, s=0, e=40, w=0, res=10) diff --git a/python/grass/pygrass/rpc/base.py b/python/grass/pygrass/rpc/base.py index 38cf48c1581..c436300c170 100644 --- a/python/grass/pygrass/rpc/base.py +++ b/python/grass/pygrass/rpc/base.py @@ -2,7 +2,7 @@ Fast and exit-safe interface to PyGRASS Raster and Vector layer using multiprocessing -(C) 2015 by the GRASS Development Team +(C) 2015-2024 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. @@ -10,35 +10,42 @@ :authors: Soeren Gebbert """ -from grass.exceptions import FatalError -import time -import threading -import sys -from multiprocessing import Process, Lock, Pipe +from __future__ import annotations + import logging +import sys +import threading +import time +from multiprocessing import Lock, Pipe, Process +from typing import TYPE_CHECKING, NoReturn + +from grass.exceptions import FatalError + +if TYPE_CHECKING: + from multiprocessing.connection import Connection + from multiprocessing.synchronize import _LockLike ############################################################################### -def dummy_server(lock, conn): +def dummy_server(lock: _LockLike, conn: Connection) -> NoReturn: """Dummy server process :param lock: A multiprocessing.Lock - :param conn: A multiprocessing.Pipe + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe """ while True: # Avoid busy waiting conn.poll(None) data = conn.recv() - lock.acquire() - if data[0] == 0: - conn.close() - lock.release() - sys.exit() - if data[0] == 1: - raise Exception("Server process intentionally killed by exception") - lock.release() + with lock: + if data[0] == 0: + conn.close() + sys.exit() + if data[0] == 1: + raise Exception("Server process intentionally killed by exception") class RPCServerBase: @@ -82,12 +89,12 @@ class RPCServerBase: """ - def __init__(self): - self.client_conn = None - self.server_conn = None + def __init__(self) -> None: + self.client_conn: Connection | None = None + self.server_conn: Connection | None = None self.queue = None self.server = None - self.checkThread = None + self.checkThread: threading.Thread | None = None self.threadLock = threading.Lock() self.start_server() self.start_checker_thread() @@ -96,10 +103,10 @@ def __init__(self): # logging.basicConfig(level=logging.DEBUG) def is_server_alive(self): - return self.server.is_alive() + return self.server.is_alive() if self.server is not None else False def is_check_thread_alive(self): - return self.checkThread.is_alive() + return self.checkThread.is_alive() if self.checkThread is not None else False def start_checker_thread(self): if self.checkThread is not None and self.checkThread.is_alive(): @@ -111,21 +118,19 @@ def start_checker_thread(self): self.checkThread.start() def stop_checker_thread(self): - self.threadLock.acquire() - self.stopThread = True - self.threadLock.release() - self.checkThread.join(None) + with self.threadLock: + self.stopThread = True + if self.checkThread is not None: + self.checkThread.join(None) def thread_checker(self): """Check every 200 micro seconds if the server process is alive""" while True: time.sleep(0.2) self._check_restart_server(caller="Server check thread") - self.threadLock.acquire() - if self.stopThread is True: - self.threadLock.release() - return - self.threadLock.release() + with self.threadLock: + if self.stopThread is True: + return def start_server(self): """This function must be re-implemented in the subclasses""" @@ -140,24 +145,25 @@ def start_server(self): def check_server(self): self._check_restart_server() - def _check_restart_server(self, caller="main thread"): + def _check_restart_server(self, caller="main thread") -> None: """Restart the server if it was terminated""" logging.debug("Check libgis server restart") - self.threadLock.acquire() - if self.server.is_alive() is True: - self.threadLock.release() - return - self.client_conn.close() - self.server_conn.close() - self.start_server() - - if self.stopped is not True: - logging.warning( - "Needed to restart the libgis server, caller: {caller}", caller=caller - ) + with self.threadLock: + if self.server is not None and self.server.is_alive() is True: + return + if self.client_conn is not None: + self.client_conn.close() + if self.server_conn is not None: + self.server_conn.close() + self.start_server() + + if self.stopped is not True: + logging.warning( + "Needed to restart the libgis server, caller: {caller}", + caller=caller, + ) - self.threadLock.release() self.stopped = False def safe_receive(self, message): @@ -184,11 +190,12 @@ def stop(self): self.stop_checker_thread() if self.server is not None and self.server.is_alive(): - self.client_conn.send( - [ - 0, - ] - ) + if self.client_conn is not None: + self.client_conn.send( + [ + 0, + ] + ) self.server.terminate() if self.client_conn is not None: self.client_conn.close() diff --git a/python/grass/temporal/c_libraries_interface.py b/python/grass/temporal/c_libraries_interface.py index 0d24fc0f732..2b7f9f033f3 100644 --- a/python/grass/temporal/c_libraries_interface.py +++ b/python/grass/temporal/c_libraries_interface.py @@ -2,7 +2,7 @@ Fast and exit-safe interface to GRASS C-library functions using ctypes and multiprocessing -(C) 2013 by the GRASS Development Team +(C) 2013-2024 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. @@ -10,11 +10,14 @@ :authors: Soeren Gebbert """ +from __future__ import annotations + import logging import sys from ctypes import CFUNCTYPE, POINTER, byref, c_int, c_void_p, cast from datetime import datetime from multiprocessing import Lock, Pipe, Process +from typing import TYPE_CHECKING import grass.lib.date as libdate import grass.lib.gis as libgis @@ -29,6 +32,10 @@ from grass.pygrass.vector import VectorTopo from grass.script.utils import encode +if TYPE_CHECKING: + from multiprocessing.connection import Connection + from multiprocessing.synchronize import _LockLike + ############################################################################### @@ -63,12 +70,13 @@ class RPCDefs: ############################################################################### -def _read_map_full_info(lock, conn, data): +def _read_map_full_info(lock: _LockLike, conn: Connection, data): """Read full map specific metadata from the spatial database using PyGRASS functions. :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id, maptype, name, mapset] """ info = None @@ -190,7 +198,7 @@ def _read_vector_full_info(name, mapset, layer=None): return info -def _fatal_error(lock, conn, data): +def _fatal_error(lock: _LockLike, conn: Connection, data): """Calls G_fatal_error()""" libgis.G_fatal_error("Fatal Error in C library server") @@ -198,11 +206,12 @@ def _fatal_error(lock, conn, data): ############################################################################### -def _get_mapset(lock, conn, data): +def _get_mapset(lock: _LockLike, conn: Connection, data): """Return the current mapset :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The mapset as list entry 1 [function_id] :returns: Name of the current mapset @@ -214,11 +223,12 @@ def _get_mapset(lock, conn, data): ############################################################################### -def _get_location(lock, conn, data): +def _get_location(lock: _LockLike, conn: Connection, data): """Return the current location :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The mapset as list entry 1 [function_id] :returns: Name of the location @@ -230,11 +240,12 @@ def _get_location(lock, conn, data): ############################################################################### -def _get_gisdbase(lock, conn, data): +def _get_gisdbase(lock: _LockLike, conn: Connection, data): """Return the current gisdatabase :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The mapset as list entry 1 [function_id] :returns: Name of the gisdatabase @@ -246,11 +257,12 @@ def _get_gisdbase(lock, conn, data): ############################################################################### -def _get_driver_name(lock, conn, data): +def _get_driver_name(lock: _LockLike, conn: Connection, data): """Return the temporal database driver of a specific mapset :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The mapset as list entry 1 [function_id, mapset] :returns: Name of the driver or None if no temporal database present @@ -264,11 +276,12 @@ def _get_driver_name(lock, conn, data): ############################################################################### -def _get_database_name(lock, conn, data): +def _get_database_name(lock: _LockLike, conn: Connection, data): """Return the temporal database name of a specific mapset :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The mapset as list entry 1 [function_id, mapset] :returns: Name of the database or None if no temporal database present @@ -293,11 +306,12 @@ def _get_database_name(lock, conn, data): ############################################################################### -def _available_mapsets(lock, conn, data): +def _available_mapsets(lock: _LockLike, conn: Connection, data): """Return all available mapsets the user can access as a list of strings :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id] :returns: Names of available mapsets as list of strings @@ -349,12 +363,13 @@ def _available_mapsets(lock, conn, data): ############################################################################### -def _has_timestamp(lock, conn, data): +def _has_timestamp(lock: _LockLike, conn: Connection, data): """Check if the file based GRASS timestamp is present and send True or False using the provided pipe. :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id, maptype, name, mapset, layer] @@ -381,7 +396,7 @@ def _has_timestamp(lock, conn, data): ############################################################################### -def _read_timestamp(lock, conn, data): +def _read_timestamp(lock: _LockLike, conn: Connection, data): """Read the file based GRASS timestamp and send the result using the provided pipe. @@ -401,7 +416,8 @@ def _read_timestamp(lock, conn, data): The end time may be None in case of a time instance. :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send the result + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send the result :param data: The list of data entries [function_id, maptype, name, mapset, layer] @@ -429,7 +445,7 @@ def _read_timestamp(lock, conn, data): ############################################################################### -def _write_timestamp(lock, conn, data): +def _write_timestamp(lock: _LockLike, conn: Connection, data): """Write the file based GRASS timestamp the return values of the called C-functions using the provided pipe. @@ -440,7 +456,8 @@ def _write_timestamp(lock, conn, data): values description. :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id, maptype, name, mapset, layer, timestring] """ @@ -473,7 +490,7 @@ def _write_timestamp(lock, conn, data): ############################################################################### -def _remove_timestamp(lock, conn, data): +def _remove_timestamp(lock: _LockLike, conn: Connection, data): """Remove the file based GRASS timestamp the return values of the called C-functions using the provided pipe. @@ -484,7 +501,8 @@ def _remove_timestamp(lock, conn, data): values description. :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id, maptype, name, mapset, layer] @@ -508,7 +526,7 @@ def _remove_timestamp(lock, conn, data): ############################################################################### -def _read_semantic_label(lock, conn, data): +def _read_semantic_label(lock: _LockLike, conn: Connection, data): """Read the file based GRASS band identifier the result using the provided pipe. @@ -516,7 +534,8 @@ def _read_semantic_label(lock, conn, data): Rast_read_semantic_label: either a semantic label string or None. :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id, maptype, name, mapset, layer, timestring] @@ -547,14 +566,15 @@ def _read_semantic_label(lock, conn, data): ############################################################################### -def _write_semantic_label(lock, conn, data): +def _write_semantic_label(lock: _LockLike, conn: Connection, data): """Write the file based GRASS band identifier. Rises ValueError on invalid semantic label. Always sends back True. :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id, maptype, name, mapset, layer, timestring] @@ -583,13 +603,14 @@ def _write_semantic_label(lock, conn, data): ############################################################################### -def _remove_semantic_label(lock, conn, data): +def _remove_semantic_label(lock: _LockLike, conn: Connection, data): """Remove the file based GRASS band identifier. The value to be send via pipe is the return value of G_remove_misc. :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id, maptype, name, mapset, layer, timestring] @@ -616,14 +637,15 @@ def _remove_semantic_label(lock, conn, data): ############################################################################### -def _map_exists(lock, conn, data): +def _map_exists(lock: _LockLike, conn: Connection, data): """Check if a map exists in the spatial database The value to be send via pipe is True in case the map exists and False if not. :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id, maptype, name, mapset] """ @@ -648,12 +670,13 @@ def _map_exists(lock, conn, data): ############################################################################### -def _read_map_info(lock, conn, data): +def _read_map_info(lock: _LockLike, conn: Connection, data): """Read map specific metadata from the spatial database using C-library functions :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id, maptype, name, mapset] """ kvp = None @@ -955,11 +978,12 @@ def _read_vector_info(name, mapset): ############################################################################### -def _read_map_history(lock, conn, data): +def _read_map_history(lock: _LockLike, conn: Connection, data): """Read map history from the spatial database using C-library functions :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id, maptype, name, mapset] """ kvp = None @@ -1174,7 +1198,7 @@ def _convert_timestamp_from_grass(ts): ############################################################################### -def _stop(lock, conn, data): +def _stop(lock: _LockLike, conn: Connection, data): libgis.G_debug(1, "Stop C-interface server") conn.close() lock.release() @@ -1184,12 +1208,13 @@ def _stop(lock, conn, data): ############################################################################### -def c_library_server(lock, conn): +def c_library_server(lock: _LockLike, conn: Connection): """The GRASS C-libraries server function designed to be a target for multiprocessing.Process :param lock: A multiprocessing.Lock - :param conn: A multiprocessing.Pipe + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe """ def error_handler(data): @@ -1239,9 +1264,8 @@ def error_handler(data): # Avoid busy waiting conn.poll(None) data = conn.recv() - lock.acquire() - functions[data[0]](lock, conn, data) - lock.release() + with lock: + functions[data[0]](lock, conn, data) class CLibrariesInterface(RPCServerBase): From d4bb783424e1799a3306f26e413dcfaa148de9bc Mon Sep 17 00:00:00 2001 From: Nicklas Larsson Date: Mon, 4 Nov 2024 23:29:36 +0100 Subject: [PATCH 03/14] CI: add expat dependency to macOS runner (#4646) --- .github/workflows/macos_dependencies.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/macos_dependencies.txt b/.github/workflows/macos_dependencies.txt index 8ef1d3460f6..28e680d3ae5 100644 --- a/.github/workflows/macos_dependencies.txt +++ b/.github/workflows/macos_dependencies.txt @@ -2,6 +2,7 @@ cairo clangxx_osx-arm64 clang_osx-arm64 cmake +expat fftw flex freetype From 7cd22e98da1fb58aeebb3de57b8c50d375dbe6e0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 02:31:22 +0000 Subject: [PATCH 04/14] CI(deps): Update DeterminateSystems/nix-installer-action action to v15 (#4645) --- .github/workflows/test-nix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-nix.yml b/.github/workflows/test-nix.yml index 43a1b5d40ab..6ce1285de9f 100644 --- a/.github/workflows/test-nix.yml +++ b/.github/workflows/test-nix.yml @@ -31,7 +31,7 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Install nix - uses: DeterminateSystems/nix-installer-action@da36cb69b1c3247ad7a1f931ebfd954a1105ef14 # v14 + uses: DeterminateSystems/nix-installer-action@b92f66560d6f97d6576405a7bae901ab57e72b6a # v15 - name: Setup cachix uses: cachix/cachix-action@ad2ddac53f961de1989924296a1f236fcfbaa4fc # v15 From 847944e18e8c11f412e41c7767424f8ced6dbb3f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 02:34:13 +0000 Subject: [PATCH 05/14] CI(deps): Lock file maintenance (#4643) --- flake.lock | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/flake.lock b/flake.lock index c507c1ec951..f36f65a6375 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1727826117, - "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=", + "lastModified": 1730504689, + "narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1", + "rev": "506278e768c2a08bec68eb62932193e341f55c90", "type": "github" }, "original": { @@ -19,11 +19,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1730045389, - "narHash": "sha256-4spSNTZ6h8Xmvrr9oqfuxc9jarasGj1QOcsgw8BfNd8=", + "lastModified": 1730272153, + "narHash": "sha256-B5WRZYsRlJgwVHIV6DvidFN7VX7Fg9uuwkRW9Ha8z+w=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0fcb98acb6633445764dafe180e6833eb0f95208", + "rev": "2d2a9ddbe3f2c00747398f3dc9b05f7f2ebb0f53", "type": "github" }, "original": { @@ -35,14 +35,14 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1727825735, - "narHash": "sha256-0xHYkMkeLVQAMa7gvkddbPqpxph+hDzdu1XdGPJR+Os=", + "lastModified": 1730504152, + "narHash": "sha256-lXvH/vOfb4aGYyvFmZK/HlsNsr/0CVWlwYvo2rxJk3s=", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" }, "original": { "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" } }, "root": { From 3307797b5b552b395cbf9761fc7ee515cfd33ada Mon Sep 17 00:00:00 2001 From: ShubhamDesai <42180509+ShubhamDesai@users.noreply.github.com> Date: Tue, 5 Nov 2024 02:59:38 -0500 Subject: [PATCH 06/14] lib/vector/Vlib: Fix Resource Leak issues in break_polygons.c (#4612) --- lib/vector/Vlib/break_polygons.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/vector/Vlib/break_polygons.c b/lib/vector/Vlib/break_polygons.c index 2b82d8eff62..1eb548f96c1 100644 --- a/lib/vector/Vlib/break_polygons.c +++ b/lib/vector/Vlib/break_polygons.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -131,11 +132,19 @@ void Vect_break_polygons_file(struct Map_info *Map, int type, filename = G_tempfile(); fd = open(filename, O_RDWR | O_CREAT | O_EXCL, 0600); RTree = RTreeCreateTree(fd, 0, 2); - remove(filename); + (void)remove(filename); + G_free(filename); filename = G_tempfile(); xpntfd = open(filename, O_RDWR | O_CREAT | O_EXCL, 0600); - remove(filename); + if (xpntfd < 0) { + close(RTree->fd); + G_free(filename); + G_fatal_error(_("Failed to create xpnt temporary file: %s"), + strerror(errno)); + } + (void)remove(filename); + G_free(filename); BPoints = Vect_new_line_struct(); Points = Vect_new_line_struct(); @@ -651,6 +660,7 @@ void Vect_break_polygons_mem(struct Map_info *Map, int type, Vect_destroy_line_struct(Points); Vect_destroy_line_struct(BPoints); Vect_destroy_cats_struct(Cats); + Vect_destroy_cats_struct(ErrCats); G_verbose_message(_("Breaks: %d"), nbreaks); } From 0ad65e4ebd336ca43e21be8f1b38980552da3836 Mon Sep 17 00:00:00 2001 From: ShubhamDesai <42180509+ShubhamDesai@users.noreply.github.com> Date: Tue, 5 Nov 2024 03:03:07 -0500 Subject: [PATCH 07/14] v.delaunay: Fix Resource Leak issues in in_out.c (#4625) --- vector/v.delaunay/in_out.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vector/v.delaunay/in_out.c b/vector/v.delaunay/in_out.c index 8cc62cd8a0e..51938859847 100644 --- a/vector/v.delaunay/in_out.c +++ b/vector/v.delaunay/in_out.c @@ -178,6 +178,8 @@ void output_triangles(unsigned int n, int mode3d UNUSED, int type, e = NEXT(e, u); } while (!SAME_EDGE(e, e_start)); } + Vect_destroy_line_struct(Points); + Vect_destroy_cats_struct(Cats); } void remove_duplicates(unsigned int *size) From 7d878593c3fa3e8009e394097876a8a0812c13ec Mon Sep 17 00:00:00 2001 From: ShubhamDesai <42180509+ShubhamDesai@users.noreply.github.com> Date: Tue, 5 Nov 2024 03:06:44 -0500 Subject: [PATCH 08/14] lib/ogsf: Fix resource leak issue in gsd_img_tif.c (#4626) --- lib/ogsf/gsd_img_tif.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ogsf/gsd_img_tif.c b/lib/ogsf/gsd_img_tif.c index 47f9b4ebbc5..c2518bb8bea 100644 --- a/lib/ogsf/gsd_img_tif.c +++ b/lib/ogsf/gsd_img_tif.c @@ -116,6 +116,7 @@ int GS_write_tif(const char *name) } G_free((void *)pixbuf); + G_free(buf); (void)TIFFClose(out); return (0); From baf93a5c43e36363d2698440fcd419f07d3eb59b Mon Sep 17 00:00:00 2001 From: Nicklas Larsson Date: Tue, 5 Nov 2024 13:32:47 +0100 Subject: [PATCH 09/14] r.viewshed: address -Wunused-value warnings (#4609) --- raster/r.viewshed/grass.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/raster/r.viewshed/grass.cpp b/raster/r.viewshed/grass.cpp index 89d2879db0d..6ab70e4d9e2 100644 --- a/raster/r.viewshed/grass.cpp +++ b/raster/r.viewshed/grass.cpp @@ -450,6 +450,7 @@ AMI_STREAM *init_event_list(char *rastName, Viewpoint *vp, Rast_set_null_value(inrast[2], ncols, data_type); /*scan through the raster data */ + // int isnull = 0; dimensionType i, j; double ax, ay; AEvent e; @@ -483,7 +484,7 @@ AMI_STREAM *init_event_list(char *rastName, Viewpoint *vp, e.col = j; /*read the elevation value into the event */ - Rast_is_null_value(&(inrast[1][j]), data_type); + // isnull = Rast_is_null_value(&(inrast[1][j]), data_type); e.elev[1] = inrast[1][j]; /* adjust for curvature */ @@ -971,18 +972,19 @@ void save_io_vis_and_elev_to_GRASS(IOVisibilityGrid *visgrid, char *elevfname, for (j = 0; j < Rast_window_cols(); j++) { /* read the current elevation value */ + // int isNull = 0; switch (elev_data_type) { case CELL_TYPE: - Rast_is_c_null_value(&((CELL *)elevrast)[j]); + // isNull = Rast_is_c_null_value(&((CELL *)elevrast)[j]); elev = (double)(((CELL *)elevrast)[j]); break; case FCELL_TYPE: - Rast_is_f_null_value(&((FCELL *)elevrast)[j]); + // isNull = Rast_is_f_null_value(&((FCELL *)elevrast)[j]); elev = (double)(((FCELL *)elevrast)[j]); break; case DCELL_TYPE: - Rast_is_d_null_value(&((DCELL *)elevrast)[j]); + // isNull = Rast_is_d_null_value(&((DCELL *)elevrast)[j]); elev = (double)(((DCELL *)elevrast)[j]); break; } From 16c5f6fef8aa6958d50c172cb32f37e4b04301d2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 07:38:34 -0500 Subject: [PATCH 10/14] CI(deps): Update mamba-org/setup-micromamba action to v2.0.1 (#4648) --- .github/workflows/macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index cdc02ad1432..466a61967b7 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -50,7 +50,7 @@ jobs: # Year and week of year so cache key changes weekly run: echo "date=$(date +%Y-%U)" >> "${GITHUB_OUTPUT}" - name: Setup Mamba - uses: mamba-org/setup-micromamba@617811f69075e3fd3ae68ca64220ad065877f246 # v2.0.0 + uses: mamba-org/setup-micromamba@ab6bf8bf7403e8023a094abeec19d6753bdc143e # v2.0.1 with: init-shell: bash environment-file: .github/workflows/macos_dependencies.txt From f7537c41c00dbf9f5e5253aca412c1e4100d4a99 Mon Sep 17 00:00:00 2001 From: Mohan Yelugoti Date: Tue, 5 Nov 2024 09:30:35 -0500 Subject: [PATCH 11/14] lib/ogsf: fix possible overflow errors in gsd_surf.c (#4635) ogsf: fix possible overflow errors in gsd modules In a lot of places, `(255 << 24)` which causes integer overflow and positive number gets converted to negative number. We were then assigning this to an unsigned integer in multiple places, which does conversion in a different way. For example: If we do unsigned int x = -20, `UINT_MAX + 1 - 20` is assigned to x. I do not think that's what is intended when we do `ktrans = (255 << 24)`. Fix instances of that, by using an unsigned int literal over int literal. This issue was found using cppcheck tool. Signed-off-by: Mohan Yelugoti --- lib/ogsf/gsd_surf.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/ogsf/gsd_surf.c b/lib/ogsf/gsd_surf.c index d22e17a8918..ae7c9d5dd49 100644 --- a/lib/ogsf/gsd_surf.c +++ b/lib/ogsf/gsd_surf.c @@ -228,7 +228,7 @@ int gsd_surf_map_old(geosurf *surf) */ check_transp = 0; tratt = &(surf->att[ATT_TRANSP]); - ktrans = (255 << 24); + ktrans = (255U << 24); trans_src = surf->att[ATT_TRANSP].att_src; if (CONST_ATT == trans_src && surf->att[ATT_TRANSP].constant != 0.0) { @@ -344,7 +344,7 @@ int gsd_surf_map_old(geosurf *surf) if (check_transp) { GET_MAPATT(trbuff, offset, ttr); ktrans = (char)SCALE_ATT(tratt, ttr, 0, 255); - ktrans = (char)(255 - ktrans) << 24; + ktrans = (char)(255U - ktrans) << 24; } gsd_litvert_func(n, ktrans | curcolor, pt); @@ -369,7 +369,7 @@ int gsd_surf_map_old(geosurf *surf) if (check_transp) { GET_MAPATT(trbuff, offset, ttr); ktrans = (char)SCALE_ATT(tratt, ttr, 0, 255); - ktrans = (char)(255 - ktrans) << 24; + ktrans = (char)(255U - ktrans) << 24; } if (check_material) { @@ -469,7 +469,7 @@ int gsd_surf_map_old(geosurf *surf) if (check_transp) { GET_MAPATT(trbuff, offset, ttr); ktrans = (char)SCALE_ATT(tratt, ttr, 0, 255); - ktrans = (char)(255 - ktrans) << 24; + ktrans = (char)(255U - ktrans) << 24; } if (check_material) { @@ -524,7 +524,7 @@ int gsd_surf_map_old(geosurf *surf) if (check_transp) { GET_MAPATT(trbuff, offset, ttr); ktrans = (char)SCALE_ATT(tratt, ttr, 0, 255); - ktrans = (char)(255 - ktrans) << 24; + ktrans = (char)(255U - ktrans) << 24; } if (check_material) { @@ -580,7 +580,7 @@ int gsd_surf_map_old(geosurf *surf) if (check_transp) { GET_MAPATT(trbuff, offset, ttr); ktrans = (char)SCALE_ATT(tratt, ttr, 0, 255); - ktrans = (char)(255 - ktrans) << 24; + ktrans = (char)(255U - ktrans) << 24; } if (check_material) { @@ -649,7 +649,7 @@ int gsd_surf_map_old(geosurf *surf) if (check_transp) { GET_MAPATT(trbuff, offset, ttr); ktrans = (char)SCALE_ATT(tratt, ttr, 0, 255); - ktrans = (char)(255 - ktrans) << 24; + ktrans = (char)(255U - ktrans) << 24; } if (check_material) { @@ -2144,7 +2144,7 @@ int gsd_surf_map(geosurf *surf) */ check_transp = 0; tratt = &(surf->att[ATT_TRANSP]); - ktrans = (255 << 24); + ktrans = (255U << 24); trans_src = surf->att[ATT_TRANSP].att_src; if (CONST_ATT == trans_src && surf->att[ATT_TRANSP].constant != 0.0) { @@ -2328,7 +2328,7 @@ int gsd_surf_map(geosurf *surf) if (check_transp) { GET_MAPATT(trbuff, offset2[ii], ttr); ktrans = (char)SCALE_ATT(tratt, ttr, 0, 255); - ktrans = (char)(255 - ktrans) << 24; + ktrans = (char)(255U - ktrans) << 24; } if (check_material) { From 4854f491a00d482bfaad1817113c39f4b90fb06f Mon Sep 17 00:00:00 2001 From: ShubhamDesai <42180509+ShubhamDesai@users.noreply.github.com> Date: Tue, 5 Nov 2024 09:31:05 -0500 Subject: [PATCH 12/14] lib/vector/Vlib: Fix resource leak issue in clean_nodes.c (#4627) fix resource leak issue Co-authored-by: Shubham Vasudeo Desai --- lib/vector/Vlib/clean_nodes.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/vector/Vlib/clean_nodes.c b/lib/vector/Vlib/clean_nodes.c index bff6d502129..2ba34985549 100644 --- a/lib/vector/Vlib/clean_nodes.c +++ b/lib/vector/Vlib/clean_nodes.c @@ -241,6 +241,10 @@ int Vect_clean_small_angles_at_nodes(struct Map_info *Map, int otype, } } G_verbose_message(_("Modifications: %d"), nmodif); + Vect_destroy_line_struct(Points); + Vect_destroy_cats_struct(OCats); + Vect_destroy_cats_struct(LCats); + Vect_destroy_cats_struct(SCats); return (nmodif); } From c1d855738a428be4d55a7dfbae7f97c3ed0c3f05 Mon Sep 17 00:00:00 2001 From: Mohan Yelugoti Date: Tue, 5 Nov 2024 09:31:35 -0500 Subject: [PATCH 13/14] lib/ogsf: fix possible overflow errors in gvld.c (#4637) ogsf: fix possible overflow errors in gvld module We were doing `(255 << 24)` which causes integer overflow and positive number gets converted to negative number. We were then assigning this to an unsigned integer in multiple places, which does conversion in a different way. For example: If we do unsigned int x = -20, `UINT_MAX + 1 - 20` is assigned to x. I do not think that's what is intended when we do `ktrans = (255 << 24)`. Fix instances of that, by using an unsigned int literal over int literal. This issue was found using cppcheck tool. Signed-off-by: Mohan Yelugoti --- lib/ogsf/gvld.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ogsf/gvld.c b/lib/ogsf/gvld.c index 91734eaac49..9c0831b5bcd 100644 --- a/lib/ogsf/gvld.c +++ b/lib/ogsf/gvld.c @@ -188,7 +188,7 @@ int gvld_isosurf(geovol *gvl) /* transparency */ check_transp[i] = 0; - ktrans[i] = (255 << 24); + ktrans[i] = (255U << 24); if (CONST_ATT == isosurf->att[ATT_TRANSP].att_src && isosurf->att[ATT_TRANSP].constant != 0.0) { ktrans[i] = (255 - (int)isosurf->att[ATT_TRANSP].constant) << 24; From 206cabcbb7275debed2bcdd9c1a3869ab58552fc Mon Sep 17 00:00:00 2001 From: Mohan Yelugoti Date: Tue, 5 Nov 2024 09:32:14 -0500 Subject: [PATCH 14/14] lib/ogsf: fix possible overflow errors in gsd_wire.c (#4636) ogsf: fix possible overflow errors in gsd_wire In a code, we were doing `(255 << 24)` which causes integer overflow and positive number gets converted to negative number. We were then assigning this to an unsigned integer in multiple places, which does conversion in a different way. For example: If we do `unsigned int x = -20`, `UINT_MAX + 1 - 20` is assigned to x. I do not think that's what is intended when we do with `ktrans = (255 << 24)`. Fix instances of that, by using an `unsigned int literal` over `int literal`. This issue was found using cppcheck tool. Signed-off-by: Mohan Yelugoti --- lib/ogsf/gsd_wire.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ogsf/gsd_wire.c b/lib/ogsf/gsd_wire.c index 0da492b9b15..1b3b8e6c084 100644 --- a/lib/ogsf/gsd_wire.c +++ b/lib/ogsf/gsd_wire.c @@ -645,7 +645,7 @@ int gsd_coarse_surf_map(geosurf *surf) */ check_transp = 0; tratt = &(surf->att[ATT_TRANSP]); - ktrans = (255 << 24); + ktrans = (255U << 24); trans_src = surf->att[ATT_TRANSP].att_src; if (CONST_ATT == trans_src && surf->att[ATT_TRANSP].constant != 0.0) { @@ -798,7 +798,7 @@ int gsd_coarse_surf_map(geosurf *surf) if (check_transp) { GET_MAPATT(trbuff, offset2[ii], ttr); ktrans = (char)SCALE_ATT(tratt, ttr, 0, 255); - ktrans = (char)(255 - ktrans) << 24; + ktrans = (char)(255U - ktrans) << 24; } if (check_material) {