Skip to content

Commit f51658a

Browse files
committed
Happy Summer Solstice
- Fixes #72: Add a config variable for users to set expected CN when using CA verification. Thanks @ahoenerBE - Added configuration parameter: PYTAK_TLS_SERVER_EXPECTED_HOSTNAME - Rewrote GitHub actions, moved most logic to shell script and Makefile. - Renamed Debian package from python3-pytak to pytak. - Standardized Makefile for all PyTAK based programs. - Cleaned, simplified and expanded documentation. - Created Makefile jobs for Debian packaging and PyTAK customization. - Moved all media to media sub directory under docs/. - Converted README.rst to README.md. - Style & Linting of code. - Refactored TLS client creation, abstracted many functions. - Added TLS client cert and key checks and improved error messages.
1 parent 5d8b25f commit f51658a

22 files changed

+124
-111
lines changed

.github/workflows/debian.yml

+13-27
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build Debian package
1+
name: Build Debian Package
22

33
on:
44
push:
@@ -10,38 +10,24 @@ env:
1010

1111
jobs:
1212
build-artifact:
13-
runs-on: ubuntu-latest
13+
runs-on: ubuntu-20.04
1414

1515
steps:
1616
- uses: actions/checkout@master
1717

18-
- name: Install packaging dependencies
19-
run: |
20-
sudo apt-get update -qq
21-
sudo apt-get install -y \
22-
python3 python3-dev python3-pip python3-venv python3-all \
23-
dh-python debhelper devscripts dput software-properties-common \
24-
python3-distutils python3-setuptools python3-wheel python3-stdeb
25-
26-
- name: Build Debian/Apt sdist_dsc
27-
run: |
28-
rm -Rf deb_dist/*
29-
python3 setup.py --command-packages=stdeb.command sdist_dsc
30-
31-
- name: Build Debian/Apt bdist_deb
32-
run: |
33-
export REPO_NAME=$(echo ${{ github.repository }} | awk -F"/" '{print $2}')
34-
python3 setup.py --command-packages=stdeb.command bdist_deb
35-
ls -al deb_dist/
36-
cp deb_dist/python3-${REPO_NAME}_*_all.deb deb_dist/python3-${REPO_NAME}_latest_all.deb
37-
38-
- uses: actions/upload-artifact@master
18+
- name: Install Debian Package Building Dependencies
19+
run: sudo bash debian/install_pkg_build_deps.sh
20+
21+
- name: Create Debian Package
22+
run: make clean package
23+
24+
- name: Upload Artifacts to GitHub
25+
uses: actions/upload-artifact@master
3926
with:
4027
name: artifact-deb
41-
path: |
42-
deb_dist/*.deb
28+
path: deb_dist/*.deb
4329

44-
- name: Create Release
30+
- name: Create GitHub Release
4531
id: create_release
4632
uses: actions/create-release@master
4733
env:
@@ -52,7 +38,7 @@ jobs:
5238
draft: false
5339
prerelease: false
5440

55-
- name: Upload Release Asset
41+
- name: Upload Release Asset to GitHub
5642
id: upload-release-asset
5743
uses: svenstaro/upload-release-action@v2
5844
with:

CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
## TAKProto 3.0.0
2+
3+
Happy Summer Solstice!
4+
5+
- Fixes #15: Time data from iTak not parsed.
6+
- Fixes #12: Add CHANGELOG
7+
- Fixes #19: Support timestamps without microseconds. Thanks @sei-jmattson
8+
- Fixes #17/#18: Support mixed-mode rx. Thanks @sei-jmattson
9+
- Fixes #16: Fix datetime parsing for newer TAK clients that don't include microseconds in the timestamp. Thanks @brian7704
10+
- Rewrote GitHub actions, moved most logic to shell script and Makefile.
11+
- Renamed Debian package from python3-takproto to takproto.
12+
- Standardized Makefile for all PyTAK based programs.
13+
- Cleaned, simplified and expanded documentation.
14+
- Created Makefile jobs for Debian packaging and TAKProto customization.
15+
- Moved all media to media sub directory under docs/.
16+
- Converted README.rst to README.md.
17+
- Style & Linting of code.
18+
119
## TAKProto 2.1.1
220

321
- Fixes #12: Add Changelog.

Makefile

+37-21
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1+
# Makefile from https://github.com/snstac/pytak
2+
# PyTAK Makefile
13
#
2-
# Copyright Sensors & Signals LLC https://www.snstac.com
4+
# Copyright Sensors & Signals LLC https://www.snstac.com/
35
#
46
# Licensed under the Apache License, Version 2.0 (the "License");
57
# you may not use this file except in compliance with the License.
6-
# You may obtain a copy of the License at
7-
#
8-
# http://www.apache.org/licenses/LICENSE-2.0
8+
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
99
#
1010
# Unless required by applicable law or agreed to in writing, software
1111
# distributed under the License is distributed on an "AS IS" BASIS,
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
# Author:: Greg Albrecht <[email protected]>
17-
# Copyright:: Copyright Sensors & Signals LLC https://www.snstac.com
18-
# License:: Apache License, Version 2.0
19-
#
2016

21-
this_app = takproto
22-
.DEFAULT_GOAL := all
17+
REPO_NAME ?= $(shell echo $(wildcard */classes.py) | awk -F'/' '{print $$1}')
18+
SHELL := /bin/bash
19+
.DEFAULT_GOAL := editable
20+
# postinst = $(wildcard debian/*.postinst.sh)
21+
# service = $(wildcard debian/*.service)
2322

24-
all: editable
23+
prepare:
24+
mkdir -p build/
2525

2626
develop:
2727
python3 setup.py develop
@@ -30,13 +30,13 @@ editable:
3030
python3 -m pip install -e .
3131

3232
install_test_requirements:
33-
python3 -m pip install -r requirements_test.txt
33+
python3 -m pip install -r requirements_test.txt
3434

3535
install:
3636
python3 setup.py install
3737

3838
uninstall:
39-
python3 -m pip uninstall -y $(this_app)
39+
python3 -m pip uninstall -y $(REPO_NAME)
4040

4141
reinstall: uninstall install
4242

@@ -47,16 +47,16 @@ clean:
4747
@rm -rf *.egg* build dist *.py[oc] */*.py[co] cover doctest_pypi.cfg \
4848
nosetests.xml pylint.log output.xml flake8.log tests.log \
4949
test-result.xml htmlcov fab.log .coverage __pycache__ \
50-
*/__pycache__ .mypy_cache .pytest_cache
50+
*/__pycache__ deb_dist .mypy_cache
5151

5252
pep8:
53-
flake8 --max-line-length=88 --extend-ignore=E203,E231 --exit-zero $(this_app)/*.py
53+
flake8 --max-line-length=88 --extend-ignore=E203 --exit-zero $(REPO_NAME)/*.py
5454

5555
flake8: pep8
5656

5757
lint:
5858
pylint --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \
59-
--max-line-length=88 -r n $(this_app)/*.py || exit 0
59+
--max-line-length=88 -r n $(REPO_NAME)/*.py || exit 0
6060

6161
pylint: lint
6262

@@ -72,7 +72,7 @@ pytest:
7272
test: editable install_test_requirements pytest
7373

7474
test_cov:
75-
pytest --cov=$(this_app) --cov-report term-missing
75+
pytest --cov=$(REPO_NAME) --cov-report term-missing
7676

7777
black:
7878
black .
@@ -81,7 +81,23 @@ mkdocs:
8181
pip install -r docs/requirements.txt
8282
mkdocs serve
8383

84-
proto:
85-
for p in src-protobuf/*.proto; do \
86-
protoc -v -I=src-protobuf --python_out=takprotobuf/proto $$p; \
87-
done
84+
deb_dist:
85+
python3 setup.py --command-packages=stdeb.command sdist_dsc
86+
87+
deb_custom:
88+
cp debian/$(REPO_NAME).conf $(wildcard deb_dist/*/debian)/$(REPO_NAME).default
89+
cp debian/$(REPO_NAME).postinst $(wildcard deb_dist/*/debian)/$(REPO_NAME).postinst
90+
cp debian/$(REPO_NAME).service $(wildcard deb_dist/*/debian)/$(REPO_NAME).service
91+
92+
bdist_deb: deb_dist deb_custom
93+
cd deb_dist/$(REPO_NAME)-*/ && dpkg-buildpackage -rfakeroot -uc -us
94+
95+
faux_latest:
96+
cp deb_dist/$(REPO_NAME)_*-1_all.deb deb_dist/$(REPO_NAME)_latest_all.deb
97+
cp deb_dist/$(REPO_NAME)_*-1_all.deb deb_dist/python3-$(REPO_NAME)_latest_all.deb
98+
99+
package: bdist_deb faux_latest
100+
101+
extract:
102+
dpkg-deb -e $(wildcard deb_dist/*latest_all.deb) deb_dist/extract
103+
dpkg-deb -x $(wildcard deb_dist/*latest_all.deb) deb_dist/extract

README.rst README.md

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
.. image:: https://takproto.readthedocs.io/en/latest/atak_screenshot_with_pytak_logo-x25.jpg
2-
:alt: ATAK Screenshot with PyTAK Logo.
3-
:target: https://github.com/snstac/takproto/blob/main/docs/atak_screenshot_with_pytak_logo.jpg
1+
![ATAK Screenshot with PyTAK Logo.](https://takproto.readthedocs.io/en/latest/media/atak_screenshot_with_pytak_logo-x25.jpg)
42

5-
TAKProto: TAK Protocol Python Module
6-
************************************
3+
# Send & Receive data from TAK with Python
74

8-
TAKProto is a Python module for encoding & decoding TAK Protocol Payloads, for use with `TAK Products <https://tak.gov/>`_ including ATAK, WinTAK, iTAK, TAKX, TAK Tracker & TAK Server. TAKProto includes functions for converting TAK Protocol Protobuf messages to Python objects, and serializing CoT XML messages as Protobuf.
5+
TAKProto is a Python module for encoding & decoding TAK Protocol Payloads, for use
6+
with [TAK Products](https://www.tak.gov/) including ATAK, WinTAK, iTAK, TAKX, TAK
7+
Tracker & TAK Server. TAKProto includes functions for converting TAK Protocol
8+
Protobuf messages to Python objects, and serializing CoT XML messages as Protobuf.
99

10-
`Documentation is available here. <https://takproto.rtfd.io/>`_
10+
[Documentation is available here.](https://takproto.rtfd.io/)
1111

12-
License
13-
=======
12+
## Copyright & License
1413
Copyright Sensors & Signals LLC https://www.snstac.com
1514

1615
Copyright 2020 Delta Bravo-15 <[email protected]>

debian/install_pkg_build_deps.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
echo "Installing Debian package build dependencies"
4+
5+
apt-get update -qq
6+
7+
apt-get install -y \
8+
python3 python3-dev python3-pip python3-venv python3-all \
9+
dh-python debhelper devscripts dput software-properties-common \
10+
python3-distutils python3-setuptools python3-wheel python3-stdeb

debian/pytak.conf

Whitespace-only changes.

debian/pytak.postinst

Whitespace-only changes.

debian/pytak.service

Whitespace-only changes.

docs/index.md

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
1-
2-
![ATAK Screenshot with PyTAK Logo.](atak_screenshot_with_pytak_logo-x25.jpg)
3-
4-
# TAKProto - Send & Receive Team Awareness Kit (TAK) packets with Python.
5-
6-
TAKProto is a Python module for encoding & decoding TAK Protocol Payloads, for use with [TAK Products](https://tak.gov) including ATAK, WinTAK, iTAK, TAKX, TAK Tracker & TAK Server. TAKProto includes functions for converting TAK Protocol Protobuf messages to Python objects, and serializing CoT XML messages as Protobuf.
7-
8-
[Documentation is available here.](https://takproto.rtfd.io)
9-
1+
{!README.md!}

docs/installation.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
## Install on Debian, Ubuntu or Raspberry Pi
22

3-
TAKProto is distributed as a Debian package (``.deb``). takproto should be compatible with most contemporary system-Python versions from Python 3.6 onward.
3+
TAKProto is distributed as a Debian package (``.deb``). takproto should be compatible
4+
with most contemporary system-Python versions from Python 3.6 onward.
45

56
To install takproto, download the takproto package and install using apt:
67

78
```sh linenums="1"
8-
sudo apt update -y
9-
wget https://github.com/snstac/takproto/releases/latest/download/python3-takproto_latest_all.deb
10-
sudo apt install -f ./python3-takproto_latest_all.deb
9+
sudo apt update -qq
10+
wget https://github.com/snstac/takproto/releases/latest/download/takproto_latest_all.deb
11+
sudo apt install -f ./takproto_latest_all.deb
1112
```
1213

1314
## Install from Python Package Index (PyPI)
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/tak_protocols.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ TAK Products configured for connecting to a TAK Server will send TAK Protocol Ve
1515

1616
The `takproto` module supports encoding and decoding all 3 formats of CoT messages.
1717

18-
![TAK Protocol Chart](takproto_chart.png)
18+
![TAK Protocol Chart](media/takproto_chart.png)

mkdocs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
site_name: TAKProto - Send & Receive Team Awareness Kit (TAK) packets with Python.
1+
site_name: A Python package for the TAK Protocol.
22
site_url: https://takproto.rtfd.io/
33
repo_url: https://github.com/snstac/takproto/
44
site_description: A Python module to encode & decode Team Awareness Kit (TAK) Protocol-based Cursor on Target (CoT) messages.

setup.cfg

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Setup for the Python TAK Protocol Packet - Version 1 Module.
2+
# setup.cfg from https://github.com/snstac/takproto
23
#
34
# Copyright Sensors & Signals LLC https://www.snstac.com
45
# Copyright 2020 Delta Bravo-15
@@ -31,9 +32,9 @@ project_urls =
3132
CI: GitHub Actions = https://github.com/snstac/takproto/actions
3233
GitHub: issues = https://github.com/snstac/takproto/issues
3334
GitHub: repo = https://github.com/snstac/takproto
34-
description = A Python module to encode & decode 'TAK Protocol Payload - Version 1' Protocol Buffer based Cursor on Target (CoT) messages.
35-
long_description = file: README.rst
36-
long_description_content_type = text/x-rst
35+
description = TAKProto is a Python package for the TAK protocol.
36+
long_description = file: README.md
37+
long_description_content_type = text/markdown
3738
maintainer = Greg Albrecht <[email protected]>
3839
maintainer_email = [email protected]
3940
license = MIT License

setup.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
3+
# setup.py from https://github.com/snstac/takproto
34
#
45
# Copyright Sensors & Signals LLC https://www.snstac.com
56
# Copyright 2020 Delta Bravo-15
@@ -24,10 +25,7 @@
2425
#
2526

2627

27-
"""Setup for the Python TAK Protocol Packet - Version 1 Module.
28-
29-
:source: <https://github.com/snstac/takproto>
30-
"""
28+
"""Setup for the Python TAK Protocol Package."""
3129

3230
from setuptools import setup
3331

takproto/__init__.py

+5-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
3+
# __init__.py from https://github.com/snstac/takproto
34
#
45
# Copyright Sensors & Signals LLC https://www.snstac.com
56
#
@@ -22,17 +23,11 @@
2223
# SOFTWARE.
2324
#
2425

25-
"""TAKProto: Encode & Decode TAK Protocol Payloads using Python.
26+
"""TAKProto: Encode & Decode TAK Protocol Payloads using Python."""
2627

27-
:author: Greg Albrecht <[email protected]>
28-
:copyright: Copyright Sensors & Signals LLC https://www.snstac.com
29-
:license: MIT License
30-
:source: <https://github.com/snstac/takproto>
31-
"""
28+
__version__ = "3.0.0-beta1"
3229

33-
__version__ = "2.1.1"
34-
35-
# Python 3.6 test/build work-around:
30+
# COMPAT Python 3.6 import work-around.
3631
try:
3732
from .functions import ( # NOQA
3833
xml2proto,
@@ -44,12 +39,5 @@
4439
from .constants import TAKProtoVer # NOQA
4540
except ImportError as exc:
4641
import warnings
47-
warnings.warn(
48-
"Unable to import required modules, IGNORING for Python 3.6 compat. Original Exception: "
49-
)
50-
warnings.warn(str(exc))
5142

52-
__author__ = "Greg Albrecht <[email protected]>"
53-
__copyright__ = "Copyright Sensors & Signals LLC https://www.snstac.com"
54-
__license__ = "MIT License"
55-
__source__ = "https://github.com/snstac/takproto"
43+
warnings.warn(f"COMPAT Python 3.6. Ignoring Exception: {str(exc)}")

takproto/constants.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
3+
# constants.py from https://github.com/snstac/takproto
34
#
45
# Copyright Sensors & Signals LLC https://www.snstac.com
56
#
@@ -26,11 +27,6 @@
2627

2728
from enum import Enum
2829

29-
__author__ = "Greg Albrecht <[email protected]>"
30-
__copyright__ = "Copyright Sensors & Signals LLC https://www.snstac.com"
31-
__license__ = "Apache License, Version 2.0"
32-
33-
3430
DEFAULT_PROTO_HEADER = bytearray(b"\xbf")
3531
DEFAULT_MESH_HEADER = bytearray(b"\xbf\x01\xbf")
3632
DEFAULT_XML_HEADER = bytearray(b"<?xml")

0 commit comments

Comments
 (0)