Skip to content
Snippets Groups Projects
Commit f15c96ed authored by Jeffrey Phillips Freeman's avatar Jeffrey Phillips Freeman :boom:
Browse files

Got python2 and pypy tests working again.

parent 2644c52d
No related branches found
No related tags found
No related merge requests found
Showing
with 242 additions and 80 deletions
__version__ = "0.1.0" # These imports are for python3 compatability inside python2
from __future__ import print_function, unicode_literals
from __future__ import absolute_import, division
__author__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__maintainer__ = "Jeffrey Phillips Freeman (WI2ARD)"
__email__ = "jeffrey.freeman@syncleus.com"
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors'
__credits__ = []
...@@ -8,7 +8,18 @@ Why does this file exist, and why __main__? For more info, read: ...@@ -8,7 +8,18 @@ Why does this file exist, and why __main__? For more info, read:
- https://docs.python.org/2/using/cmdline.html#cmdoption-m - https://docs.python.org/2/using/cmdline.html#cmdoption-m
- https://docs.python.org/3/using/cmdline.html#cmdoption-m - https://docs.python.org/3/using/cmdline.html#cmdoption-m
""" """
# These imports are for python3 compatability inside python2
from __future__ import print_function, unicode_literals
from __future__ import absolute_import, division
from apex.cli import main from apex.cli import main
__author__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__maintainer__ = "Jeffrey Phillips Freeman (WI2ARD)"
__email__ = "jeffrey.freeman@syncleus.com"
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors'
__credits__ = []
if __name__ == "__main__": if __name__ == "__main__":
main() main()
...@@ -15,10 +15,21 @@ APRS Python Module. ...@@ -15,10 +15,21 @@ APRS Python Module.
""" """
# These imports are for python3 compatability inside python2
from __future__ import print_function, unicode_literals
from __future__ import absolute_import, division
import logging import logging
from apex.aprs.aprs_kiss import AprsKiss from apex.aprs.aprs_kiss import AprsKiss
from apex.aprs.aprs_internet_service import AprsInternetService from apex.aprs.aprs_internet_service import AprsInternetService
__author__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__maintainer__ = "Jeffrey Phillips Freeman (WI2ARD)"
__email__ = "jeffrey.freeman@syncleus.com"
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors'
__credits__ = []
# Set default logging handler to avoid "No handler found" warnings. # Set default logging handler to avoid "No handler found" warnings.
try: # Python 2.7+ try: # Python 2.7+
from logging import NullHandler from logging import NullHandler
......
...@@ -3,15 +3,22 @@ ...@@ -3,15 +3,22 @@
"""APRS Internet Service Class Definitions""" """APRS Internet Service Class Definitions"""
__author__ = 'Jeffrey Phillips Freeman WI2ARD <freemo@gmail.com>' # These imports are for python3 compatability inside python2
__license__ = 'Apache License, Version 2.0' from __future__ import print_function, unicode_literals
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors' from __future__ import absolute_import, division
import logging import logging
import socket import socket
import requests import requests
import time import time
__author__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__maintainer__ = "Jeffrey Phillips Freeman (WI2ARD)"
__email__ = "jeffrey.freeman@syncleus.com"
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors'
__credits__ = []
from apex.aprs import constants as aprsConstants, util as aprsUtil from apex.aprs import constants as aprsConstants, util as aprsUtil
......
...@@ -3,15 +3,22 @@ ...@@ -3,15 +3,22 @@
"""APRS KISS Class Definitions""" """APRS KISS Class Definitions"""
__author__ = 'Jeffrey Phillips Freeman WI2ARD <freemo@gmail.com>' # These imports are for python3 compatability inside python2
__license__ = 'Apache License, Version 2.0' from __future__ import print_function, unicode_literals
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors' from __future__ import absolute_import, division
import logging import logging
import math import math
import apex.kiss import apex.kiss
__author__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__maintainer__ = "Jeffrey Phillips Freeman (WI2ARD)"
__email__ = "jeffrey.freeman@syncleus.com"
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors'
__credits__ = []
class AprsKiss(apex.kiss.Kiss): class AprsKiss(apex.kiss.Kiss):
......
...@@ -5,13 +5,19 @@ ...@@ -5,13 +5,19 @@
Constants for APRS Module. Constants for APRS Module.
""" """
__author__ = 'Jeffrey Phillips Freeman WI2ARD <freemo@gmail.com>' # These imports are for python3 compatability inside python2
__license__ = 'Apache License, Version 2.0' from __future__ import print_function, unicode_literals
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors' from __future__ import absolute_import, division
import logging import logging
__author__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__maintainer__ = "Jeffrey Phillips Freeman (WI2ARD)"
__email__ = "jeffrey.freeman@syncleus.com"
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors'
__credits__ = []
APRSIS_URL = 'http://srvr.aprs-is.net:8080' APRSIS_URL = 'http://srvr.aprs-is.net:8080'
APRSIS_HTTP_HEADERS = { APRSIS_HTTP_HEADERS = {
......
...@@ -48,14 +48,20 @@ $ python decimaldegrees.py [-v] ...@@ -48,14 +48,20 @@ $ python decimaldegrees.py [-v]
""" """
# These imports are for python3 compatability inside python2
__revision__ = '$Revision: 1.1 $' from __future__ import print_function, unicode_literals
from __future__ import absolute_import, division
import decimal as libdecimal import decimal as libdecimal
from decimal import Decimal as D from decimal import Decimal as D
__author__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__maintainer__ = "Jeffrey Phillips Freeman (WI2ARD)"
__email__ = "jeffrey.freeman@syncleus.com"
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors'
__credits__ = []
def decimal2dms(decimal_degrees): def decimal2dms(decimal_degrees):
""" Converts a floating point number of degrees to the equivalent """ Converts a floating point number of degrees to the equivalent
......
...@@ -3,17 +3,24 @@ ...@@ -3,17 +3,24 @@
"""Utilities for the APRS Python Module.""" """Utilities for the APRS Python Module."""
__author__ = 'Jeffrey Phillips Freeman WI2ARD <freemo@gmail.com>' # These imports are for python3 compatability inside python2
__license__ = 'Apache License, Version 2.0' from __future__ import print_function, unicode_literals
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors' from __future__ import absolute_import, division
import logging import logging
import unicodedata
import sys
import apex.aprs.constants import apex.aprs.constants
import apex.aprs.decimaldegrees import apex.aprs.decimaldegrees
import apex.kiss.constants import apex.kiss.constants
import math
__author__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__maintainer__ = "Jeffrey Phillips Freeman (WI2ARD)"
__email__ = "jeffrey.freeman@syncleus.com"
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors'
__credits__ = []
def dec2dm_lat(dec): def dec2dm_lat(dec):
...@@ -38,7 +45,11 @@ def dec2dm_lat(dec): ...@@ -38,7 +45,11 @@ def dec2dm_lat(dec):
else: else:
suffix = 'N' suffix = 'N'
return ''.join([str(abs_deg), "%.2f" % dec_min[1], suffix]) retval = ''.join([str(abs_deg), "%.2f" % dec_min[1], suffix])
if sys.version_info < (3, 0):
retval = unicodedata.normalize('NFKD', retval).encode('ascii', 'ignore')
return retval
def dec2dm_lng(dec): def dec2dm_lng(dec):
...@@ -61,7 +72,11 @@ def dec2dm_lng(dec): ...@@ -61,7 +72,11 @@ def dec2dm_lng(dec):
else: else:
suffix = 'E' suffix = 'E'
return ''.join([str(abs_deg), "%.2f" % dec_min[1], suffix]) retval = ''.join([str(abs_deg), "%.2f" % dec_min[1], suffix])
if sys.version_info < (3, 0):
retval = unicodedata.normalize('NFKD', retval).encode('ascii', 'ignore')
return retval
def decode_aprs_ascii_frame(ascii_frame): def decode_aprs_ascii_frame(ascii_frame):
......
...@@ -14,20 +14,32 @@ Why does this file exist, and why not put this in __main__? ...@@ -14,20 +14,32 @@ Why does this file exist, and why not put this in __main__?
Also see (1) from http://click.pocoo.org/5/setuptools/#setuptools-integration Also see (1) from http://click.pocoo.org/5/setuptools/#setuptools-integration
""" """
__author__ = 'Jeffrey Phillips Freeman WI2ARD <freemo@gmail.com>' # These imports are for python3 compatability inside python2
__license__ = 'Apache License, Version 2.0' from __future__ import print_function, unicode_literals
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors' from __future__ import absolute_import, division
import sys
import click import click
import time import time
import signal import signal
import sys import sys
import threading import threading
import configparser
import cachetools import cachetools
import traceback import traceback
from apex.pluginloader import getPlugins, loadPlugin from apex.pluginloader import getPlugins, loadPlugin
if sys.version_info < (3, 0):
import ConfigParser
elif sys.version_info >= (3, 0):
import configparser
__author__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__maintainer__ = "Jeffrey Phillips Freeman (WI2ARD)"
__email__ = "jeffrey.freeman@syncleus.com"
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors'
__credits__ = []
from apex.kiss import constants as kissConstants from apex.kiss import constants as kissConstants
import apex.aprs import apex.aprs
......
...@@ -15,14 +15,20 @@ KISS Python Module. ...@@ -15,14 +15,20 @@ KISS Python Module.
""" """
__author__ = 'Jeffrey Phillips Freeman WI2ARD <freemo@gmail.com>' # These imports are for python3 compatability inside python2
__license__ = 'Apache License, Version 2.0' from __future__ import print_function, unicode_literals
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors' from __future__ import absolute_import, division
import logging import logging
from .kiss import Kiss from .kiss import Kiss
__author__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__maintainer__ = "Jeffrey Phillips Freeman (WI2ARD)"
__email__ = "jeffrey.freeman@syncleus.com"
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors'
__credits__ = []
# Set default logging handler to avoid "No handler found" warnings. # Set default logging handler to avoid "No handler found" warnings.
try: # Python 2.7+ try: # Python 2.7+
......
...@@ -3,13 +3,19 @@ ...@@ -3,13 +3,19 @@
"""Constants for KISS Python Module.""" """Constants for KISS Python Module."""
__author__ = 'Jeffrey Phillips Freeman WI2ARD <freemo@gmail.com>' # These imports are for python3 compatability inside python2
__license__ = 'Apache License, Version 2.0' from __future__ import print_function, unicode_literals
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors' from __future__ import absolute_import, division
import logging import logging
__author__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__maintainer__ = "Jeffrey Phillips Freeman (WI2ARD)"
__email__ = "jeffrey.freeman@syncleus.com"
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors'
__credits__ = []
LOG_LEVEL = logging.DEBUG LOG_LEVEL = logging.DEBUG
LOG_FORMAT = ('%(asctime)s %(levelname)s %(name)s.%(funcName)s:%(lineno)d' LOG_FORMAT = ('%(asctime)s %(levelname)s %(name)s.%(funcName)s:%(lineno)d'
...@@ -56,4 +62,4 @@ MODE_END = [192, 255, 192, 13] ...@@ -56,4 +62,4 @@ MODE_END = [192, 255, 192, 13]
MODE_INIT_W8DED = [13, 27, 64, 75, 13] MODE_INIT_W8DED = [13, 27, 64, 75, 13]
MODE_INIT_LINKNORD = MODE_INIT_W8DED MODE_INIT_LINKNORD = MODE_INIT_W8DED
#This will work for any Kenwood D710 #This will work for any Kenwood D710
MODE_INIT_KENWOOD_D710 = [72,66,32,49,50,48,48,13,75,73,83,83,32,79,78,13,82,69,83,84,65,82,84,13] MODE_INIT_KENWOOD_D710 = [72,66,32,49,50,48,48,13,75,73,83,83,32,79,78,13,82,69,83,84,65,82,84,13]
\ No newline at end of file
...@@ -3,16 +3,22 @@ ...@@ -3,16 +3,22 @@
"""KISS Core Classes.""" """KISS Core Classes."""
__author__ = 'Jeffrey Phillips Freeman WI2ARD <freemo@gmail.com>' # These imports are for python3 compatability inside python2
__license__ = 'Apache License, Version 2.0' from __future__ import print_function, unicode_literals
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors' from __future__ import absolute_import, division
import logging import logging
import serial import serial
import socket import socket
from apex.kiss import constants as kissConstants from apex.kiss import constants as kissConstants
__author__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__maintainer__ = "Jeffrey Phillips Freeman (WI2ARD)"
__email__ = "jeffrey.freeman@syncleus.com"
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors'
__credits__ = []
class Kiss(object): class Kiss(object):
......
...@@ -3,13 +3,19 @@ ...@@ -3,13 +3,19 @@
"""Utilities for the KISS Python Module.""" """Utilities for the KISS Python Module."""
__author__ = 'Jeffrey Phillips Freeman WI2ARD <freemo@gmail.com>' # These imports are for python3 compatability inside python2
__license__ = 'Apache License, Version 2.0' from __future__ import print_function, unicode_literals
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors' from __future__ import absolute_import, division
import apex.kiss.constants import apex.kiss.constants
__author__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__maintainer__ = "Jeffrey Phillips Freeman (WI2ARD)"
__email__ = "jeffrey.freeman@syncleus.com"
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors'
__credits__ = []
def extract_ui(frame): def extract_ui(frame):
""" """
Extracts the UI component of an individual frame. Extracts the UI component of an individual frame.
......
# These imports are for python3 compatability inside python2
from __future__ import print_function, unicode_literals
from __future__ import absolute_import, division
import importlib import importlib
import importlib.util
import importlib.machinery
import os import os
__author__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__maintainer__ = "Jeffrey Phillips Freeman (WI2ARD)"
__email__ = "jeffrey.freeman@syncleus.com"
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors'
__credits__ = []
PluginFolder = "./plugins" PluginFolder = "./plugins"
MainModule = "__init__" MainModule = "__init__"
...@@ -18,4 +27,4 @@ def getPlugins(): ...@@ -18,4 +27,4 @@ def getPlugins():
return plugins return plugins
def loadPlugin(plugin): def loadPlugin(plugin):
return importlib.import_module("plugins." + plugin) return importlib.import_module("plugins." + plugin)
\ No newline at end of file
# These imports are for python3 compatability inside python2
from __future__ import print_function, unicode_literals
from __future__ import absolute_import, division
import apex.aprs.util import apex.aprs.util
import copy import copy
import re import re
__author__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__maintainer__ = "Jeffrey Phillips Freeman (WI2ARD)"
__email__ = "jeffrey.freeman@syncleus.com"
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors'
__credits__ = []
plugin = None plugin = None
def start(config, port_map, packet_cache, aprsis): def start(config, port_map, packet_cache, aprsis):
......
# These imports are for python3 compatability inside python2
from __future__ import print_function, unicode_literals
from __future__ import absolute_import, division
import apex.aprs.util import apex.aprs.util
import time import time
__author__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__maintainer__ = "Jeffrey Phillips Freeman (WI2ARD)"
__email__ = "jeffrey.freeman@syncleus.com"
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors'
__credits__ = []
plugin = None plugin = None
def start(config, port_map, packet_cache, aprsis): def start(config, port_map, packet_cache, aprsis):
......
# These imports are for python3 compatability inside python2
from __future__ import print_function, unicode_literals
from __future__ import absolute_import, division
import apex.aprs.util import apex.aprs.util
import time import time
__author__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__maintainer__ = "Jeffrey Phillips Freeman (WI2ARD)"
__email__ = "jeffrey.freeman@syncleus.com"
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors'
__credits__ = []
plugin = None plugin = None
def start(config, port_map, packet_cache, aprsis): def start(config, port_map, packet_cache, aprsis):
......
# These imports are for python3 compatability inside python2
from __future__ import print_function, unicode_literals
from __future__ import absolute_import, division
import apex.aprs.util import apex.aprs.util
import time import time
__author__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__maintainer__ = "Jeffrey Phillips Freeman (WI2ARD)"
__email__ = "jeffrey.freeman@syncleus.com"
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors'
__credits__ = []
plugin = None plugin = None
def start(config, port_map, packet_cache, aprsis): def start(config, port_map, packet_cache, aprsis):
......
...@@ -2,16 +2,16 @@ ...@@ -2,16 +2,16 @@
envlist = envlist =
clean, clean,
check, check,
; 2.7-cover, 2.7-cover,
; 2.7-nocov, 2.7-nocov,
3.3-cover, 3.3-cover,
3.3-nocov, 3.3-nocov,
3.4-cover, 3.4-cover,
3.4-nocov, 3.4-nocov,
3.5-cover, 3.5-cover,
3.5-nocov, 3.5-nocov,
; pypy-cover, pypy-cover,
; pypy-nocov, pypy-nocov,
report, report,
docs docs
...@@ -114,20 +114,20 @@ skip_install = true ...@@ -114,20 +114,20 @@ skip_install = true
usedevelop = false usedevelop = false
deps = coverage deps = coverage
;[testenv:2.7-cover] [testenv:2.7-cover]
;basepython = {env:TOXPYTHON:python2.7} basepython = {env:TOXPYTHON:python2.7}
;setenv = setenv =
; {[testenv]setenv} {[testenv]setenv}
; WITH_COVERAGE=yes WITH_COVERAGE=yes
;usedevelop = true usedevelop = true
;commands = commands =
; {posargs:py.test --cov --cov-report=term-missing -vv} {posargs:py.test --cov --cov-report=term-missing -vv}
;deps = deps =
; {[testenv]deps} {[testenv]deps}
; pytest-cov pytest-cov
;
;[testenv:2.7-nocov] [testenv:2.7-nocov]
;basepython = {env:TOXPYTHON:python2.7} basepython = {env:TOXPYTHON:python2.7}
[testenv:3.3-cover] [testenv:3.3-cover]
basepython = {env:TOXPYTHON:python3.3} basepython = {env:TOXPYTHON:python3.3}
...@@ -174,20 +174,20 @@ deps = ...@@ -174,20 +174,20 @@ deps =
[testenv:3.5-nocov] [testenv:3.5-nocov]
basepython = {env:TOXPYTHON:python3.5} basepython = {env:TOXPYTHON:python3.5}
;[testenv:pypy-cover] [testenv:pypy-cover]
;basepython = {env:TOXPYTHON:pypy} basepython = {env:TOXPYTHON:pypy}
;setenv = setenv =
; {[testenv]setenv} {[testenv]setenv}
; WITH_COVERAGE=yes WITH_COVERAGE=yes
;usedevelop = true usedevelop = true
;commands = commands =
; {posargs:py.test --cov --cov-report=term-missing -vv} {posargs:py.test --cov --cov-report=term-missing -vv}
;deps = deps =
; {[testenv]deps} {[testenv]deps}
; pytest-cov pytest-cov
;
;[testenv:pypy-nocov] [testenv:pypy-nocov]
;basepython = {env:TOXPYTHON:pypy} basepython = {env:TOXPYTHON:pypy}
;
;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment