From 14ff7c935070d4574ae0e9a914e2e97b0a416ae0 Mon Sep 17 00:00:00 2001 From: Greg Albrecht Date: Wed, 19 Jun 2024 22:58:37 -0700 Subject: [PATCH] Rewrite, adding updated debian builder. --- .github/workflows/debian.yml | 38 ++-- .github/workflows/python-test_and_lint.yml | 2 +- .readthedocs.yml | 17 ++ CHANGELOG.md | 16 +- LICENSE | 194 ++++++++++++++++++++- Makefile | 65 +++++-- README.rst | 182 +------------------ aiscot/__init__.py | 52 +++--- aiscot/ais_functions.py | 8 +- aiscot/classes.py | 48 ++--- aiscot/commands.py | 13 +- aiscot/constants.py | 11 +- aiscot/functions.py | 45 +++-- aiscot/pyAISm.py | 3 +- debian/aiscot.conf | 86 +++++++++ debian/aiscot.postinst | 79 +++++++++ debian/aiscot.service | 39 +++++ debian/install_pkg_build_deps.sh | 10 ++ mkdocs.yml | 40 +++++ setup.cfg | 119 +++++++++++-- setup.py | 69 +------- 21 files changed, 761 insertions(+), 375 deletions(-) create mode 100644 .readthedocs.yml create mode 100644 debian/aiscot.conf create mode 100755 debian/aiscot.postinst create mode 100644 debian/aiscot.service create mode 100644 debian/install_pkg_build_deps.sh create mode 100644 mkdocs.yml diff --git a/.github/workflows/debian.yml b/.github/workflows/debian.yml index 035a5ba..ff249bf 100644 --- a/.github/workflows/debian.yml +++ b/.github/workflows/debian.yml @@ -1,4 +1,4 @@ -name: Build Debian package +name: Build Debian Package on: push: @@ -15,33 +15,19 @@ jobs: steps: - uses: actions/checkout@master - - name: Install packaging dependencies - run: | - sudo apt-get update -qq - sudo apt-get install -y \ - python3 python3-dev python3-pip python3-venv python3-all \ - dh-python debhelper devscripts dput software-properties-common \ - python3-distutils python3-setuptools python3-wheel python3-stdeb - - - name: Build Debian/Apt sdist_dsc - run: | - rm -Rf deb_dist/* - python3 setup.py --command-packages=stdeb.command sdist_dsc - - - name: Build Debian/Apt bdist_deb - run: | - export REPO_NAME=$(echo ${{ github.repository }} | awk -F"/" '{print $2}') - python3 setup.py --command-packages=stdeb.command bdist_deb - ls -al deb_dist/ - cp deb_dist/python3-${REPO_NAME}_*_all.deb deb_dist/python3-${REPO_NAME}_latest_all.deb - - - uses: actions/upload-artifact@master + - name: Install Debian Package Building Dependencies + run: bash debian/install_pkg_build_deps.sh + + - name: Create Debian Package + run: make clean package + + - name: Upload Artifacts to GitHub + uses: actions/upload-artifact@master with: name: artifact-deb - path: | - deb_dist/*.deb + path: deb_dist/*.deb - - name: Create Release + - name: Create GitHub Release id: create_release uses: actions/create-release@master env: @@ -52,7 +38,7 @@ jobs: draft: false prerelease: false - - name: Upload Release Asset + - name: Upload Release Asset to GitHub id: upload-release-asset uses: svenstaro/upload-release-action@v2 with: diff --git a/.github/workflows/python-test_and_lint.yml b/.github/workflows/python-test_and_lint.yml index 485e9c7..56ac9d4 100644 --- a/.github/workflows/python-test_and_lint.yml +++ b/.github/workflows/python-test_and_lint.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.6, 3.7, 3.8, 3.9, "3.10"] + python-version: [3.6, 3.7, 3.8, 3.9, "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v2 diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000..e941dac --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,17 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +version: 2 + +build: + os: ubuntu-22.04 + tools: + python: "3.11" + +mkdocs: + configuration: mkdocs.yml + +python: + install: + - requirements: docs/requirements.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index c4e0116..1af1e4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ -AISCOT 5.2.0 ------------- +## AISCOT 6.0.0 + +- New for 2024. +- Updates for AryaSea (fka SeaTAK). + +## AISCOT 5.3.0 + +Added COT_ICON support. + +## AISCOT 5.2.0 + 1) Fixed GitHub workflows (revert to not-latest ubuntu, add py 3.10). 2) Reformatted & Cleaned-up README. 3) Updated copyright year. @@ -9,7 +18,6 @@ AISCOT 5.2.0 7) Refactored AIS specific functions into ais_functions. 8) Added tests, tests, tests! Now at almost 100% for functions. +## AISCOT 5.1.0 -AISCOT 5.1.0 ------------- Added XML Declaration to output CoT XML. \ No newline at end of file diff --git a/LICENSE b/LICENSE index 382902d..cd482d8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,8 +1,198 @@ -Copyright 2023 Greg Albrecht +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, +and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by +the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all +other entities that control, are controlled by, or are under common +control with that entity. For the purposes of this definition, +"control" means (i) the power, direct or indirect, to cause the +direction or management of such entity, whether by contract or +otherwise, or (ii) ownership of fifty percent (50%) or more of the +outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity +exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, +including but not limited to software source code, documentation +source, and configuration files. + +"Object" form shall mean any form resulting from mechanical +transformation or translation of a Source form, including but +not limited to compiled object code, generated documentation, +and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or +Object form, made available under the License, as indicated by a +copyright notice that is included in or attached to the work +(an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object +form, that is based on (or derived from) the Work and for which the +editorial revisions, annotations, elaborations, or other modifications +represent, as a whole, an original work of authorship. For the purposes +of this License, Derivative Works shall not include works that remain +separable from, or merely link (or bind by name) to the interfaces of, +the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including +the original version of the Work and any modifications or additions +to that Work or Derivative Works thereof, that is intentionally +submitted to Licensor for inclusion in the Work by the copyright owner +or by an individual or Legal Entity authorized to submit on behalf of +the copyright owner. For the purposes of this definition, "submitted" +means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, +and issue tracking systems that are managed by, or on behalf of, the +Licensor for the purpose of discussing and improving the Work, but +excluding communication that is conspicuously marked or otherwise +designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity +on behalf of whom a Contribution has been received by Licensor and +subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the +Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +(except as stated in this section) patent license to make, have made, +use, offer to sell, sell, import, and otherwise transfer the Work, +where such license applies only to those patent claims licensable +by such Contributor that are necessarily infringed by their +Contribution(s) alone or by combination of their Contribution(s) +with the Work to which such Contribution(s) was submitted. If You +institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work +or a Contribution incorporated within the Work constitutes direct +or contributory patent infringement, then any patent licenses +granted to You under this License for that Work shall terminate +as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the +Work or Derivative Works thereof in any medium, with or without +modifications, and in Source or Object form, provided that You +meet the following conditions: + +(a) You must give any other recipients of the Work or +Derivative Works a copy of this License; and + +(b) You must cause any modified files to carry prominent notices +stating that You changed the files; and + +(c) You must retain, in the Source form of any Derivative Works +that You distribute, all copyright, patent, trademark, and +attribution notices from the Source form of the Work, +excluding those notices that do not pertain to any part of +the Derivative Works; and + +(d) If the Work includes a "NOTICE" text file as part of its +distribution, then any Derivative Works that You distribute must +include a readable copy of the attribution notices contained +within such NOTICE file, excluding those notices that do not +pertain to any part of the Derivative Works, in at least one +of the following places: within a NOTICE text file distributed +as part of the Derivative Works; within the Source form or +documentation, if provided along with the Derivative Works; or, +within a display generated by the Derivative Works, if and +wherever such third-party notices normally appear. The contents +of the NOTICE file are for informational purposes only and +do not modify the License. You may add Your own attribution +notices within Derivative Works that You distribute, alongside +or as an addendum to the NOTICE text from the Work, provided +that such additional attribution notices cannot be construed +as modifying the License. + +You may add Your own copyright statement to Your modifications and +may provide additional or different license terms and conditions +for use, reproduction, or distribution of Your modifications, or +for any such Derivative Works as a whole, provided Your use, +reproduction, and distribution of the Work otherwise complies with +the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, +any Contribution intentionally submitted for inclusion in the Work +by You to the Licensor shall be under the terms and conditions of +this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify +the terms of any separate license agreement you may have executed +with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade +names, trademarks, service marks, or product names of the Licensor, +except as required for reasonable and customary use in describing the +origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or +agreed to in writing, Licensor provides the Work (and each +Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied, including, without limitation, any warranties or conditions +of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A +PARTICULAR PURPOSE. You are solely responsible for determining the +appropriateness of using or redistributing the Work and assume any +risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, +whether in tort (including negligence), contract, or otherwise, +unless required by applicable law (such as deliberate and grossly +negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, +incidental, or consequential damages of any character arising as a +result of this License or out of the use or inability to use the +Work (including but not limited to damages for loss of goodwill, +work stoppage, computer failure or malfunction, or any and all +other commercial damages or losses), even if such Contributor +has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing +the Work or Derivative Works thereof, You may choose to offer, +and charge a fee for, acceptance of support, warranty, indemnity, +or other liability obligations and/or rights consistent with this +License. However, in accepting such obligations, You may act only +on Your own behalf and on Your sole responsibility, not on behalf +of any other Contributor, and only if You agree to indemnify, +defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason +of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + +To apply the Apache License to your work, attach the following +boilerplate notice, with the fields enclosed by brackets "[]" +replaced with your own identifying information. (Don't include +the brackets!) The text should be enclosed in the appropriate +comment syntax for the file format. We also recommend that a +file or class name and description of purpose be included on the +same "printed page" as the copyright notice for easier +identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. -You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Makefile b/Makefile index c531042..edc1ac9 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ +# Makefile from https://github.com/snstac/aiscot +# AISCOT Makefile # -# Copyright 2023 Greg Albrecht +# Copyright Sensors & Signals LLC https://www.snstac.com/ # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 +# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, @@ -14,10 +14,14 @@ # limitations under the License. # -this_app = aiscot -.DEFAULT_GOAL := all +REPO_NAME ?= $(shell echo $(wildcard */classes.py) | awk -F'/' '{print $$1}') +SHELL := /bin/bash +.DEFAULT_GOAL := editable +# postinst = $(wildcard debian/*.postinst.sh) +# service = $(wildcard debian/*.service) -all: editable +prepare: + mkdir -p build/ develop: python3 setup.py develop @@ -32,7 +36,7 @@ install: python3 setup.py install uninstall: - python3 -m pip uninstall -y $(this_app) + python3 -m pip uninstall -y $(REPO_NAME) reinstall: uninstall install @@ -43,16 +47,16 @@ clean: @rm -rf *.egg* build dist *.py[oc] */*.py[co] cover doctest_pypi.cfg \ nosetests.xml pylint.log output.xml flake8.log tests.log \ test-result.xml htmlcov fab.log .coverage __pycache__ \ - */__pycache__ + */__pycache__ deb_dist pep8: - flake8 --max-line-length=88 --extend-ignore=E203 --exit-zero $(this_app)/*.py + flake8 --max-line-length=88 --extend-ignore=E203 --exit-zero $(REPO_NAME)/*.py flake8: pep8 lint: pylint --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \ - --max-line-length=88 -r n $(this_app)/*.py || exit 0 + --max-line-length=88 -r n $(REPO_NAME)/*.py || exit 0 pylint: lint @@ -68,7 +72,44 @@ pytest: test: editable install_test_requirements pytest test_cov: - pytest --cov=$(this_app) --cov-report term-missing + pytest --cov=$(REPO_NAME) --cov-report term-missing black: black . + +mkdocs: + pip install -r docs/requirements.txt + mkdocs serve + +deb_dist: + python3 setup.py --command-packages=stdeb.command sdist_dsc + +deb_custom: +# echo "# START Makefile customization " >> $(wildcard deb_dist/*/debian)/rules +# echo "override_dh_installsystemd:" >> $(wildcard deb_dist/*/debian)/rules +# echo " dh_installsystemd --name=$(REPO_NAME)" >> $(wildcard deb_dist/*/debian)/rules +# echo "override_dh_installinit:" >> $(wildcard deb_dist/*/debian)/rules +# echo " dh_installinit --name=$(REPO_NAME)" >> $(wildcard deb_dist/*/debian)/rules +# echo "# END Makefile customization" >> $(wildcard deb_dist/*/debian)/rules + cp debian/$(REPO_NAME).conf $(wildcard deb_dist/*/debian)/python3-$(REPO_NAME).default + cp debian/$(REPO_NAME).postinst $(wildcard deb_dist/*/debian)/python3-$(REPO_NAME).postinst + cp debian/$(REPO_NAME).service $(wildcard deb_dist/*/debian)/python3-$(REPO_NAME).service + +# ifneq ("$(postinst)", "") +# cp $(postinst) $(wildcard deb_dist/*/debian)/python3-$(REPO_NAME).postinst +# endif +# ifneq ("$(service)", "") +# cp $(service) $(wildcard deb_dist/*/debian)/python3-$(REPO_NAME).service +# endif + +bdist_deb: deb_dist deb_custom + cd deb_dist/$(REPO_NAME)-*/ && dpkg-buildpackage -rfakeroot -uc -us + +faux_latest: + cp deb_dist/python3-$(REPO_NAME)_*-1_all.deb deb_dist/python3-$(REPO_NAME)_latest_all.deb + +package: bdist_deb faux_latest + +extract: + dpkg-deb -e $(wildcard deb_dist/*latest_all.deb) deb_dist/extract + dpkg-deb -x $(wildcard deb_dist/*latest_all.deb) deb_dist/extract diff --git a/README.rst b/README.rst index 5ebdbf7..ad58122 100644 --- a/README.rst +++ b/README.rst @@ -1,13 +1,14 @@ -AISCOT - AIS Cursor on Target Gateway -************************************* +AISCOT: Display Ships in TAK - AIS to TAK Gateway +************************************************* .. image:: https://raw.githubusercontent.com/ampledata/aiscot/main/docs/screenshot_1676076870_2962.png - :alt: Screenshot of AIS as COT PLI in ATAK. + :alt: Screenshot of ships in ATAK. :target: https://raw.githubusercontent.com/ampledata/aiscot/main/docs/screenshot_1676076870_2962.png Description =========== +AISCOT The Automatic Identification System to Cursor on Target gateway (AISCOT) transforms automatic identification system (AIS) to Cursor on Target (CoT) for use with TAK products such as ATAK, WinTAK & iTAK. Vessels sending AIS either @@ -21,183 +22,14 @@ AISCOT was original developed to support an open ocean boat race in the Northern Pacific Ocean, as described in this article: http://ampledata.org/boat_race_support.html -Concept of Operations -===================== - -AISCOT can operate in two different modes, as described in detail below: - -1. AIS Over-the-air (RF) -2. AIS Aggregator (AISHUB) - -**AIS Over-the-air Operation (RF)** - -.. image:: https://raw.githubusercontent.com/ampledata/aiscot/main/docs/aiscot_ota.png - :alt: AISCOT "AIS Over the Air" Operation - -Receive AIS data from a VHF AIS receiver, such as the -Megwatt `dAISy+ `_. From there -AIS can be decoded by `AIS Dispatcher `_ and -forwarded to AISCOT to be transformed to COT and transmitted to COT destinations. - -**AIS Aggregator Operation (AISHUB.com)** - -.. image:: https://raw.githubusercontent.com/ampledata/aiscot/main/docs/aiscot_agg.png - :alt: AISCOT "AIS Aggregator" Operation - -Receive AIS data from the `AISHUB `_ service. -Requires a subscription to AISHUB. - - -Support Development +License & Copyright =================== -.. image:: https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png - :target: https://www.buymeacoffee.com/ampledata - :alt: Support Development: Buy me a coffee! - - -Installation -============ - -**AISCOT requires Python 3.6 or above.** - -AISCOT functionality is provided by a command-line tool called ``aiscot``, which can be -installed several ways. - -Installing as a Debian/Ubuntu Package [Use Me!]:: - - $ wget https://github.com/ampledata/pytak/releases/latest/download/python3-pytak_latest_all.deb - $ sudo apt install -f ./python3-pytak_latest_all.deb - $ wget https://github.com/ampledata/aiscot/releases/latest/download/python3-aiscot_latest_all.deb - $ sudo apt install -f ./python3-aiscot_latest_all.deb - -Install from the Python Package Index [Alternative]:: - - $ python3 -m pip install -U pytak - $ python3 -m pip install -U aiscot - -Install from this source tree [Developer]:: - - $ git clone https://github.com/ampledata/aiscot.git - $ cd aiscot/ - $ python3 setup.py aiscot - - -Usage -===== - -AISCOT can be configured with a INI-style configuration file, or using -environmental variables. - -Command-line options:: - - usage: aiscot [-h] [-c CONFIG_FILE] [-p PREF_PACKAGE] - - optional arguments: - -h, --help show this help message and exit - -c CONFIG_FILE, --CONFIG_FILE CONFIG_FILE - Optional configuration file. Default: config.ini - -p PREF_PACKAGE, --PREF_PACKAGE PREF_PACKAGE - Optional connection preferences package zip file (aka Data Package). - -Configuration options: - ``COT_URL`` : str, default: udp://239.2.3.1:6969 - URL to CoT destination. Must be a URL, e.g. ``tcp://1.2.3.4:1234`` or ``tls://...:1234``, etc. See `PyTAK `_ for options, including TLS support. - ``AIS_PORT`` : int, default: 5050 - AIS UDP Listen Port, for use with Over-the-air (RF) AIS. - ``COT_STALE`` : int, default: 3600 - CoT Stale period ("timeout"), in seconds. Default `3600` seconds (1 hour). - ``COT_TYPE`` : str, default: a-u-S-X-M - Override COT Event Type ("marker type"). - ``FEED_URL`` : str, optional - AISHUB feed URL. See **AISHUB usage notes** in README below. - ``KNOWN_CRAFT`` : str, optional - Known Craft hints file. CSV file containing callsign/marker hints. - ``INCLUDE_ALL_CRAFT`` : bool, optional - If using KNOWN_CRAFT, still include other craft not in our KNOWN_CRAFT list. - ``IGNORE_ATON`` : bool, optional - IF SET- adsbcot will ignore AIS from Aids to Naviation (buoys, etc). - -See example-config.ini in the source tree for example configuration. - -**AISHUB usage notes** - -AISHUB.com requires registration. Once registered the site will provide you with a -Username that you'll use with their feed. You'll also need to specify a Bounding Box -when accessing the feed. - -The AISHUB_URL must be specified as follows: - -``https://data.aishub.net/ws.php?format=1&output=json&compress=0&username=AISHUB_USERNAME&latmin=BBOX_LAT_MIN&latmax=BBOX_LAT_MAX&lonmin=BBOX_LON_MON&lonmax=BBOX_LON_MAX`` - -Replacing ``AISHUB_USERNAME`` with your AISHUB.com username, and specifying the -Bounding Box is specified as follows: - -latmin : signed float - The minimum latitude of the Bounding Box (degrees from Equator) as a signed float - (use negative sign for East: ``-``). -latmax : signed float - The maximum latitude of the Bounding Box (degrees from Equator) as a signed float - (use negative sign for East: ``-``). -lonmin : signed float - The minimum longitude of the Bound Box (degrees from Prime Meridian) as a signed float - (use negative sign for North: ``-``). -lonmax : signed float - The maximum longitude of the Bound Box (degrees from Prime Meridian) as a signed float - (use negative sign for North: ``-``). - -For example, the following Bound Box paints a large swath around Northern California: -``latmin=35&latmax=38&lonmin=-124&lonmax=-121``. This can be read as: -"Between 35° and 38° latitude & -121° and -124° longitude". - - - -Example Setup -============= - -The following diagram shows an example setup of AISCOT utilizing a dAISy+ AIS receiver -with an outboard Marine VHF antenna, a Raspberry Pi running aisdispatcher and AISCOT, -forwarding COT to a TAK Server and WinTAK & ATAK clients. (OV-1) - - -.. image:: https://raw.githubusercontent.com/ampledata/aiscot/main/docs/aiscot_home.png - :alt: AISCOT Example setup - - -Database Update -=============== -Occasional updates to the YADD Ship Name database can be found at: http://www.yaddnet.org/pages/php/test/tmp/ - -Updates to the MID database can be found at: TK - - -Source -====== -Github: https://github.com/ampledata/aiscot - - -Author -====== -Greg Albrecht oss@undef.net - -http://ampledata.org/ - - -Copyright -========= - -* aiscot Copyright 2023 Greg Albrecht -* pyAISm.py Copyright 2016 Pierre Payen - - -License -======= - -Copyright 2023 Greg Albrecht +Copyright Sensors & Signals LLC https://www.snstac.com Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. -You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/aiscot/__init__.py b/aiscot/__init__.py index 119181f..404e867 100644 --- a/aiscot/__init__.py +++ b/aiscot/__init__.py @@ -1,11 +1,14 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +# __init__.py from https://github.com/snstac/aiscot # -# Copyright 2023 Greg Albrecht +# Copyright Sensors & Signals LLC https://www.snstac.com # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, @@ -14,32 +17,31 @@ # limitations under the License. # -"""AISCOT: AIS Cursor-On-Target Gateway. +"""AISCOT: AIS to TAK Gateway - Display Ships in TAK.""" -:author: Greg Albrecht -:copyright: Copyright 2023 Greg Albrecht -:license: Apache License, Version 2.0 -:source: -""" +__version__ = "6.0.0-beta1" -from .constants import ( - LOG_FORMAT, - LOG_LEVEL, - DEFAULT_LISTEN_PORT, - DEFAULT_LISTEN_HOST, - DEFAULT_COT_TYPE, - DEFAULT_COT_STALE, - DEFAULT_POLL_INTERVAL, - DEFAULT_MID_DB_FILE, - DEFAULT_SHIP_DB_FILE, -) +# Python 3.6 test/build work-around: +try: + from .constants import ( + LOG_FORMAT, + LOG_LEVEL, + DEFAULT_LISTEN_PORT, + DEFAULT_LISTEN_HOST, + DEFAULT_COT_TYPE, + DEFAULT_COT_STALE, + DEFAULT_POLL_INTERVAL, + DEFAULT_MID_DB_FILE, + DEFAULT_SHIP_DB_FILE, + ) -from .functions import ais_to_cot, create_tasks + from .functions import ais_to_cot, create_tasks -from .ais_functions import get_known_craft + from .ais_functions import get_known_craft -from .classes import AISWorker + from .classes import AISWorker +except ImportError as exc: + import warnings -__author__ = "Greg Albrecht " -__copyright__ = "Copyright 2023 Greg Albrecht" -__license__ = "Apache License, Version 2.0" + warnings.warn(str(exc)) + warnings.warn("Ignoring ImportError - Python 3.6 compat work-around.") diff --git a/aiscot/ais_functions.py b/aiscot/ais_functions.py index ce6ffe2..2afbe69 100644 --- a/aiscot/ais_functions.py +++ b/aiscot/ais_functions.py @@ -1,7 +1,9 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- # -# Copyright 2023 Greg Albrecht +# AISCOT ais_functions.py +# +# Copyright Sensors & Signals LLC https://www.snstac.com # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,8 +23,8 @@ import aiscot -__author__ = "Greg Albrecht " -__copyright__ = "Copyright 2023 Greg Albrecht" +__author__ = "Greg Albrecht " +__copyright__ = "Copyright 2023 Sensors & Signals LLC" __license__ = "Apache License, Version 2.0" diff --git a/aiscot/classes.py b/aiscot/classes.py index d88a395..38f2ef2 100644 --- a/aiscot/classes.py +++ b/aiscot/classes.py @@ -1,11 +1,14 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +# classes.py from https://github.com/snstac/aiscot # -# Copyright 2023 Greg Albrecht +# Copyright Sensors & Signals LLC https://www.snstac.com # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, @@ -29,10 +32,6 @@ import aiscot import aiscot.pyAISm -__author__ = "Greg Albrecht " -__copyright__ = "Copyright 2023 Greg Albrecht" -__license__ = "Apache License, Version 2.0" - # pylint: disable=too-many-instance-attributes class AISNetworkClient(asyncio.Protocol): @@ -94,12 +93,13 @@ def handle_message(self, data) -> None: return event: Optional[bytes] = aiscot.ais_to_cot( - msg, config=self.config, known_craft=known_craft) + msg, config=self.config, known_craft=known_craft + ) if event: self.queue.put_nowait(event) - def connection_made(self, transport): + def connection_made(self, transport) -> None: """Call when a network connection is made.""" self.transport = transport self.address = transport.get_extra_info("peername") @@ -112,13 +112,13 @@ def connection_made(self, transport): self.known_craft_db = aiscot.get_known_craft(known_craft) self.ready.set() - def datagram_received(self, data, addr): + def datagram_received(self, data, addr) -> None: """Call when a UDP datagram is received.""" self._logger.debug("Recieved from %s: '%s'", addr, data) for line in data.splitlines(): self.handle_message(line) - def connection_lost(self, exc): + def connection_lost(self, exc) -> None: """Call when a network connection is lost.""" self.ready.clear() self._logger.exception(exc) @@ -169,7 +169,8 @@ async def handle_data(self, data) -> None: continue event: Optional[bytes] = aiscot.ais_to_cot( - msg, self.config, known_craft=known_craft) + msg, self.config, known_craft=known_craft + ) if event: await self.put_queue(event) @@ -203,8 +204,11 @@ async def run(self, number_of_iterations=-1) -> None: self.feed_url = self.config.get("AISHUB_URL") if self.feed_url: warnings.warn( - ("DEPRECATED: AISHUB_URL configuration parameter detected, " - "please use FEED_URL.")) + ( + "DEPRECATED: AISHUB_URL configuration parameter detected, " + "please use FEED_URL." + ) + ) else: self.feed_url = self.config.get("FEED_URL") @@ -213,7 +217,7 @@ async def run(self, number_of_iterations=-1) -> None: else: await self.network_rx() - async def network_rx(self): + async def network_rx(self) -> None: """Start a network receiver.""" port: int = int(self.config.get("LISTEN_PORT", aiscot.DEFAULT_LISTEN_PORT)) host: str = self.config.get("LISTEN_HOST", aiscot.DEFAULT_LISTEN_HOST) @@ -222,22 +226,20 @@ async def network_rx(self): ready = asyncio.Event() self._logger.info("Listening for AIS on %s:%s", host, port) await loop.create_datagram_endpoint( - lambda: AISNetworkClient(ready, self.queue, self.config), - local_addr=(host, port), - ) + lambda: AISNetworkClient(ready, self.queue, self.config), + local_addr=(host, port), + ) await ready.wait() while 1: await asyncio.sleep(0.01) - async def poll_feed(self): + async def poll_feed(self) -> None: """Poll the data source feed.""" poll_interval: int = int( - self.config.get("POLL_INTERVAL", aiscot.DEFAULT_POLL_INTERVAL) - ) + self.config.get("POLL_INTERVAL", aiscot.DEFAULT_POLL_INTERVAL) + ) async with aiohttp.ClientSession() as self.session: while 1: await asyncio.sleep(poll_interval) - self._logger.info( - "Polling every %ss: %s", poll_interval, self.feed_url - ) + self._logger.info("Polling every %ss: %s", poll_interval, self.feed_url) await self.get_feed() diff --git a/aiscot/commands.py b/aiscot/commands.py index 622fd49..7eb6ee3 100644 --- a/aiscot/commands.py +++ b/aiscot/commands.py @@ -1,11 +1,14 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +# commands.py from https://github.com/snstac/aiscot # -# Copyright 2023 Greg Albrecht +# Copyright Sensors & Signals LLC https://www.snstac.com # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, @@ -18,14 +21,10 @@ import pytak -__author__ = "Greg Albrecht " -__copyright__ = "Copyright 2023 Greg Albrecht" -__license__ = "Apache License, Version 2.0" - def main() -> None: """CLI tool boilerplate.""" - pytak.cli(__name__.split('.', maxsplit=1)[0]) + pytak.cli(__name__.split(".", maxsplit=1)[0]) if __name__ == "__main__": diff --git a/aiscot/constants.py b/aiscot/constants.py index 066ab67..8ce4864 100644 --- a/aiscot/constants.py +++ b/aiscot/constants.py @@ -1,11 +1,14 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +# constants.py from https://github.com/snstac/aiscot # -# Copyright 2023 Greg Albrecht +# Copyright Sensors & Signals LLC https://www.snstac.com # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, @@ -20,10 +23,6 @@ import os import pkg_resources -__author__ = "Greg Albrecht " -__copyright__ = "Copyright 2023 Greg Albrecht" -__license__ = "Apache License, Version 2.0" - if bool(os.environ.get("DEBUG")): LOG_LEVEL = logging.DEBUG diff --git a/aiscot/functions.py b/aiscot/functions.py index 9562660..e17e06f 100644 --- a/aiscot/functions.py +++ b/aiscot/functions.py @@ -1,11 +1,14 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +# functions.py from https://github.com/snstac/aiscot # -# Copyright 2023 Greg Albrecht +# Copyright Sensors & Signals LLC https://www.snstac.com # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, @@ -16,6 +19,8 @@ """AISCOT functions for parsing AIS and generating Cursor on Target.""" +import xml.etree.ElementTree as ET + from configparser import SectionProxy from typing import Optional, Union from xml.etree.ElementTree import tostring, Element @@ -24,14 +29,8 @@ import aiscot import aiscot.ais_functions as aisfunc -__author__ = "Greg Albrecht " -__copyright__ = "Copyright 2023 Greg Albrecht" -__license__ = "Apache License, Version 2.0" - -def create_tasks( - config: Union[dict, SectionProxy], clitool: pytak.CLITool -) -> set: +def create_tasks(config: Union[dict, SectionProxy], clitool: pytak.CLITool) -> set: """Bootstrap a set of coroutine tasks for a PyTAK application. Bootstrapped tasks: @@ -58,8 +57,9 @@ def create_tasks( # pylint: disable=too-many-locals, too-many-branches, too-many-statements def ais_to_cot_xml( - craft: dict, config: Union[dict, SectionProxy, None] = None, - known_craft: Optional[dict] = None + craft: dict, + config: Union[dict, SectionProxy, None] = None, + known_craft: Optional[dict] = None, ) -> Optional[Element]: """Convert AIS sentences to Cursor on Target. @@ -97,21 +97,26 @@ def ais_to_cot_xml( # N.B. SectionProxy does not support dict's "fallback" parameter, you have to # use explicit conditionals ('or'), like so: cot_type: str = str( - config.get("COT_TYPE") or known_craft.get("COT") or aiscot.DEFAULT_COT_TYPE) + config.get("COT_TYPE") or known_craft.get("COT") or aiscot.DEFAULT_COT_TYPE + ) cot_stale: int = int( - config.get("COT_STALE") or known_craft.get("STALE") or aiscot.DEFAULT_COT_STALE) + config.get("COT_STALE") or known_craft.get("STALE") or aiscot.DEFAULT_COT_STALE + ) cot_host_id: str = str(config.get("COT_HOST_ID") or "") aiscotx: Element = Element("_aiscot_") aiscotx.set("cot_host_id", cot_host_id) - ais_name: str = str( - craft.get("name", craft.get("NAME", ""))).replace("@", "").strip() + ais_name: str = ( + str(craft.get("name", craft.get("NAME", ""))).replace("@", "").strip() + ) shipname: str = str(craft.get("shipname", aisfunc.get_shipname(mmsi))) vessel_type: str = str(craft.get("type", craft.get("TYPE", ""))) + cot_icon = config.get("COT_ICON") + if ais_name: remarks_fields.append(f"AIS Name: {ais_name}") aiscotx.set("ais_name", ais_name) @@ -200,6 +205,11 @@ def ais_to_cot_xml( detail.append(contact) detail.append(remarks) + if cot_icon: + usericon = ET.Element("usericon") + usericon.set("iconsetpath", cot_icon) + detail.append(usericon) + root = Element("event") root.set("version", "2.0") root.set("type", cot_type) @@ -217,8 +227,9 @@ def ais_to_cot_xml( def ais_to_cot( - craft: dict, config: Union[dict, SectionProxy, None] = None, - known_craft: Optional[dict] = None + craft: dict, + config: Union[dict, SectionProxy, None] = None, + known_craft: Optional[dict] = None, ) -> Optional[bytes]: """Convert AIS to CoT XML and return it as 'TAK Protocol, Version 0'. diff --git a/aiscot/pyAISm.py b/aiscot/pyAISm.py index 9924dae..87432a5 100644 --- a/aiscot/pyAISm.py +++ b/aiscot/pyAISm.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +# pyAISm.py from https://github.com/snstac/aiscot # # The MIT License (MIT) # @@ -330,7 +331,7 @@ def decod_24(data): ais_data = decod_type[type_nb]( data ) # try to decode the sentense without assumption of its type - except (KeyError): # if it fails, like a type 16 message, execute following code + except KeyError: # if it fails, like a type 16 message, execute following code logger.info("Cannot decode message type " + str(type_nb)) ais_data = {"type": type_nb} except: diff --git a/debian/aiscot.conf b/debian/aiscot.conf new file mode 100644 index 0000000..5fc4802 --- /dev/null +++ b/debian/aiscot.conf @@ -0,0 +1,86 @@ +# aiscot.conf from https://github.com/snstac/aiscot +# +# Debian specific runtime configuration for aiscot. +# +# Copyright Sensors & Signals LLC https://www.snstac.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# AISCOT Configuration: https://aiscot.rtfd.io/ +# Change values here, and restart with: sudo systemctl restart aiscot + +# Enable or Disable the AISCOT software daemon. +# ENABLED=1 + +# URL to CoT destination. Must be a URL, e.g. tcp://1.2.3.4:1234 or tls://...:1234, etc. +# COT_URL=udp+wo://239.2.3.1:6969 + +# AIS UDP Listen Port, for use with Over-the-air (RF) AIS. +# AIS_PORT=5050 + +# CoT Stale period ("timeout"), in seconds. +# COT_STALE=3600 + +# Override COT Event Type ("marker type"). +# COT_TYPE=a-u-S-X-M + +# If using AISHUB or other AIS aggregators, set URL of feed. +# FEED_URL= + +# Known Craft hints file. CSV file containing callsign/marker hints. +# KNOWN_CRAFT= + +# If using KNOWN_CRAFT, still include other craft not in our KNOWN_CRAFT list. +# INCLUDE_ALL_CRAFT= + +# Ignore AIS from Aids to Naviation (buoys, etc). +# IGNORE_ATON= + + +# PyTAK Configuration: https://pytak.rtfd.io/ +# Change values here, and restart with: sudo systemctl restart aiscot + +# Sets TAK Protocol to use for CoT output. +# TAK_PROTO=0 + +# Sets debug-level logging. Any value other than 0 is considered True. False if unset. +# DEBUG= + +# TAK Data Packages containing TAK Server connection settings, TLS certificates, etc. +# PREF_PACKAGE= + +# Path to a file containing the unencrypted plain-text PEM format Client Certificate. +# This file can contain both the Client Cert & Client Key, or the Client Cert alone. +# In the later case (cert alone), PYTAK_TLS_CLIENT_KEY must be set to the Client Key. +# PYTAK_TLS_CLIENT_CERT= + +# Path to a file containing the unencrypted plain-text PEM format Client Private Key +# for the associated PYTAK_TLS_CLIENT_CERT. +# PYTAK_TLS_CLIENT_KEY= + +# Password for password protected certificates or password protected Private Keys. +# PYTAK_TLS_CLIENT_PASSWORD= + +# Disable destination TLS Certificate Verification. +# PYTAK_TLS_DONT_VERIFY= + +# Disable destination TLS Certificate Common Name (CN) Verification. +# PYTAK_TLS_DONT_CHECK_HOSTNAME= + +# File containing the CA Trust Store to use for remote certificate verification. +# PYTAK_TLS_CLIENT_CAFILE= + +# Expected hostname or CN of the connected server. Not used unless verifying hostname. +# PYTAK_TLS_SERVER_EXPECTED_HOSTNAME= + diff --git a/debian/aiscot.postinst b/debian/aiscot.postinst new file mode 100755 index 0000000..c19e7ff --- /dev/null +++ b/debian/aiscot.postinst @@ -0,0 +1,79 @@ +#!/bin/bash +# aiscot.postinst from https://github.com/snstac/aiscot +# +# Copyright Sensors & Signals LLC https://www.snstac.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +echo "AISCOT Post Install" + +# shellcheck source=aiscot.default.conf +[ -f "/etc/default/python3-aiscot" ] && . /etc/default/python3-aiscot + +# Sane defaults: +[ -z "$SERVER_HOME" ] && SERVER_HOME=/run/aiscot +[ -z "$SERVER_USER" ] && SERVER_USER=aiscot +[ -z "$SERVER_NAME" ] && SERVER_NAME="AIS to TAK Gateway System User" +[ -z "$SERVER_GROUP" ] && SERVER_GROUP=aiscot + +# Groups that the user will be added to, if undefined, then none. +ADDGROUP="" + +# create user to avoid running server as root +# 1. create group if not existing +if ! getent group | grep -q "^$SERVER_GROUP:" ; then + echo -n "Adding group $SERVER_GROUP.." + addgroup --quiet --system "$SERVER_GROUP" 2>/dev/null ||true + echo "..done" +fi +# 2. create homedir if not existing +test -d "$SERVER_HOME" || mkdir "$SERVER_HOME" +# 3. create user if not existing +if ! getent passwd | grep -q "^$SERVER_USER:"; then + echo -n "Adding system user $SERVER_USER.." + adduser --quiet \ + --system \ + --ingroup "$SERVER_GROUP" \ + --no-create-home \ + --disabled-password \ + "$SERVER_USER" 2>/dev/null || true + echo "..done" +fi +# 4. adjust passwd entry +usermod -c "$SERVER_NAME" \ + -d "$SERVER_HOME" \ + -g "$SERVER_GROUP" \ + "$SERVER_USER" +# 5. adjust file and directory permissions +if ! dpkg-statoverride --list "$SERVER_HOME" >/dev/null +then + chown -R "$SERVER_USER":adm "$SERVER_HOME" + chmod u=rwx,g=rxs,o= "$SERVER_HOME" +fi +# 6. Add the user to the ADDGROUP group +if test -n "$ADDGROUP" +then + if ! groups "$SERVER_USER" | cut -d: -f2 | \ + grep -qw "$ADDGROUP"; then + adduser "$SERVER_USER" "$ADDGROUP" + fi +fi + +systemctl enable AISCOT.service + +echo "AISCOT has been installed." +echo "Configure: sudo nano /etc/default/AISCOT" +echo "Start: sudo systemctl start AISCOT.service" + +exit 0 diff --git a/debian/aiscot.service b/debian/aiscot.service new file mode 100644 index 0000000..1cefb31 --- /dev/null +++ b/debian/aiscot.service @@ -0,0 +1,39 @@ +# aiscot.service from https://github.com/snstac/aiscot +# +# aiscot service for systemd +# +# Copyright Sensors & Signals LLC https://www.snstac.com/ +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +[Unit] +Description=AISCOT: AIS to TAK Gateway - Display Ships in TAK +Documentation=https://github.com/snstac/aiscot +Wants=network.target +After=network.target + +[Service] +User=aiscot +ExecStart=/usr/local/bin/aiscot +RuntimeDirectory=aiscot +SyslogIdentifier=aiscot +EnvironmentFile=/etc/default/python3-aiscot +Type=simple +Restart=always +RestartSec=20 +StartLimitInterval=1 +StartLimitBurst=100 +RestartPreventExitStatus=64 +Nice=-1 + +[Install] +WantedBy=default.target diff --git a/debian/install_pkg_build_deps.sh b/debian/install_pkg_build_deps.sh new file mode 100644 index 0000000..6713a78 --- /dev/null +++ b/debian/install_pkg_build_deps.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +echo "Installing Debian package build dependencies" + +apt-get update -qq + +apt-get install -y \ + python3 python3-dev python3-pip python3-venv python3-all \ + dh-python debhelper devscripts dput software-properties-common \ + python3-distutils python3-setuptools python3-wheel python3-stdeb diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..7117db8 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,40 @@ +site_name: AISCOT - Display Marine Vessels in TAK +site_url: https://aiscot.rtfd.io/ +repo_url: https://github.com/snstac/aiscot/ +site_description: Software for monitoring and analyzing maritime surveillance data via the Team Awareness Kit (TAK) ecosystem of products. +site_author: Greg Albrecht +copyright: Copyright Sensors & Signals LLC https://www.snstac.com + +theme: + name: material + highlightjs: true + features: + - content.code.copy + - content.code.select + - content.code.annotate + +plugins: + - include-markdown: + opening_tag: "{!" + closing_tag: "!}" + - search + - mkdocstrings: + handlers: + # See: https://mkdocstrings.github.io/python/usage/ + python: + options: + docstring_style: sphinx + +markdown_extensions: + - markdown_include.include: + base_path: . + - admonition + - toc: + permalink: True + - pymdownx.highlight: + anchor_linenums: true + line_spans: __span + pygments_lang_class: true + - pymdownx.inlinehilite + - pymdownx.snippets + - pymdownx.superfences \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 47d39d9..ac65f48 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,17 +1,110 @@ -# Nosetests configuration for AIS Cursor Target Gateway. +# setup.cfg from https://github.com/snstac/aiscot +# Setup config for AISCOT: AIS to TAK Gateway - Display Ships in TAK. # -# Source:: https://github.com/ampledata/aiscot -# Author:: Greg Albrecht -# Copyright:: Copyright 2023 Greg Albrecht. -# License:: Apache License, Version 2.0 +# Copyright Sensors & Signals LLC https://www.snstac.com # +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +[metadata] +name = aiscot +version = attr: aiscot.__version__ +url = https://github.com/snstac/aiscot +project_urls = + CI: GitHub Actions = https://github.com/snstac/aiscot/actions + GitHub: issues = https://github.com/snstac/aiscot/issues + GitHub: repo = https://github.com/snstac/aiscot +description = Software for monitoring and analyzing AIS in TAK. +long_description = file: README.rst +long_description_content_type = text/x-rst +maintainer = Greg Albrecht +maintainer_email = oss@undef.net +license = Apache 2.0 +license_files = LICENSE +classifiers = + License :: OSI Approved :: Apache Software License + + Intended Audience :: Developers + + Programming Language :: Python + Programming Language :: Python :: 3 + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 + + Development Status :: 5 - Production/Stable + + Operating System :: POSIX + Operating System :: MacOS :: MacOS X + Operating System :: Microsoft :: Windows + Operating System :: OS Independent +keywords = + Cursor on Target + Cursor-on-Target + CoT + ATAK + TAK + WinTAK + TAK + TAK Server + iTAK + AIS + Boats + Marine + Sailing + Ships + Shipping + + +[options.entry_points] +console_scripts = + aiscot = aiscot.commands:main + + +[options] +packages = aiscot +package_dir = + aiscot = aiscot +python_requires = >=3.6, <4 +install_requires = + pytak >= 5.4.0 + aiohttp < 4.0.0 + + +[options.extras_require] +with_pymodes = pymodes >= 2.8 +with_takproto = takproto >= 2.0.0 +test = + pytest-asyncio + pytest-cov + pylint + flake8 + black +[isort] +profile = black + +[flake8] +max-line-length = 88 +extend-ignore = E203, E704 +[pylint] +max-line-length = 88 -[nosetests] -with-xunit = 1 -with-coverage = 1 -cover-html = 1 -with-doctest = 1 -doctest-tests = 1 -cover-tests = 0 -cover-package = aiscot +[pycodestyle] +ignore = E203 +max_line_length = 88 diff --git a/setup.py b/setup.py index 68fc476..c7cc9f9 100644 --- a/setup.py +++ b/setup.py @@ -1,11 +1,14 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +# setup.py from https://github.com/snstac/aiscot # -# Copyright 2023 Greg Albrecht +# Copyright Sensors & Signals LLC https://www.snstac.com # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, @@ -14,63 +17,9 @@ # limitations under the License. # -"""Setup for the AIS Cursor-On-Target Gateway. - -Source:: https://github.com/ampledata/aiscot -""" - -import os -import sys - -import setuptools - -__title__ = "aiscot" -__version__ = "5.2.1" -__author__ = "Greg Albrecht " -__copyright__ = "Copyright 2023 Greg Albrecht" -__license__ = "Apache License, Version 2.0" - - -def publish(): - """Function for publishing package to pypi.""" - if sys.argv[-1] == "publish": - os.system("python setup.py sdist") - os.system("twine upload dist/*") - sys.exit() - - -publish() - - -def read_readme(readme_file="README.rst") -> str: - """Read the contents of the README file for use as a long_description.""" - readme: str = "" - this_directory = os.path.abspath(os.path.dirname(__file__)) - with open(os.path.join(this_directory, readme_file), encoding="utf-8") as frm: - readme = frm.read() - return readme +"""Setup for AISCOT.""" +from setuptools import setup -setuptools.setup( - version=__version__, - name=__title__, - packages=[__title__], - package_dir={__title__: __title__}, - url=f"https://github.com/ampledata/{__title__}", - entry_points={"console_scripts": [f"{__title__} = {__title__}.commands:main"]}, - description="AIS Cursor-On-Target Gateway.", - author="Greg Albrecht", - author_email="oss@undef.net", - package_data={"": ["LICENSE"]}, - license="Apache License, Version 2.0", - long_description=read_readme(), - long_description_content_type="text/x-rst", - zip_safe=False, - include_package_data=True, - install_requires=["pytak >= 5.4.0", "aiohttp"], - classifiers=[ - "Programming Language :: Python", - "License :: OSI Approved :: Apache Software License", - ], - keywords=["Sailing", "AIS", "Cursor on Target", "ATAK", "TAK", "CoT"], -) +if __name__ == "__main__": + setup()