Skip to content

Commit 5ec07b7

Browse files
committed
improve the packaging
1 parent f1c3b32 commit 5ec07b7

File tree

5 files changed

+120
-76
lines changed

5 files changed

+120
-76
lines changed

MANIFEST.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
include README.md
1+
include README.rst
2+
include LICENSE

README.md

Lines changed: 0 additions & 57 deletions
This file was deleted.

README.rst

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
======================
2+
Python HDLC controller
3+
======================
4+
5+
|Build Status|
6+
7+
HDLC controller written in Python and based on the
8+
`python4yahdlc <https://github.com/SkypLabs/python4yahdlc>`__ Python
9+
module to encode and decode HDLC frames.
10+
11+
Installation
12+
============
13+
14+
With pip (recommanded)
15+
----------------------
16+
17+
::
18+
19+
pip3 install hdlcontroller
20+
21+
From sources
22+
------------
23+
24+
::
25+
26+
git clone https://github.com/SkypLabs/python-hdlc-controller.git
27+
cd python-hdlc-controller
28+
python3 setup.py install
29+
30+
Usage
31+
=====
32+
33+
To create a new HDLC controller instance, you need to call the
34+
*HDLController* class with two parameters :
35+
36+
::
37+
38+
hdlc_c = HDLController(read_func, write_func)
39+
40+
The first parameter is a function used to read from the serial bus while
41+
the second parameter is a function to write on it. For example, using
42+
the *pyserial* module :
43+
44+
::
45+
46+
ser = serial.Serial('/dev/ttyACM0')
47+
48+
def read_serial():
49+
return ser.read(ser.inWaiting())
50+
51+
hdlc_c = HDLController(read_serial, ser.write)
52+
53+
To start the reception thread :
54+
55+
::
56+
57+
hdlc_c.start()
58+
59+
To send a new data frame :
60+
61+
::
62+
63+
hdlc_c.send('Hello world!')
64+
65+
And to get the next data frame received available in the *HDLController*
66+
internal queue :
67+
68+
::
69+
70+
data = hdlc_c.get_data()
71+
72+
The *get\_data()* method will block until a new data frame is available.
73+
74+
Finally, to stop all the *HDLController* threads :
75+
76+
::
77+
78+
hdlc_c.stop()
79+
80+
License
81+
=======
82+
83+
`MIT <http://opensource.org/licenses/MIT>`__
84+
85+
.. |Build Status| image:: https://travis-ci.org/SkypLabs/python-hdlc-controller.svg
86+
:target: https://travis-ci.org/SkypLabs/python-hdlc-controller

setup.cfg

Lines changed: 0 additions & 2 deletions
This file was deleted.

setup.py

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,39 @@
11
#!/usr/bin/env python3
22

33
from setuptools import setup
4+
from os.path import dirname, abspath, join
5+
from codecs import open
46

5-
VERSION = '0.3.0'
7+
DIR = dirname(abspath(__file__))
8+
VERSION = '0.3.1'
9+
10+
with open(join(DIR, 'README.rst'), encoding='utf-8') as f:
11+
long_description = f.read()
612

713
setup(
8-
name = 'hdlcontroller',
9-
version = VERSION,
10-
description = 'HDLC controller',
11-
license = 'MIT',
12-
keywords = 'hdlc',
13-
author = 'Paul-Emmanuel Raoul',
14-
author_email = 'skyper@skyplabs.net',
15-
url = 'https://github.com/SkypLabs/python-hdlc-controller',
16-
download_url = 'https://github.com/SkypLabs/python-hdlc-controller/archive/v{0}.zip'.format(VERSION),
17-
setup_requires = ['setuptools-markdown'],
18-
long_description_markdown_filename = 'README.md',
19-
py_modules = ['hdlcontroller'],
20-
scripts = ['hdlcontroller.py'],
21-
install_requires = ['python4yahdlc>=1.0.2', 'pyserial'],
22-
test_suite = 'test',
14+
name = 'hdlcontroller',
15+
version = VERSION,
16+
description = 'HDLC controller',
17+
long_description = long_description,
18+
license = 'MIT',
19+
keywords = 'hdlc controller',
20+
author = 'Paul-Emmanuel Raoul',
21+
author_email = 'skyper@skyplabs.net',
22+
url = 'https://github.com/SkypLabs/python-hdlc-controller',
23+
download_url = 'https://github.com/SkypLabs/python-hdlc-controller/archive/v{0}.zip'.format(VERSION),
24+
classifiers = [
25+
'Development Status :: 4 - Beta',
26+
'Intended Audience :: Developers',
27+
'Topic :: Software Development :: Libraries :: Python Modules',
28+
'Programming Language :: Python :: 3',
29+
'Programming Language :: Python :: 3.2',
30+
'Programming Language :: Python :: 3.3',
31+
'Programming Language :: Python :: 3.4',
32+
'Programming Language :: Python :: 3.5',
33+
'License :: OSI Approved :: MIT License',
34+
],
35+
py_modules = ['hdlcontroller'],
36+
scripts = ['hdlcontroller.py'],
37+
install_requires = ['python4yahdlc>=1.0.2', 'pyserial'],
38+
test_suite = 'test',
2339
)

0 commit comments

Comments
 (0)