Skip to content

Commit 3c8c9d6

Browse files
committed
Convert to Python 3 (#1)
1 parent 0536276 commit 3c8c9d6

26 files changed

+1358
-1009
lines changed

.github/workflows/pythontest.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Python Test
5+
6+
on:
7+
push:
8+
branches:
9+
- '**'
10+
pull_request:
11+
branches: [ master ]
12+
13+
jobs:
14+
build:
15+
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
python-version: [3.5, 3.6, 3.7, 3.8]
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v1
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
- name: Lint
31+
run: |
32+
pip install pylint
33+
pylint -rn --errors-only ./smpp
34+
- name: Test
35+
env:
36+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
37+
run: |
38+
pip install coveralls pytest-cov
39+
pytest --cov=smpp tests/
40+
coveralls

.travis.yml

-8
This file was deleted.

LICENSE

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,4 @@ Copyright 2009-2010 Mozes, Inc.
1010
distributed under the License is distributed on an "AS IS" BASIS,
1111
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expressed or implied.
1212
See the License for the specific language governing permissions and
13-
limitations under the License.
14-
15-
With the exception of namedtuple.py which is licensed under the Python
16-
Software Foundation license: http://www.opensource.org/licenses/PythonSoftFoundation
13+
limitations under the License.

README.markdown README.md

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1-
smpp.pdu is a Python library for parsing Protocol Data Units (PDUs) in SMPP protocol
1+
# smpp.pdu
22

3+
smpp.pdu is a Python library for parsing Protocol Data Units (PDUs) in SMPP protocol
34
http://www.nowsms.com/discus/messages/1/24856.html
45

6+
[![Tests](https://github.com/DomAmato/smpp.pdu/workflows/Python%20Test/badge.svg)](https://github.com/DomAmato/smpp.pdu/actions)
7+
[![Coverage Status](https://coveralls.io/repos/github/DomAmato/smpp.pdu/badge.svg?branch=master)](https://coveralls.io/github/DomAmato/smpp.pdu?branch=master)
8+
59
Examples
610
========
711

812
Decoding (parsing) PDUs
913
--------------------------
1014
import binascii
11-
import StringIO
15+
from io import BytesIO
1216
from smpp.pdu.pdu_encoding import PDUEncoder
1317

1418
hex = '0000004d00000005000000009f88f12441575342440001013136353035353531323334000101313737333535353430373000000000000000000300117468657265206973206e6f2073706f6f6e'
1519
binary = binascii.a2b_hex(hex)
16-
file = StringIO.StringIO(binary)
20+
file = BytesIO(binary)
1721

1822
pdu = PDUEncoder().decode(file)
19-
print "PDU: %s" % pdu
23+
print("PDU: %s" % pdu)
2024

2125
# Prints the following:
2226
#
@@ -63,11 +67,11 @@ Creating and encoding PDUs
6367
data_coding=DataCoding(DataCodingScheme.GSM_MESSAGE_CLASS, DataCodingGsmMsg(DataCodingGsmMsgCoding.DEFAULT_ALPHABET, DataCodingGsmMsgClass.CLASS_2)),
6468
short_message='HELLO',
6569
)
66-
print "PDU: %s" % pdu
70+
print("PDU: %s" % pdu)
6771

6872
binary = PDUEncoder().encode(pdu)
6973
hexStr = binascii.b2a_hex(binary)
70-
print "HEX: %s" % hexStr
74+
print("HEX: %s" % hexStr)
7175

7276
# Prints the following:
7377
#

requirements.txt

-1
This file was deleted.

setup.py

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,32 @@
11
import os
2-
from setuptools import setup, find_packages
3-
from pkg_resources import resource_string
42

53
from setuptools import setup, find_packages
4+
65
setup(
76
name = "smpp.pdu",
87
version = "0.3",
98
author = "Roger Hoover",
109
author_email = "roger.hoover@gmail.com",
1110
description = "Library for parsing Protocol Data Units (PDUs) in SMPP protocol",
1211
license = 'Apache License 2.0',
13-
packages = find_packages(),
14-
long_description=resource_string(__name__, 'README.markdown'),
12+
packages = find_packages(exclude=["tests"]),
1513
keywords = "smpp pdu",
1614
url = "https://github.com/mozes/smpp.pdu",
1715
py_modules=["smpp.pdu"],
1816
include_package_data = True,
19-
package_data={'smpp.pdu': ['README.markdown']},
20-
zip_safe = False,
21-
install_requires = [
22-
'enum',
23-
],
24-
test_suite = 'smpp.pdu.tests',
17+
zip_safe = False,
2518
classifiers=[
2619
"Development Status :: 5 - Production/Stable",
2720
"Topic :: System :: Networking",
2821
"Operating System :: OS Independent",
2922
"License :: OSI Approved :: Apache Software License",
3023
"Intended Audience :: Developers",
3124
"Programming Language :: Python",
25+
'Programming Language :: Python :: 3',
26+
'Programming Language :: Python :: 3.5',
27+
'Programming Language :: Python :: 3.6',
28+
'Programming Language :: Python :: 3.7',
29+
'Programming Language :: Python :: 3.8',
3230
"Topic :: Software Development :: Libraries :: Python Modules",
3331
],
3432
)

smpp/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
"""
16-
__import__('pkg_resources').declare_namespace(__name__)
16+
__path__ = __import__('pkgutil').extend_path(__path__, __name__)

0 commit comments

Comments
 (0)