From 0f62a04a40487ffc90692adafb19ed1d9150789b Mon Sep 17 00:00:00 2001 From: Krul Ceter Date: Sat, 14 Jan 2023 05:39:52 +0300 Subject: [PATCH] fixup! grass: update to 7.8.7; rebuild for proj 9.1 --- .../grass/patches/fix-gettext-python.patch | 26 ++- srcpkgs/grass/patches/fix-locale-python.patch | 197 +++++++++++++----- srcpkgs/grass/template | 17 +- 3 files changed, 162 insertions(+), 78 deletions(-) diff --git a/srcpkgs/grass/patches/fix-gettext-python.patch b/srcpkgs/grass/patches/fix-gettext-python.patch index bb407fc8bc..4dd04a4662 100644 --- a/srcpkgs/grass/patches/fix-gettext-python.patch +++ b/srcpkgs/grass/patches/fix-gettext-python.patch @@ -1,18 +1,28 @@ -"codeset" in gettext.install() is deprecated with python 3.11 +https://github.com/OSGeo/grass/commit/31a672db8fcb8b4151ab54943829e00dfaa410c7 -Backported from https://github.com/OSGeo/grass/pull/2539 +From 31a672db8fcb8b4151ab54943829e00dfaa410c7 Mon Sep 17 00:00:00 2001 +From: Ondrej Pesek +Date: Sat, 17 Sep 2022 12:05:33 +0200 +Subject: [PATCH] grass.py: fix missing parameters in gettext.install() +fix #2507 +--- + lib/init/grass.py | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/lib/init/grass.py b/lib/init/grass.py +index d4b91cc01e..71e16c51a1 100755 --- a/lib/init/grass.py +++ b/lib/init/grass.py -@@ -1392,10 +1392,7 @@ - del os.environ['LC_ALL'] # Remove LC_ALL to not override LC_NUMERIC +@@ -1564,10 +1564,7 @@ def set_language(grass_config_dir): + del os.environ["LC_ALL"] # Remove LC_ALL to not override LC_NUMERIC # From now on enforce the new language - if encoding: -- gettext.install('grasslibs', gpath('locale'), codeset=encoding) +- gettext.install("grasslibs", gpath("locale"), codeset=encoding) - else: -- gettext.install('grasslibs', gpath('locale')) -+ gettext.install('grasslibs', gpath('locale')) +- gettext.install("grasslibs", gpath("locale")) ++ gettext.install("grasslibs", gpath("locale")) - # TODO: grass_gui parameter is a hack and should be removed, see below + def lock_mapset(mapset_path, force_gislock_removal, user): diff --git a/srcpkgs/grass/patches/fix-locale-python.patch b/srcpkgs/grass/patches/fix-locale-python.patch index a8a0529b20..74451bb6d9 100644 --- a/srcpkgs/grass/patches/fix-locale-python.patch +++ b/srcpkgs/grass/patches/fix-locale-python.patch @@ -1,130 +1,213 @@ -locale.getdefaultlocale() is deprecated with python 3.11 +https://github.com/OSGeo/grass/commit/722aaa0ada0a26d09c5dc9a6b25323abe5caaa98 -Adapted from https://github.com/OSGeo/grass/pull/2550 +From 722aaa0ada0a26d09c5dc9a6b25323abe5caaa98 Mon Sep 17 00:00:00 2001 +From: Ondrej Pesek +Date: Sat, 17 Sep 2022 10:35:43 +0200 +Subject: [PATCH] avoid using deprecated locale.getdefaultlocale() -diff a/gui/wxpython/core/gcmd.py +* fix #2538 +* Use getencoding() where only encoding is needed; getlocale() otherwise +--- + gui/wxpython/core/gcmd.py | 6 +++++- + gui/wxpython/core/gconsole.py | 6 +++++- + gui/wxpython/gui_core/forms.py | 18 +++++++++++++++--- + gui/wxpython/gui_core/ghelp.py | 6 +++++- + gui/wxpython/rlisetup/frame.py | 6 +++++- + lib/init/grass.py | 12 ++++++++++-- + python/grass/gunittest/multirunner.py | 6 +++++- + python/grass/script/utils.py | 6 +++++- + utils/mkhtml.py | 6 +++++- + 9 files changed, 60 insertions(+), 12 deletions(-) + +diff --git a/gui/wxpython/core/gcmd.py b/gui/wxpython/core/gcmd.py +index 9bea1ee151..b85874dc24 100644 --- a/gui/wxpython/core/gcmd.py +++ b/gui/wxpython/core/gcmd.py -@@ -773,7 +773,7 @@ +@@ -783,7 +783,11 @@ def GetDefaultEncoding(forceUTF8=False): :return: system encoding (can be None) """ - enc = locale.getdefaultlocale()[1] -+ enc = locale.getencoding() - if forceUTF8 and (enc is None or enc == 'UTF8'): - return 'UTF-8' ++ try: ++ # Python >= 3.11 ++ enc = locale.getencoding() ++ except AttributeError: ++ enc = locale.getdefaultlocale()[1] + if forceUTF8 and (enc is None or enc == "UTF8"): + return "UTF-8" -diff a/gui/wxpython/core/gconsole.py b/gui/wxpython/core/gconsole.py +diff --git a/gui/wxpython/core/gconsole.py b/gui/wxpython/core/gconsole.py +index 9634390731..69ce80da43 100644 --- a/gui/wxpython/core/gconsole.py +++ b/gui/wxpython/core/gconsole.py -@@ -399,7 +399,7 @@ +@@ -408,7 +408,11 @@ def Redirect(self): sys.stdout = self.cmdStdOut sys.stderr = self.cmdStdErr else: - enc = locale.getdefaultlocale()[1] -+ enc = locale.getencoding() ++ try: ++ # Python >= 3.11 ++ enc = locale.getencoding() ++ except AttributeError: ++ enc = locale.getdefaultlocale()[1] if enc: if sys.version_info.major == 2: sys.stdout = codecs.getwriter(enc)(sys.__stdout__) -diff a/gui/wxpython/gui_core/forms.py b/gui/wxpython/gui_core/forms.py +diff --git a/gui/wxpython/gui_core/forms.py b/gui/wxpython/gui_core/forms.py +index b7d122774c..1465aca4da 100644 --- a/gui/wxpython/gui_core/forms.py +++ b/gui/wxpython/gui_core/forms.py -@@ -1858,7 +1858,7 @@ - size=(-1, 75)) - if p.get('value', '') and os.path.isfile(p['value']): +@@ -2035,7 +2035,11 @@ def __init__(self, parent, giface, task, id=wx.ID_ANY, frame=None, *args, **kwar + ) + if p.get("value", "") and os.path.isfile(p["value"]): ifbb.Clear() - enc = locale.getdefaultlocale()[1] -+ enc = locale.getencoding() - with codecs.open(p['value'], encoding=enc, errors='ignore') as f: - nonascii = bytearray(range(0x80, 0x100)) - for line in f.readlines(): -@@ -2389,7 +2389,7 @@ ++ try: ++ # Python >= 3.11 ++ enc = locale.getencoding() ++ except AttributeError: ++ enc = locale.getdefaultlocale()[1] + with codecs.open( + p["value"], encoding=enc, errors="ignore" + ) as f: +@@ -2594,7 +2598,11 @@ def OnFileSave(self, event): if dlg.ShowModal() == wx.ID_OK: path = dlg.GetPath() - enc = locale.getdefaultlocale()[1] -+ enc = locale.getencoding() - f = codecs.open(path, encoding=enc, mode='w', errors='replace') ++ try: ++ # Python >= 3.11 ++ enc = locale.getencoding() ++ except AttributeError: ++ enc = locale.getdefaultlocale()[1] + f = codecs.open(path, encoding=enc, mode="w", errors="replace") try: f.write(text + os.linesep) -diff a/gui/wxpython/gui_core/ghelp.py b/gui/wxpython/gui_core/ghelp.py +@@ -2618,7 +2626,11 @@ def OnFileText(self, event): + filename = grass.tempfile() + win.SetValue(filename) + +- enc = locale.getdefaultlocale()[1] ++ try: ++ # Python >= 3.11 ++ enc = locale.getencoding() ++ except AttributeError: ++ enc = locale.getdefaultlocale()[1] + f = codecs.open(filename, encoding=enc, mode="w", errors="replace") + try: + f.write(text) +diff --git a/gui/wxpython/gui_core/ghelp.py b/gui/wxpython/gui_core/ghelp.py +index 3a2e18789d..76f85fb433 100644 --- a/gui/wxpython/gui_core/ghelp.py +++ b/gui/wxpython/gui_core/ghelp.py -@@ -234,7 +234,7 @@ - self.langUsed = grass.gisenv().get('LANG', None) +@@ -239,7 +239,11 @@ def _pageInfo(self): if not self.langUsed: import locale + - loc = locale.getdefaultlocale() -+ loc = locale.getlocale() ++ try: ++ # Python >= 3.11 ++ loc = locale.getlocale() ++ except AttributeError: ++ loc = locale.getdefaultlocale() if loc == (None, None): - self.langUsed = _('unknown') + self.langUsed = _("unknown") else: -diff a/gui/wxpython/rlisetup/frame.py b/gui/wxpython/rlisetup/frame.py +diff --git a/gui/wxpython/rlisetup/frame.py b/gui/wxpython/rlisetup/frame.py +index e2a6a4e7bd..6b239f8c8b 100644 --- a/gui/wxpython/rlisetup/frame.py +++ b/gui/wxpython/rlisetup/frame.py -@@ -49,7 +49,7 @@ +@@ -58,7 +58,11 @@ def __init__( self.btn_close.Bind(wx.EVT_BUTTON, self.OnClose) self.btn_ok.Bind(wx.EVT_BUTTON, self.OnOk) self._layout() - self.enc = locale.getdefaultlocale()[1] -+ self.enc = locale.getencoding() ++ try: ++ # Python >= 3.11 ++ self.enc = locale.getencoding() ++ except AttributeError: ++ self.enc = locale.getdefaultlocale()[1] def _layout(self): """Set the layout""" -diff a/lib/init/grass.py b/lib/init/grass.py +diff --git a/lib/init/grass.py b/lib/init/grass.py +index e430878661..d4b91cc01e 100755 --- a/lib/init/grass.py +++ b/lib/init/grass.py -@@ -62,7 +62,7 @@ +@@ -65,7 +65,11 @@ # for wxpath _WXPYTHON_BASE = None -ENCODING = locale.getdefaultlocale()[1] -+ENCODING = locale.getencoding() ++try: ++ # Python >= 3.11 ++ ENCODING = locale.getencoding() ++except AttributeError: ++ ENCODING = locale.getdefaultlocale()[1] if ENCODING is None: - ENCODING = 'UTF-8' + ENCODING = "UTF-8" print("Default locale not found, using UTF-8") # intentionally not translatable -@@ -1278,7 +1278,7 @@ - locale.setlocale(locale.LC_ALL, 'C') - sys.stderr.write("Default locale settings are missing. GRASS running with C locale.\n") +@@ -1414,7 +1418,11 @@ def set_language(grass_config_dir): + "Default locale settings are missing. GRASS running with C locale.\n" + ) - language, encoding = locale.getdefaultlocale() -+ language, encoding = locale.getlocale() ++ try: ++ # Python >= 3.11 ++ language, encoding = locale.getlocale() ++ except AttributeError: ++ language, encoding = locale.getdefaultlocale() if not language: - sys.stderr.write("Default locale settings are missing. GRASS running with C locale.\n") - install_notranslation() -diff a/lib/python/gunittest/multirunner.py b/lib/python/gunittest/multirunner.py ---- a/lib/python/gunittest/multirunner.py -+++ b/lib/python/gunittest/multirunner.py -@@ -28,7 +28,7 @@ + sys.stderr.write( + "Default locale settings are missing. GRASS running with C locale.\n" +diff --git a/python/grass/gunittest/multirunner.py b/python/grass/gunittest/multirunner.py +index 5dbfc6b458..6741ee877b 100644 +--- a/python/grass/gunittest/multirunner.py ++++ b/python/grass/gunittest/multirunner.py +@@ -27,7 +27,11 @@ def _get_encoding(): - encoding = locale.getdefaultlocale()[1] -+ encoding = locale.getencoding() ++ try: ++ # Python >= 3.11 ++ encoding = locale.getencoding() ++ except AttributeError: ++ encoding = locale.getdefaultlocale()[1] if not encoding: - encoding = 'UTF-8' + encoding = "UTF-8" return encoding -diff a/lib/python/script/utils.py b/lib/python/script/utils.py ---- a/lib/python/script/utils.py -+++ b/lib/python/script/utils.py -@@ -160,7 +160,7 @@ +diff --git a/python/grass/script/utils.py b/python/grass/script/utils.py +index d2f2c63174..ce5aec20a8 100644 +--- a/python/grass/script/utils.py ++++ b/python/grass/script/utils.py +@@ -163,7 +163,11 @@ def __setattr__(self, key, value): def _get_encoding(): - encoding = locale.getdefaultlocale()[1] -+ encoding = locale.getencoding() ++ try: ++ # Python >= 3.11 ++ encoding = locale.getencoding() ++ except AttributeError: ++ encoding = locale.getdefaultlocale()[1] if not encoding: - encoding = 'UTF-8' + encoding = "UTF-8" return encoding -diff a/tools/mkhtml.py b/tools/mkhtml.py ---- a/tools/mkhtml.py -+++ b/tools/mkhtml.py -@@ -91,7 +91,7 @@ +diff --git a/utils/mkhtml.py b/utils/mkhtml.py +index 208e6f7d15..c24c879417 100644 +--- a/utils/mkhtml.py ++++ b/utils/mkhtml.py +@@ -81,7 +81,11 @@ def _get_encoding(): - encoding = locale.getdefaultlocale()[1] -+ encoding = locale.getencoding() ++ try: ++ # Python >= 3.11 ++ encoding = locale.getencoding() ++ except AttributeError: ++ encoding = locale.getdefaultlocale()[1] if not encoding: - encoding = 'UTF-8' + encoding = "UTF-8" return encoding diff --git a/srcpkgs/grass/template b/srcpkgs/grass/template index b704880655..bb9239af0a 100644 --- a/srcpkgs/grass/template +++ b/srcpkgs/grass/template @@ -1,15 +1,15 @@ # Template file for 'grass' pkgname=grass -version=7.8.7 +version=8.2.0 revision=1 _binver=${version//./} _binver=${_binver:0:2} build_style=gnu-configure -configure_args="--prefix=/usr/share --bindir=/usr/bin +configure_args="--prefix=/usr/lib --bindir=/usr/bin --with-freetype-includes=${XBPS_CROSS_BASE}/usr/include/freetype2" hostmakedepends="flex libgdal-tools pkg-config python3-numpy python3-six tar" makedepends="proj-devel tiff-devel libgdal-devel sqlite-devel - fftw-devel cairo-devel glu-devel wxPython-devel" + fftw-devel cairo-devel glu-devel" depends="python3-numpy python3-dateutil python3-Pillow python3-matplotlib python3-six python3-ply wxPython4" short_desc="Geographic Resources Analysis Support System - GIS" @@ -17,15 +17,6 @@ maintainer="Alex Jarosch " license="GPL-2.0-or-later" homepage="https://grass.osgeo.org/" distfiles="https://grass.osgeo.org/grass${_binver}/source/grass-${version}.tar.gz" -checksum=4fff7be556d820ed81704bb27fe3ed913c173076bb3ed036bcc3a49bd4027f69 +checksum=621c3304a563be19c0220ae28f931a5e9ba74a53218c5556cd3f7fbfcca33a80 python_version=3 nocross="tries to execute target binaries" - -post_install() { - # move grass libraries from /usr/share to /usr/lib - vmkdir usr/lib - mv ${DESTDIR}/usr/share/grass${_binver} ${DESTDIR}/usr/lib - # fixes a todo in GISBASE - vsed -i ${DESTDIR}/usr/bin/grass${_binver} \ - -e "87s;\(GISBASE =\).*;\1 \"/usr/lib/grass${_binver}\";" -} -- 2.39.0