From 084bef303f8d664a6a1adcc4c6448f631c197384 Mon Sep 17 00:00:00 2001 From: Greg Albrecht Date: Mon, 3 Feb 2025 14:23:53 -0800 Subject: [PATCH] moving version to a file, updating makefile --- Makefile | 8 ++++---- setup.cfg | 14 +++++--------- {pytak => src/pytak}/__init__.py | 2 -- {pytak => src/pytak}/asyncio_dgram/LICENSE | 0 {pytak => src/pytak}/asyncio_dgram/__init__.py | 0 {pytak => src/pytak}/asyncio_dgram/aio.py | 0 {pytak => src/pytak}/classes.py | 0 {pytak => src/pytak}/client_functions.py | 0 {pytak => src/pytak}/commands.py | 0 {pytak => src/pytak}/constants.py | 0 {pytak => src/pytak}/crypto_functions.py | 0 {pytak => src/pytak}/functions.py | 5 +++-- tests/test_functions.py | 4 +--- 13 files changed, 13 insertions(+), 20 deletions(-) rename {pytak => src/pytak}/__init__.py (98%) rename {pytak => src/pytak}/asyncio_dgram/LICENSE (100%) rename {pytak => src/pytak}/asyncio_dgram/__init__.py (100%) rename {pytak => src/pytak}/asyncio_dgram/aio.py (100%) rename {pytak => src/pytak}/classes.py (100%) rename {pytak => src/pytak}/client_functions.py (100%) rename {pytak => src/pytak}/commands.py (100%) rename {pytak => src/pytak}/constants.py (100%) rename {pytak => src/pytak}/crypto_functions.py (100%) rename {pytak => src/pytak}/functions.py (97%) diff --git a/Makefile b/Makefile index 982a4d8..085d3b1 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ # limitations under the License. # -REPO_NAME ?= $(shell echo $(wildcard */__init__.py) | awk -F'/' '{print $$1}') +REPO_NAME ?= $(shell echo $(wildcard src/*/__init__.py) | awk -F'/' '{print $$2}') SHELL := /bin/bash .DEFAULT_GOAL := editable # postinst = $(wildcard debian/*.postinst.sh) @@ -47,7 +47,7 @@ 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__ deb_dist .mypy_cache + */__pycache__ deb_dist .mypy_cache .pytest_cache pep8: flake8 --max-line-length=88 --extend-ignore=E203 --exit-zero $(REPO_NAME)/*.py @@ -67,12 +67,12 @@ mypy: mypy --strict . pytest: - pytest + python3 -m pytest test: editable install_test_requirements pytest test_cov: - pytest --cov=$(REPO_NAME) --cov-report term-missing + python3 -m pytest --cov=$(REPO_NAME) --cov-report term-missing black: black . diff --git a/setup.cfg b/setup.cfg index 9196a67..846ab23 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,7 +17,7 @@ [metadata] name = pytak -version = attr: pytak.__version__ +version = file: src/pytak/VERSION url = https://github.com/snstac/pytak project_urls = CI: GitHub Actions = https://github.com/snstac/pytak/actions @@ -30,17 +30,15 @@ maintainer = Greg Albrecht maintainer_email = oss@undef.net license = Apache 2.0 license_files = LICENSE +authors = + { name="Greg Albrecht", email="oss@undef.net" } +requires_python = ">=3.7" 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.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 Development Status :: 5 - Production/Stable Operating System :: POSIX Operating System :: MacOS :: MacOS X @@ -55,13 +53,11 @@ keywords = TAK TAK Server - [options] +packages = find: include_package_data = True -packages = pytak, pytak.asyncio_dgram python_requires = >=3.6, <4 - [options.extras_require] with_crypto = cryptography >= 39.0.0 with_takproto = takproto >= 2.0.0 diff --git a/pytak/__init__.py b/src/pytak/__init__.py similarity index 98% rename from pytak/__init__.py rename to src/pytak/__init__.py index e7db029..25496c7 100644 --- a/pytak/__init__.py +++ b/src/pytak/__init__.py @@ -17,8 +17,6 @@ """Python Team Awareness Kit (PyTAK) Module.""" -__version__ = "7.1.0" - from .constants import ( # NOQA LOG_LEVEL, LOG_FORMAT, diff --git a/pytak/asyncio_dgram/LICENSE b/src/pytak/asyncio_dgram/LICENSE similarity index 100% rename from pytak/asyncio_dgram/LICENSE rename to src/pytak/asyncio_dgram/LICENSE diff --git a/pytak/asyncio_dgram/__init__.py b/src/pytak/asyncio_dgram/__init__.py similarity index 100% rename from pytak/asyncio_dgram/__init__.py rename to src/pytak/asyncio_dgram/__init__.py diff --git a/pytak/asyncio_dgram/aio.py b/src/pytak/asyncio_dgram/aio.py similarity index 100% rename from pytak/asyncio_dgram/aio.py rename to src/pytak/asyncio_dgram/aio.py diff --git a/pytak/classes.py b/src/pytak/classes.py similarity index 100% rename from pytak/classes.py rename to src/pytak/classes.py diff --git a/pytak/client_functions.py b/src/pytak/client_functions.py similarity index 100% rename from pytak/client_functions.py rename to src/pytak/client_functions.py diff --git a/pytak/commands.py b/src/pytak/commands.py similarity index 100% rename from pytak/commands.py rename to src/pytak/commands.py diff --git a/pytak/constants.py b/src/pytak/constants.py similarity index 100% rename from pytak/constants.py rename to src/pytak/constants.py diff --git a/pytak/crypto_functions.py b/src/pytak/crypto_functions.py similarity index 100% rename from pytak/crypto_functions.py rename to src/pytak/crypto_functions.py diff --git a/pytak/functions.py b/src/pytak/functions.py similarity index 97% rename from pytak/functions.py rename to src/pytak/functions.py index 693f166..db2701f 100644 --- a/pytak/functions.py +++ b/src/pytak/functions.py @@ -188,7 +188,7 @@ def cot2xml(event: pytak.COTEvent) -> ET.Element: point.set("ce", ce) flow_tags = ET.Element("_flow-tags_") - _ft_tag: str = f"{pytak.DEFAULT_HOST_ID}-v{pytak.__version__}".replace("@", "-") + _ft_tag: str = f"{pytak.DEFAULT_HOST_ID}-pytak".replace("@", "-") flow_tags.set(_ft_tag, pytak.cot_time()) detail = ET.Element("detail") @@ -238,7 +238,8 @@ def gen_cot_xml( point.set("ce", ce) flow_tags = ET.Element("_flow-tags_") - _ft_tag: str = f"{pytak.DEFAULT_HOST_ID}-v{pytak.__version__}".replace("@", "-") + # FIXME: Add PyTAK version to the flow tags. + _ft_tag: str = f"{pytak.DEFAULT_HOST_ID}-pytak".replace("@", "-") flow_tags.set(_ft_tag, pytak.cot_time()) detail = ET.Element("detail") diff --git a/tests/test_functions.py b/tests/test_functions.py index f8a5cda..e281be4 100644 --- a/tests/test_functions.py +++ b/tests/test_functions.py @@ -150,8 +150,6 @@ def test_cot2xml(): flow_tags_element = detail_element.find("_flow-tags_") assert flow_tags_element is not None assert ( - flow_tags_element.get( - f"{pytak.DEFAULT_HOST_ID}-v{pytak.__version__}".replace("@", "-") - ) + flow_tags_element.get(f"{pytak.DEFAULT_HOST_ID}-pytak".replace("@", "-")) is not None )