diff --git a/.github/workflows/debian.yml b/.github/workflows/debian.yml index ee62fb1..64eb243 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: sudo 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: @@ -60,4 +46,4 @@ jobs: file: deb_dist/*.deb tag: ${{ github.ref }} overwrite: true - file_glob: true + file_glob: true \ No newline at end of file diff --git a/Makefile b/Makefile index c9d9dc3..4205fea 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,11 @@ -# Makefile for PyTAK +# Makefile from https://github.com/snstac/pytak +# PyTAK Makefile # -# Copyright Sensors & Signals LLC https://www.snstac.com +# 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, @@ -15,50 +14,49 @@ # limitations under the License. # -this_app = pytak -.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 -m pip install --use-feature=in-tree-build . + python3 setup.py develop editable: python3 -m pip install -e . install_test_requirements: - python3 -m pip install -r requirements_test.txt + python3 -m pip install -r requirements_test.txt install: python3 setup.py install uninstall: - python3 -m pip uninstall -y $(this_app) + python3 -m pip uninstall -y $(REPO_NAME) reinstall: uninstall install -dist: build - -build: - python3 -m build - -publish: dist - twine upload dist/* +publish: + python3 setup.py publish 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__ */.mypy_cache/ .pytest_cache/ + */__pycache__ deb_dist .mypy_cache pep8: - flake8 --max-line-length=88 --extend-ignore=E203,E231 --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 @@ -74,11 +72,32 @@ 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 \ No newline at end of file + mkdocs serve + +deb_dist: + python3 setup.py --command-packages=stdeb.command sdist_dsc + +deb_custom: + cp debian/$(REPO_NAME).conf $(wildcard deb_dist/*/debian)/$(REPO_NAME).default + cp debian/$(REPO_NAME).postinst $(wildcard deb_dist/*/debian)/$(REPO_NAME).postinst + cp debian/$(REPO_NAME).service $(wildcard deb_dist/*/debian)/$(REPO_NAME).service + +bdist_deb: deb_dist deb_custom + cd deb_dist/$(REPO_NAME)-*/ && dpkg-buildpackage -rfakeroot -uc -us + +faux_latest: + cp deb_dist/$(REPO_NAME)_*-1_all.deb deb_dist/$(REPO_NAME)_latest_all.deb + cp deb_dist/$(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.md similarity index 67% rename from README.rst rename to README.md index d855351..b9b9117 100644 --- a/README.rst +++ b/README.md @@ -1,11 +1,8 @@ -.. image:: https://pytak.readthedocs.io/en/latest/atak_screenshot_with_pytak_logo-x25.jpg - :alt: ATAK Screenshot with PyTAK Logo. - :target: https://github.com/snstac/pytak/blob/main/docs/atak_screenshot_with_pytak_logo.jpg +![ATAK Screenshot with PyTAK Logo.](media/atak_screenshot_with_pytak_logo-x25.jpg) -Python Team Awareness Kit (PyTAK) -********************************* +# Python Team Awareness Kit -PyTAK is a Python Module for creating TAK clients, servers & gateways. +PyTAK is a Python Module for creating [TAK](https://tak.gov) clients, servers & gateways. PyTAK includes: @@ -14,14 +11,12 @@ PyTAK includes: - Functions for parsing and serializing TAK & CoT data. - Functions for sending and receiving TAK & CoT data over a network. -Documentation -============= +## Documentation -See `PyTAK documentation `_ for instructions on getting +See [PyTAK documentation](https://pytak.rtfd.io/) for instructions on getting started with PyTAK, examples, configuration & troubleshooting options. -License & Copyright -=================== +## License & Copyright Copyright Sensors & Signals LLC https://www.snstac.com @@ -37,3 +32,4 @@ limitations under the License. asyncio_dgram is Copyright (c) 2019 Justin Bronder and is licensed under the MIT License, see pytak/asyncio_dgram/LICENSE for details. + diff --git a/docs/compatibility.md b/docs/compatibility.md index 86edeef..908e069 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -44,8 +44,8 @@ When installing PyTAK:: Alternative, installing from a Debian package:: sudo apt update -y - wget https://github.com/snstak/takproto/releases/latest/download/python3-takproto_latest_all.deb - sudo apt install -f ./python3-takproto_latest_all.deb + wget https://github.com/snstak/takproto/releases/latest/download/takproto_latest_all.deb + sudo apt install -f ./takproto_latest_all.deb ## Python 3.6+ diff --git a/docs/index.md b/docs/index.md index 7296a8d..563ed56 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,13 +1 @@ - -![ATAK Screenshot with PyTAK Logo.](atak_screenshot_with_pytak_logo-x25.jpg) - -# Python Team Awareness Kit Documentation - -PyTAK is a Python Module for creating [TAK](https://tak.gov) clients, servers & gateways. - -PyTAK includes: - -- TAK Protocol support for interconnecting with ATAK, WinTAK, iTAK & TAK Server. -- Classes for handling TAK, Cursor on Target (CoT) & non-CoT data. -- Functions for parsing and serializing TAK & CoT data. -- Functions for sending and receiving TAK & CoT data over a network. +{!README.md!} diff --git a/docs/installation.md b/docs/installation.md index b9f99ef..06b03df 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -6,8 +6,8 @@ To install PyTAK, download the pytak package and install using apt: ```sh sudo apt update -y -wget https://github.com/snstac/pytak/releases/latest/download/python3-pytak_latest_all.deb -sudo apt install -f ./python3-pytak_latest_all.deb +wget https://github.com/snstac/pytak/releases/latest/download/pytak_latest_all.deb +sudo apt install -f ./pytak_latest_all.deb ``` ### Data Package Support @@ -27,8 +27,8 @@ To install takproto, download the deb package and install using apt:: ```sh sudo apt update -y -wget https://github.com/snstak/takproto/releases/latest/download/python3-takproto_latest_all.deb -sudo apt install -f ./python3-takproto_latest_all.deb +wget https://github.com/snstak/takproto/releases/latest/download/takproto_latest_all.deb +sudo apt install -f ./takproto_latest_all.deb ``` ## Install from Python Package Index (PyPI) diff --git a/docs/atak_screenshot_with_pytak_logo-x25.jpg b/docs/media/atak_screenshot_with_pytak_logo-x25.jpg similarity index 100% rename from docs/atak_screenshot_with_pytak_logo-x25.jpg rename to docs/media/atak_screenshot_with_pytak_logo-x25.jpg diff --git a/docs/atak_screenshot_with_pytak_logo.jpg b/docs/media/atak_screenshot_with_pytak_logo.jpg similarity index 100% rename from docs/atak_screenshot_with_pytak_logo.jpg rename to docs/media/atak_screenshot_with_pytak_logo.jpg diff --git a/docs/pytak_logo-256x264.png b/docs/media/pytak_logo-256x264.png similarity index 100% rename from docs/pytak_logo-256x264.png rename to docs/media/pytak_logo-256x264.png diff --git a/docs/pytak_logo.png b/docs/media/pytak_logo.png similarity index 100% rename from docs/pytak_logo.png rename to docs/media/pytak_logo.png diff --git a/docs/takproto_chart.png b/docs/media/takproto_chart.png similarity index 100% rename from docs/takproto_chart.png rename to docs/media/takproto_chart.png diff --git a/mkdocs.yml b/mkdocs.yml index c1f5121..fc24451 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -3,7 +3,7 @@ site_url: https://pytak.rtfd.io/ repo_url: https://github.com/snstac/pytak/ site_description: Python Team Awareness Kit (PyTAK) Documentation site_author: Greg Albrecht -copyright: Copyright Sensors & Signals LLC snstac.com +copyright: Copyright Sensors & Signals LLC https://www.snstac.com/ theme: name: material diff --git a/pytak/__init__.py b/pytak/__init__.py index 5ccd3d0..e345a15 100644 --- a/pytak/__init__.py +++ b/pytak/__init__.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +# __init__.py from https://github.com/snstac/pytak # # Copyright Sensors & Signals LLC https://www.snstac.com # @@ -14,13 +15,9 @@ # limitations under the License. # -"""Python Team Awareness Kit (PyTAK) Module. - -:source: -""" - -__version__ = "6.4.0" +"""Python Team Awareness Kit (PyTAK) Module.""" +__version__ = "7.0.0-beta1" from .constants import ( # NOQA LOG_LEVEL, @@ -81,9 +78,3 @@ ) from . import asyncio_dgram # NOQA - -# from .crypto_functions import * - -__author__ = "Greg Albrecht " -__copyright__ = "Copyright Sensors & Signals LLC https://www.snstac.com" -__license__ = "Apache License, Version 2.0" diff --git a/pytak/classes.py b/pytak/classes.py index eddf2e1..94f997e 100644 --- a/pytak/classes.py +++ b/pytak/classes.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +# classes.py from https://github.com/snstac/pytak # # Copyright Sensors & Signals LLC https://www.snstac.com # @@ -37,10 +38,6 @@ except ImportError: pass -__author__ = "Greg Albrecht " -__copyright__ = "Copyright Sensors & Signals LLC https://www.snstac.com" -__license__ = "Apache License, Version 2.0" - class Worker: # pylint: disable=too-few-public-methods """Meta class for all other Worker Classes.""" diff --git a/pytak/client_functions.py b/pytak/client_functions.py index 0402674..656a455 100644 --- a/pytak/client_functions.py +++ b/pytak/client_functions.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +# client_functions.py from https://github.com/snstac/pytak # # Copyright Sensors & Signals LLC https://www.snstac.com # @@ -54,10 +55,6 @@ warnings.warn("Using Python < 3.7, consider upgrading Python.") from asyncio import get_event_loop as get_running_loop -__author__ = "Greg Albrecht " -__copyright__ = "Copyright Sensors & Signals LLC https://www.snstac.com" -__license__ = "Apache License, Version 2.0" - async def create_udp_client( url: ParseResult, local_addr=None diff --git a/pytak/commands.py b/pytak/commands.py index 9c5c064..d8596ec 100644 --- a/pytak/commands.py +++ b/pytak/commands.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +# commands.py from https://github.com/snstac/pytak # # Copyright Sensors & Signals LLC https://www.snstac.com # @@ -18,10 +19,6 @@ import pytak -__author__ = "Greg Albrecht " -__copyright__ = "Copyright Sensors & Signals LLC https://www.snstac.com" -__license__ = "Apache License, Version 2.0" - def main() -> None: """Boilerplate main function.""" diff --git a/pytak/constants.py b/pytak/constants.py index 54e5c5d..82de2a1 100644 --- a/pytak/constants.py +++ b/pytak/constants.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +# constants.py from https://github.com/snstac/pytak # # Copyright Sensors & Signals LLC https://www.snstac.com # @@ -23,11 +24,6 @@ from typing import Optional -__author__ = "Greg Albrecht " -__copyright__ = "Copyright Sensors & Signals LLC https://www.snstac.com" -__license__ = "Apache License, Version 2.0" - - LOG_LEVEL: int = logging.INFO LOG_FORMAT: logging.Formatter = logging.Formatter( ("%(asctime)s pytak %(levelname)s - %(message)s") diff --git a/pytak/crypto_functions.py b/pytak/crypto_functions.py index 89f5533..4efb8e7 100644 --- a/pytak/crypto_functions.py +++ b/pytak/crypto_functions.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +# crypto_functions.py from https://github.com/snstac/pytak # # Copyright Sensors & Signals LLC https://www.snstac.com # @@ -37,12 +38,6 @@ USE_CRYPTOGRAPHY = True except ImportError as exc: warnings.warn(exc) - warnings.warn(INSTALL_MSG) - - -__author__ = "Greg Albrecht " -__copyright__ = "Copyright Sensors & Signals LLC https://www.snstac.com" -__license__ = "Apache License, Version 2.0" def save_pem(pem: bytes, dest: Union[str, None] = None) -> str: diff --git a/pytak/functions.py b/pytak/functions.py index 95e66df..9b98a91 100644 --- a/pytak/functions.py +++ b/pytak/functions.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +# functions.py from https://github.com/snstac/pytak # # Copyright Sensors & Signals LLC https://www.snstac.com # @@ -29,10 +30,6 @@ import pytak # pylint: disable=cyclic-import -__author__ = "Greg Albrecht " -__copyright__ = "Copyright Sensors & Signals LLC https://www.snstac.com" -__license__ = "Apache License, Version 2.0" - def split_host(host: str, port: Union[int, None] = None) -> Tuple[str, int]: """Split a host:port string or host, port params into a host,port tuple.""" diff --git a/setup.cfg b/setup.cfg index 4f68920..c9c674b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,4 +1,5 @@ # Setup configuration for the Python Team Awareness Kit (PyTAK) Module. +# setup.cfg from https://github.com/snstac/pytak # # Copyright Sensors & Signals LLC https://www.snstac.com # @@ -23,8 +24,8 @@ project_urls = GitHub: issues = https://github.com/snstac/pytak/issues GitHub: repo = https://github.com/snstac/pytak description = PyTAK: Python Team Awareness Kit Module -long_description = file: README.rst -long_description_content_type = text/x-rst +long_description = file: README.md +long_description_content_type = text/markdown maintainer = Greg Albrecht maintainer_email = oss@undef.net license = Apache 2.0 diff --git a/stdeb.cfg b/stdeb.cfg new file mode 100644 index 0000000..e5ac5c5 --- /dev/null +++ b/stdeb.cfg @@ -0,0 +1,4 @@ +[DEFAULT] +Package3: pytak +Replaces3: python3-pytak +Depends3: python3-cryptography \ No newline at end of file