[Git][debian-gis-team/geolinks][upstream] New upstream version 0.2.1

Bas Couwenberg (@sebastic) gitlab at salsa.debian.org
Sun Feb 26 17:31:00 GMT 2023



Bas Couwenberg pushed to branch upstream at Debian GIS Project / geolinks


Commits:
314978ae by Bas Couwenberg at 2023-02-26T17:40:51+01:00
New upstream version 0.2.1
- - - - -


22 changed files:

- + .github/workflows/main.yml
- + .gitignore
- + CODE_OF_CONDUCT.md
- + CONTRIBUTING.md
- + LICENSE.md
- + MANIFEST.in
- − PKG-INFO
- README.md
- + SECURITY.md
- + debian/changelog
- + debian/compat
- + debian/control
- + debian/copyright
- + debian/rules
- + debian/source/format
- geolinks/__init__.py
- + pyproject.toml
- + requirements-dev.txt
- + requirements.txt
- setup.py
- + tests/run_tests.py
- + tests/test_data.json


Changes:

=====================================
.github/workflows/main.yml
=====================================
@@ -0,0 +1,34 @@
+name: build ⚙️
+
+on: [ push, pull_request ]
+
+jobs:
+  main:
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        python-version: [3.7, 3.8]
+    steps:
+    - uses: actions/checkout at v2
+    - uses: actions/setup-python at v2
+      name: Setup Python ${{ matrix.python-version }}
+      with:
+        python-version: ${{ matrix.python-version }}
+    - name: Install system dependencies 📦
+      run: sudo apt-get install -y dh-python devscripts fakeroot debhelper python3-all python3-setuptools
+    - name: Install requirements 📦
+      run: |
+        python3 -m pip install --upgrade pip
+        pip3 install -r requirements.txt
+        pip3 install -r requirements-dev.txt
+    - name: Install package 📦
+      run: python3 setup.py install
+    - name: run tests ⚙️
+      run: python3 setup.py test
+    - name: run flake8 ⚙️
+      run: flake8
+    - name: build Python package 🏗️
+      run: python3 setup.py sdist bdist_wheel --universal
+    - name: build Debian package 🏗️
+      run: sudo debuild -b -uc -us
+


=====================================
.gitignore
=====================================
@@ -0,0 +1,56 @@
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+env/
+bin/
+build/
+develop-eggs/
+dist/
+eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+*.egg-info/
+.installed.cfg
+*.egg
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.cache
+nosetests.xml
+coverage.xml
+
+# Translations
+*.mo
+
+# Mr Developer
+.mr.developer.cfg
+.project
+.pydevproject
+
+# Rope
+.ropeproject
+
+# Django stuff:
+*.log
+*.pot
+
+# Sphinx documentation
+docs/_build/
+
+# build artefacts
+MANIFEST


=====================================
CODE_OF_CONDUCT.md
=====================================
@@ -0,0 +1,76 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, sex characteristics, gender identity and expression,
+level of experience, education, socio-economic status, nationality, personal
+appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+ advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. Examples of
+representing a project or community include using an official project e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at tomkralidis at gmail.com. All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
+
+[homepage]: https://www.contributor-covenant.org
+
+For answers to common questions about this code of conduct, see
+https://www.contributor-covenant.org/faq


=====================================
CONTRIBUTING.md
=====================================
@@ -0,0 +1,101 @@
+# Contributing to geolinks
+
+We welcome contributions to geolinks, in the form of issues, bug fixes, or
+suggestions for enhancements. This document sets out our guidelines and best
+practices for such contributions.
+
+It's based on the [Contributing to Open Source Projects
+Guide](https://contribution-guide-org.readthedocs.io/).
+
+geolinks has the following modes of contribution:
+
+- GitHub Commit Access
+- GitHub Pull Requests
+
+## Code of Conduct
+
+Contributors to this project are expected to act respectfully toward others in accordance with the [OSGeo Code of Conduct](https://www.osgeo.org/code_of_conduct).
+
+## Submitting Bugs
+
+### Due Diligence
+
+Before submitting a bug, please do the following:
+
+* Perform __basic troubleshooting__ steps:
+
+    * __Make sure you're on the latest version.__ If you're not on the most
+      recent version, your problem may have been solved already! Upgrading is
+      always the best first step.
+    * [__Search the issue
+      tracker__](https://github.com/geopython/geolinks/issues)
+      to make sure it's not a known issue.
+
+### What to put in your bug report
+
+Make sure your report gets the attention it deserves: bug reports with missing
+information may be ignored or punted back to you, delaying a fix.  The below
+constitutes a bare minimum; more info is almost always better:
+
+* __What version of Python are you using?__ For example, are you using Python
+  2.7, Python 3.7, PyPy 2.0?
+* __What operating system are you using?__ Windows (7, 8, 10, 32-bit, 64-bit),
+  Mac OS X,  (10.7.4, 10.9.0), GNU/Linux (which distribution, which version?)
+  Again, more detail is better.
+* __Which version or versions of the software are you using?__ Ideally, you've
+  followed the advice above and are on the latest version, but please confirm
+  this.
+* __How can the we recreate your problem?__ Imagine that we have never used
+  geolinks before and have downloaded it for the first time. Exactly what steps
+  do we need to take to reproduce your problem?
+
+## Contributions and Licensing
+
+### Contributor License Agreement
+
+Your contribution will be under our [license](https://github.com/geopython/geolinks/blob/master/LICENSE.md) as per [GitHub's terms of service](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license).
+
+### GitHub Commit Access
+
+* Proposals to provide developers with GitHub commit access shall be emailed to the geolinks [mailing list](https://lists.osgeo.org/mailman/listinfo/geolinks). Proposals shall be approved by the geolinks development team.  Committers shall be added by the project admin.
+* Removal of commit access shall be handled in the same manner.
+
+### GitHub Pull Requests
+
+* Pull requests may include copyright in the source code header by the contributor if the contribution is significant or the contributor wants to claim copyright on their contribution.
+* All contributors shall be listed at https://github.com/geopython/geolinks/graphs/contributors
+* Unclaimed copyright, by default, is assigned to the main copyright holders as specified in https://github.com/geopython/geolinks/blob/master/LICENSE.md
+
+### Version Control Branching
+
+* Always __make a new branch__ for your work, no matter how small. This makes
+  it easy for others to take just that one set of changes from your repository,
+  in case you have multiple unrelated changes floating around.
+
+    * __Don't submit unrelated changes in the same branch/pull request!__ If it
+      is not possible to review your changes quickly and easily, we may reject
+      your request.
+
+* __Base your new branch off of the appropriate branch__ on the main repository:
+
+    * In general the released version of geolinks is based on the ``master``
+      (default) branch whereas development work is done under other non-default
+      branches. Unless you are sure that your issue affects a non-default
+      branch, __base your branch off the ``master`` one__.
+
+* Note that depending on how long it takes for the dev team to merge your
+  patch, the copy of ``master`` you worked off of may get out of date! 
+    * If you find yourself 'bumping' a pull request that's been sidelined for a
+      while, __make sure you rebase or merge to latest ``master``__ to ensure a
+        speedier resolution.
+
+### Code Formatting
+
+* __Please follow the coding conventions and style used in the geolinks repository.__ 
+* geolinks endeavours to follow the
+  [PEP-8](http://www.python.org/dev/peps/pep-0008/) guidelines.
+
+## Suggesting Enhancements
+
+We welcome suggestions for enhancements, but reserve the right to reject them
+if they do not follow future plans for geolinks.


=====================================
LICENSE.md
=====================================
@@ -0,0 +1,23 @@
+# The MIT License (MIT)
+
+Copyright © 2014-2022 Tom Kralidis
+
+* * *
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.


=====================================
MANIFEST.in
=====================================
@@ -0,0 +1 @@
+include README.md


=====================================
PKG-INFO deleted
=====================================
@@ -1,56 +0,0 @@
-Metadata-Version: 1.1
-Name: geolinks
-Version: 0.2.0
-Summary: Utilities to deal with geospatial links
-Home-page: https://github.com/geopython/geolinks
-Author: Tom Kralidis
-Author-email: tomkralidis at gmail.com
-License: MIT
-Description: [![Build Status](https://travis-ci.org/geopython/geolinks.png)](https://travis-ci.org/geopython/geolinks)
-        
-        geolinks
-        ========
-        
-        Utilities to deal with geospatial links.  Working implementation
-        of the Cat-Interop work at https://github.com/OSGeo/Cat-Interop
-        
-        Install
-        -------
-        
-        ```bash
-        pip install geolinks
-        ```
-        
-        Use
-        ---
-        
-        ```python
-        >>> from geolinks import sniff_link
-        >>> sniff_link('http://host/wms?service=WMS')
-        'OGC:WMS'
-        >>> sniff_link('http://host/wms?service=WPS')
-        'OGC:WPS'
-        >>> sniff_link('http://host/wms?service=CSW')
-        'OGC:CSW'
-        >>> sniff_link('http://host/data/roads.kmz')
-        'OGC:KML'
-        >>> sniff_link('http://host/data/roads.kml')
-        'OGC:KML'
-        ```
-        
-Keywords: links geo protocol url href
-Platform: all
-Classifier: Development Status :: 4 - Beta
-Classifier: Environment :: Console
-Classifier: Intended Audience :: Developers
-Classifier: Intended Audience :: Science/Research
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.6
-Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.3
-Classifier: Programming Language :: Python :: 3.4
-Classifier: Topic :: Scientific/Engineering :: GIS


=====================================
README.md
=====================================
@@ -1,20 +1,49 @@
-[![Build Status](https://travis-ci.org/geopython/geolinks.png)](https://travis-ci.org/geopython/geolinks)
+[![Build Status](https://github.com/geopython/geolinks/workflows/build%20%E2%9A%99%EF%B8%8F/badge.svg)](https://github.com/geopython/geolinks/actions)
 
-geolinks
-========
+# geolinks
 
 Utilities to deal with geospatial links.  Working implementation
 of the Cat-Interop work at https://github.com/OSGeo/Cat-Interop
 
-Install
--------
+## Installation
 
+geolinks is best installed and used within a Python virtualenv.
+
+### Requirements
+
+* Python 3 and above
+* Python [virtualenv](https://virtualenv.pypa.io/) package
+
+### Dependencies
+
+Dependencies are listed in [requirements.txt](requirements.txt). Dependencies
+are automatically installed during geolinks's installation.
+
+### Installing the Package
+
+from source:
+```bash
+python3 -m venv my-env
+cd my-env
+. bin/activate
+git clone https://github.com/geopython/geolinks.git
+cd geolinks
+python setup.py build
+python setup.py install
+```
+
+via pip:
 ```bash
 pip install geolinks
 ```
 
-Use
----
+## Running
+
+```bash
+geolinks link sniff 'http://host/wms?service=WMS'
+```
+
+## Using the API from Python
 
 ```python
 >>> from geolinks import sniff_link
@@ -29,3 +58,52 @@ Use
 >>> sniff_link('http://host/data/roads.kml')
 'OGC:KML'
 ```
+
+### Running Tests
+
+```bash
+# via setuptools
+python setup.py test
+# manually
+cd tests
+python run_tests.py
+```
+
+## Development
+
+### Setting up a Development Environment
+
+Same as installing a package.  Use a virtualenv.  Also install developer
+requirements:
+
+```bash
+pip install -r requirements-dev.txt
+```
+
+## Releasing
+
+```bash
+vi geolinks/__init__.py
+git commit -m 'update release version' geolinks/__init__.py
+vi debian/changelog  # add changelog entry and summary of updates
+# push changes
+git push origin master
+git tag -a x.y.z -m 'tagging release x.y.z'
+# push tag
+git push --tags
+rm -fr build dist *.egg-info
+python setup.py sdist bdist_wheel --universal
+twine upload dist/*
+```
+
+### Code Conventions
+
+* [PEP8](https://www.python.org/dev/peps/pep-0008)
+
+### Bugs and Issues
+
+All bugs, enhancements and issues are managed on [GitHub](https://github.com/geopython/geolinks/issues).
+
+## Contact
+
+* [Tom Kralidis](https://github.com/tomkralidis)


=====================================
SECURITY.md
=====================================
@@ -0,0 +1,15 @@
+# geolinks Security Policy
+
+## Reporting
+
+Security/vulnerability reports **should not** be submitted through GitHub issues or public discussions, but instead please send your report 
+to **geopython-security nospam @ lists.osgeo.org** - (remove the blanks and 'nospam').  
+
+## Supported Versions
+
+geolinks developers will release patches for security vulnerabilities for the following versions:
+
+| Version | Supported          |
+| ------- | ------------------ |
+| latest stable version | :white_check_mark: |
+| previous versions | :x:                |


=====================================
debian/changelog
=====================================
@@ -0,0 +1,5 @@
+geolinks (0.2.1) focal; urgency=medium
+
+  * housekeeping release update
+
+ -- Tom Kralidis <tomkralidis at gmail.com>  Sun, 26 Feb 2023 16:30:16 +0000


=====================================
debian/compat
=====================================
@@ -0,0 +1 @@
+12


=====================================
debian/control
=====================================
@@ -0,0 +1,21 @@
+Source: geolinks
+Section: python
+Priority: optional
+Maintainer: Tom Kralidis <tomkralidis at gmail.com>
+Uploaders: Angelos Tzotsos <gcpp.kalxas at gmail.com>
+           Johan Van de Wauw <johan at vandewauw.be>
+Build-Depends: debhelper (>= 12),
+               dh-python,
+               python3-all,
+               python3-setuptools
+Standards-Version: 4.6.1
+Vcs-Git: https://github.com/geopython/geolinks.git
+Homepage: https://github.com/geopython/geolinks
+
+Package: python3-geolinks
+Architecture: all
+Depends: ${python3:Depends},
+         python3-click,
+         ${misc:Depends}
+Description: Utilities to deal with geospatial links. Working implementation
+ of the Cat-Interop work at https://github.com/OSGeo/Cat-Interop


=====================================
debian/copyright
=====================================
@@ -0,0 +1,26 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Source: https://github.com/geopython/geolinks
+
+Files: *
+Copyright: Copyright 2022 Tom Kralidis
+License: MIT
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+ .
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.


=====================================
debian/rules
=====================================
@@ -0,0 +1,13 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+export PYBUILD_NAME=geolinks
+
+%:
+	dh $@ --with python3 --buildsystem pybuild
+
+override_dh_auto_test:
+	@echo "nocheck set, not running tests"


=====================================
debian/source/format
=====================================
@@ -0,0 +1 @@
+3.0 (quilt)


=====================================
geolinks/__init__.py
=====================================
@@ -2,7 +2,7 @@
 #
 # Authors: Tom Kralidis <tomkralidis at gmail.com>
 #
-# Copyright (c) 2014 Tom Kralidis
+# Copyright (c) 2023 Tom Kralidis
 #
 # Permission is hereby granted, free of charge, to any person
 # obtaining a copy of this software and associated documentation
@@ -28,14 +28,40 @@
 # =================================================================
 
 import logging
+import sys
+from typing import Union
+
+import click
 
 LOGGER = logging.getLogger(__name__)
 
-__version__ = '0.2.0'
+__version__ = '0.2.1'
+
+
+def CLICK_OPTION_VERBOSITY(f):
+    logging_options = ['ERROR', 'WARNING', 'INFO', 'DEBUG']
+
+    def callback(ctx, param, value):
+        if value is not None:
+            logging.basicConfig(stream=sys.stdout,
+                                level=getattr(logging, value))
+        return True
+
+    return click.option('--verbosity', '-v',
+                        type=click.Choice(logging_options),
+                        help='Verbosity',
+                        callback=callback)(f)
 
 
-def inurl(needles, haystack, position='any'):
-    """convenience function to make string.find return bool"""
+def inurl(needles, haystack, position='any') -> bool:
+    """
+    convenience function to find a given value in a URL
+
+    :param needles: `list` of patterns to test
+    :param haystack: value to search / detect for patterns
+
+    returns: `bool` of assessment
+    """
 
     count = 0
 
@@ -60,8 +86,14 @@ def inurl(needles, haystack, position='any'):
     return False
 
 
-def sniff_link(url):
-    """performs basic heuristics to detect what the URL is"""
+def sniff_link(url) -> Union[str, None]:
+    """
+    performs basic heuristics to detect what the URL is
+
+    :param url: `str` of URL
+
+    :returns: possible link type or `None`
+    """
 
     protocol = None
     link = url.strip()
@@ -108,3 +140,32 @@ def sniff_link(url):
         LOGGER.info('No link type detected')
 
     return protocol
+
+
+ at click.group()
+ at click.version_option(version=__version__)
+def cli():
+    pass
+
+
+ at click.group()
+def link():
+    """Link utilities"""
+    pass
+
+
+ at click.command()
+ at click.argument('link')
+ at CLICK_OPTION_VERBOSITY
+def sniff(link, verbosity):
+    """Sniff link"""
+
+    click.echo(f'Sniffing link: {link}')
+
+    link_type = sniff_link(link)
+
+    click.echo(f'Link type: {link_type}')
+
+
+link.add_command(sniff)
+cli.add_command(link)


=====================================
pyproject.toml
=====================================
@@ -0,0 +1,3 @@
+[build-system]
+requires = ["setuptools"]
+build-backend = "setuptools.build_meta"


=====================================
requirements-dev.txt
=====================================
@@ -0,0 +1,3 @@
+flake8
+twine
+wheel


=====================================
requirements.txt
=====================================
@@ -0,0 +1 @@
+click


=====================================
setup.py
=====================================
@@ -2,7 +2,7 @@
 #
 # Authors: Tom Kralidis <tomkralidis at gmail.com>
 #
-# Copyright (c) 2014 Tom Kralidis
+# Copyright (c) 2022 Tom Kralidis
 #
 # Permission is hereby granted, free of charge, to any person
 # obtaining a copy of this software and associated documentation
@@ -27,14 +27,56 @@
 #
 # =================================================================
 
-from distutils.core import setup
+import io
+import os
+import re
+import sys
+
 from geolinks import __version__ as version
+from setuptools import Command, find_packages, setup
+
+
+class PyTest(Command):
+    user_options = []
+
+    def initialize_options(self):
+        pass
+
+    def finalize_options(self):
+        pass
+
+    def run(self):
+        import subprocess
+        errno = subprocess.call([sys.executable, 'tests/run_tests.py'])
+        raise SystemExit(errno)
+
+
+def read(filename, encoding='utf-8'):
+    """read file contents"""
+    full_path = os.path.join(os.path.dirname(__file__), filename)
+    with io.open(full_path, encoding=encoding) as fh:
+        return fh.read().strip()
+
+
+def get_package_version():
+    """get version from top-level package init"""
+    version_file = read('geolinks/__init__.py')
+    version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
+                              version_file, re.M)
+    if version_match:
+        return version_match.group(1)
+    raise RuntimeError("Unable to find version string.")
+
+
+LONG_DESCRIPTION = read('README.md')
+
 
 setup(
     name='geolinks',
     version=version,
     description='Utilities to deal with geospatial links',
-    long_description=open('README.md').read(),
+    long_description=LONG_DESCRIPTION,
+    long_description_content_type='text/markdown',
     license='MIT',
     platforms='all',
     keywords='links geo protocol url href',
@@ -43,7 +85,12 @@ setup(
     maintainer='Tom Kralidis',
     maintainer_email='tomkralidis at gmail.com',
     url='https://github.com/geopython/geolinks',
-    packages=['geolinks'],
+    packages=find_packages(),
+    entry_points={
+        'console_scripts': [
+            'geolinks=geolinks:cli'
+        ]
+    },
     classifiers=[
         'Development Status :: 4 - Beta',
         'Environment :: Console',
@@ -52,12 +99,9 @@ setup(
         'License :: OSI Approved :: MIT License',
         'Operating System :: OS Independent',
         'Programming Language :: Python',
-        'Programming Language :: Python :: 2',
-        'Programming Language :: Python :: 2.6',
-        'Programming Language :: Python :: 2.7',
-        'Programming Language :: Python :: 3',
-        'Programming Language :: Python :: 3.3',
-        'Programming Language :: Python :: 3.4',
+        'Programming Language :: Python :: 3.5',
         'Topic :: Scientific/Engineering :: GIS',
-    ]
+    ],
+    cmdclass={'test': PyTest},
+    test_suite='tests.run_tests'
 )


=====================================
tests/run_tests.py
=====================================
@@ -0,0 +1,67 @@
+# =================================================================
+#
+# Authors: Tom Kralidis <tomkralidis at gmail.com>
+#
+# Copyright (c) 2022 Tom Kralidis
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation
+# files (the "Software"), to deal in the Software without
+# restriction, including without limitation the rights to use,
+# copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following
+# conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+#
+# =================================================================
+
+import json
+import os.path
+import unittest
+
+from geolinks import sniff_link
+
+
+class GeolinksTest(unittest.TestCase):
+    """Test suite for package Foo"""
+    def setUp(self):
+        """setup test fixtures, etc."""
+
+        test_data = None
+
+        if os.path.exists('test_data.json'):
+            test_data = 'test_data.json'
+        elif os.path.exists('tests/test_data.json'):
+            test_data = 'tests/test_data.json'
+        else:
+            raise FileNotFoundError()
+
+        with open(test_data) as f:
+            self.test_data = json.load(f)
+
+    def tearDown(self):
+        """return to pristine state"""
+        pass
+
+    def test_link_types(self):
+        """simple link type tests"""
+
+        for test in self.test_data['test_data']:
+            self.assertEqual(sniff_link(test['link']), test['expected'],
+                             f"Expected {test['link']} and {test['expected']} to be equal")  # noqa
+
+
+if __name__ == '__main__':
+    unittest.main()


=====================================
tests/test_data.json
=====================================
@@ -0,0 +1,22 @@
+{
+    "test_data": [
+        {"link": "http://host/wms?service=WMS", "expected": "OGC:WMS"},
+        {"link": "http://host/ows?service=WFS", "expected": "OGC:WFS"},
+        {"link": "http://host/ows?service=WCS", "expected": "OGC:WCS"},
+        {"link": "http://host/ows?service=WPS", "expected": "OGC:WPS"},
+        {"link": "http://host/csw?service=CSW", "expected": "OGC:CSW"},
+        {"link": "http://host/data/roads.kmz", "expected": "OGC:KML"},
+        {"link": "http://host/data/roads.kml", "expected": "OGC:KML"},
+        {"link": "http://host/data/data.html", "expected": "WWW:LINK"},
+        {"link": "http://host/download/admin.mpk", "expected": "ESRI:MPK"},
+        {"link": "http://host/data.7z", "expected": "WWW:DOWNLOAD"},
+        {"link": "http://host/data.tgz", "expected": "WWW:DOWNLOAD"},
+        {"link": "http://host/data/data.zip", "expected": "WWW:DOWNLOAD"},
+        {"link": "http://host/data/data.gz", "expected": "WWW:DOWNLOAD"},
+        {"link": "http://host/data/file.gml", "expected": "OGC:GML"},
+        {"link": "http://host/data/file.gml.gz", "expected": "WWW:DOWNLOAD"},
+        {"link": "http://host/data.tar.gz", "expected": "WWW:DOWNLOAD"},
+        {"link": "http://host/sos?service=SOS&request=GetObservation", "expected": "OGC:SOS"},
+        {"link": "http://host/sos?service=SOS&request=GetObservation", "expected": "OGC:SOS"}
+    ]
+}



View it on GitLab: https://salsa.debian.org/debian-gis-team/geolinks/-/commit/314978ae550a004d78f480ed5d3a1251737d8bfa

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/geolinks/-/commit/314978ae550a004d78f480ed5d3a1251737d8bfa
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20230226/3e6c3c4f/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list