Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

g.extension: catch missing modules.xml error #2058

Merged
merged 3 commits into from
Jan 1, 2022
Merged

g.extension: catch missing modules.xml error #2058

merged 3 commits into from
Jan 1, 2022

Conversation

neteler
Copy link
Member

@neteler neteler commented Jan 1, 2022

Print error message when
https://grass.osgeo.org/addons/grass8/modules.xml
is missing on server (generated here: https://github.com/OSGeo/grass-addons/tree/grass8/utils/cronjobs_osgeo_lxd).

So far this error appears:

GRASS nc_spm_08_grass7/user1:grass_main > g.extension -l
/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension:167: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  from distutils.dir_util import copy_tree
List of available extensions (modules):
https://grass.osgeo.org/addons/grass8/modules.xml
Fetching list of extensions from GRASS-Addons SVN repository (be
patient)...
https://grass.osgeo.org/addons/grass8/
Traceback (most recent call last):
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 682, in list_available_modules
    tree = etree_fromurl(file_url)
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 384, in etree_fromurl
    file_ = urlopen(url)
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 236, in urlopen
    return urlrequest.urlopen(request, *args, **kwargs)
  File "/usr/lib64/python3.10/urllib/request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib64/python3.10/urllib/request.py", line 525, in open
    response = meth(req, response)
  File "/usr/lib64/python3.10/urllib/request.py", line 634, in http_response
    response = self.parent.error(
  File "/usr/lib64/python3.10/urllib/request.py", line 563, in error
    return self._call_chain(*args)
  File "/usr/lib64/python3.10/urllib/request.py", line 496, in _call_chain
    result = func(*args)
  File "/usr/lib64/python3.10/urllib/request.py", line 643, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 2571, in <module>
    sys.exit(main())
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 2518, in main
    list_available_extensions(xmlurl)
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 557, in list_available_extensions
    list_available_modules(url)
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 694, in list_available_modules
    list_available_extensions_svn(url)
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 762, in list_available_extensions_svn
    sline = pattern.search(line)
TypeError: cannot use a string pattern on a bytes-like object

With this PR:

GRASS nc_spm_08_grass7/user1:grass_main > g.extension -l
/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension:167: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  from distutils.dir_util import copy_tree
List of available extensions (modules):
ERROR: Download file from
       <https://grass.osgeo.org/addons/grass8/modules.xml>, failed. File
       not on server or check internet connection.

Print error message when

is missing on server.

So far this error appeared:

```
GRASS nc_spm_08_grass7/user1:grass_main > g.extension -l
/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension:167: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  from distutils.dir_util import copy_tree
List of available extensions (modules):
https://grass.osgeo.org/addons/grass8/modules.xml
Fetching list of extensions from GRASS-Addons SVN repository (be
patient)...
https://grass.osgeo.org/addons/grass8/
Traceback (most recent call last):
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 682, in list_available_modules
    tree = etree_fromurl(file_url)
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 384, in etree_fromurl
    file_ = urlopen(url)
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 236, in urlopen
    return urlrequest.urlopen(request, *args, **kwargs)
  File "/usr/lib64/python3.10/urllib/request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib64/python3.10/urllib/request.py", line 525, in open
    response = meth(req, response)
  File "/usr/lib64/python3.10/urllib/request.py", line 634, in http_response
    response = self.parent.error(
  File "/usr/lib64/python3.10/urllib/request.py", line 563, in error
    return self._call_chain(*args)
  File "/usr/lib64/python3.10/urllib/request.py", line 496, in _call_chain
    result = func(*args)
  File "/usr/lib64/python3.10/urllib/request.py", line 643, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 2571, in <module>
    sys.exit(main())
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 2518, in main
    list_available_extensions(xmlurl)
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 557, in list_available_extensions
    list_available_modules(url)
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 694, in list_available_modules
    list_available_extensions_svn(url)
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 762, in list_available_extensions_svn
    sline = pattern.search(line)
TypeError: cannot use a string pattern on a bytes-like object
```

With this PR:

```
GRASS nc_spm_08_grass7/user1:grass_main > g.extension -l
/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension:167: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  from distutils.dir_util import copy_tree
List of available extensions (modules):
ERROR: Download file from
       <https://grass.osgeo.org/addons/grass8/modules.xml>, failed. File
       not on server or check internet connection.
```
@neteler neteler added bug Something isn't working backport_needed Python Related code is in Python labels Jan 1, 2022
@neteler neteler added this to the 8.0.0 milestone Jan 1, 2022
@neteler neteler requested a review from tmszi January 1, 2022 11:28
scripts/g.extension/g.extension.py Outdated Show resolved Hide resolved
@neteler neteler requested a review from tmszi January 1, 2022 14:36
@neteler neteler merged commit c30d632 into OSGeo:main Jan 1, 2022
@neteler neteler deleted the g_extension_catch_missing_xml branch January 1, 2022 15:53
neteler added a commit that referenced this pull request Jan 1, 2022
* g.extension: catch error missing modules.xml

Print error message when
 https://grass.osgeo.org/addons/grass8/modules.xml
is missing on server.

So far this error appeared:

```
GRASS nc_spm_08_grass7/user1:grass_main > g.extension -l
...
Fetching list of extensions from GRASS-Addons SVN repository (be
patient)...
https://grass.osgeo.org/addons/grass8/
Traceback (most recent call last):
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 682, in list_available_modules
    tree = etree_fromurl(file_url)
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 384, in etree_fromurl
    file_ = urlopen(url)
...
  File "/usr/lib64/python3.10/urllib/request.py", line 643, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
...
```

With this PR:

```
GRASS nc_spm_08_grass7/user1:grass_main > g.extension -l
/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension:167: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  from distutils.dir_util import copy_tree
List of available extensions (modules):
ERROR: Download file from
       <https://grass.osgeo.org/addons/grass8/modules.xml>, failed. File
       not on server or check internet connection.
```
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Oct 26, 2022
* g.extension: catch error missing modules.xml

Print error message when
 https://grass.osgeo.org/addons/grass8/modules.xml
is missing on server.

So far this error appeared:

```
GRASS nc_spm_08_grass7/user1:grass_main > g.extension -l
...
Fetching list of extensions from GRASS-Addons SVN repository (be
patient)...
https://grass.osgeo.org/addons/grass8/
Traceback (most recent call last):
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 682, in list_available_modules
    tree = etree_fromurl(file_url)
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 384, in etree_fromurl
    file_ = urlopen(url)
...
  File "/usr/lib64/python3.10/urllib/request.py", line 643, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
...
```

With this PR:

```
GRASS nc_spm_08_grass7/user1:grass_main > g.extension -l
/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension:167: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  from distutils.dir_util import copy_tree
List of available extensions (modules):
ERROR: Download file from
       <https://grass.osgeo.org/addons/grass8/modules.xml>, failed. File
       not on server or check internet connection.
```
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Feb 17, 2023
* g.extension: catch error missing modules.xml

Print error message when
 https://grass.osgeo.org/addons/grass8/modules.xml
is missing on server.

So far this error appeared:

```
GRASS nc_spm_08_grass7/user1:grass_main > g.extension -l
...
Fetching list of extensions from GRASS-Addons SVN repository (be
patient)...
https://grass.osgeo.org/addons/grass8/
Traceback (most recent call last):
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 682, in list_available_modules
    tree = etree_fromurl(file_url)
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 384, in etree_fromurl
    file_ = urlopen(url)
...
  File "/usr/lib64/python3.10/urllib/request.py", line 643, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
...
```

With this PR:

```
GRASS nc_spm_08_grass7/user1:grass_main > g.extension -l
/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension:167: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  from distutils.dir_util import copy_tree
List of available extensions (modules):
ERROR: Download file from
       <https://grass.osgeo.org/addons/grass8/modules.xml>, failed. File
       not on server or check internet connection.
```
neteler added a commit to nilason/grass that referenced this pull request Nov 7, 2023
* g.extension: catch error missing modules.xml

Print error message when
 https://grass.osgeo.org/addons/grass8/modules.xml
is missing on server.

So far this error appeared:

```
GRASS nc_spm_08_grass7/user1:grass_main > g.extension -l
...
Fetching list of extensions from GRASS-Addons SVN repository (be
patient)...
https://grass.osgeo.org/addons/grass8/
Traceback (most recent call last):
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 682, in list_available_modules
    tree = etree_fromurl(file_url)
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 384, in etree_fromurl
    file_ = urlopen(url)
...
  File "/usr/lib64/python3.10/urllib/request.py", line 643, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
...
```

With this PR:

```
GRASS nc_spm_08_grass7/user1:grass_main > g.extension -l
/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension:167: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  from distutils.dir_util import copy_tree
List of available extensions (modules):
ERROR: Download file from
       <https://grass.osgeo.org/addons/grass8/modules.xml>, failed. File
       not on server or check internet connection.
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Python Related code is in Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants