Skip to content

Commit 8e4d77e

Browse files
committed
rework scripts as entry-points
1 parent 2e1736f commit 8e4d77e

4 files changed

Lines changed: 26 additions & 15 deletions

File tree

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
communication.add_argument('-t', '--type',
3232
type=str,
33+
default='fifo',
3334
choices=['fifo', 'http', 'datagram'],
3435
help='OpenSIPS MI Communication Type')
3536
communication.add_argument('-i', '--ip',
@@ -40,15 +41,15 @@
4041
type=int,
4142
help='OpenSIPS MI Port',
4243
default=8888)
43-
communication.add_argument('-f', '--file',
44+
communication.add_argument('-f', '--fifo-file',
4445
metavar='FIFO_FILE',
4546
type=str,
4647
help='OpenSIPS MI FIFO File')
47-
communication.add_argument('-fb', '--fallback',
48+
communication.add_argument('-fb', '--fifo-fallback',
4849
metavar='FIFO_FALLBACK_FILE',
4950
type=str,
5051
help='OpenSIPS MI Fallback FIFO File')
51-
communication.add_argument('-fd', '--dir',
52+
communication.add_argument('-fd', '--fifo-reply-dir',
5253
metavar='FIFO_DIR',
5354
type=str,
5455
help='OpenSIPS MI FIFO Reply Directory')
@@ -63,19 +64,19 @@
6364
type=str,
6465
choices=['datagram', 'stream'],
6566
help='OpenSIPS Event Transport',
66-
required=True)
67+
default='datagram')
6768
event.add_argument('-li', '--listen-ip',
6869
type=str,
6970
help='OpenSIPS Event Listen IP Address',
70-
default='127.0.0.1')
71+
default='0.0.0.0')
7172
event.add_argument('-lp', '--listen-port',
7273
type=int,
7374
help='OpenSIPS Event Listen Port',
74-
required=True)
75+
default=0)
7576
event.add_argument('-e', '--expire',
7677
type=int,
7778
help='OpenSIPS Event Expire Time',
78-
default=3600)
79+
default=None)
7980

8081
args = parser.parse_args()
8182

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import argparse
2121
from opensips.mi import OpenSIPSMI, OpenSIPSMIException
2222
import json
23-
23+
2424
parser = argparse.ArgumentParser()
2525

2626
communication = parser.add_argument_group('communication')
@@ -36,20 +36,20 @@
3636
type=int,
3737
help='OpenSIPS MI Port',
3838
default=8888)
39-
communication.add_argument('-f', '--file',
39+
communication.add_argument('-f', '--fifo-file',
4040
type=str,
4141
help='OpenSIPS MI FIFO File')
42-
communication.add_argument('-fb', '--fallback',
42+
communication.add_argument('-fb', '--fifo-fallback',
4343
type=str,
4444
help='OpenSIPS MI Fallback FIFO File')
45-
communication.add_argument('-fd', '--dir',
45+
communication.add_argument('-fd', '--fifo-reply-dir',
4646
type=str,
4747
help='OpenSIPS MI FIFO Reply Directory')
4848

4949
group = parser.add_mutually_exclusive_group(required=True)
5050

5151
group.add_argument('-s', '--stats',
52-
nargs='+',
52+
nargs='+',
5353
default=[],
5454
help='statistics')
5555

opensips/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919

2020
""" OpenSIPS Package version """
2121

22-
__version__ = '0.1.1'
22+
__version__ = '0.1.2'

setup.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,15 @@
1717
## along with this program. If not, see <http://www.gnu.org/licenses/>.
1818
##
1919

20+
""" Setup module for OpenSIPS package """
21+
2022
from setuptools import setup, find_packages
2123

2224
from opensips import version
2325

26+
with open('README.md', encoding='utf-8') as f:
27+
long_description = f.read()
28+
2429
setup(
2530
name="opensips",
2631
version=version.__version__,
@@ -29,14 +34,19 @@
2934
author="Darius Stefan",
3035
author_email="darius.stefan@opensips.org",
3136
description="OpenSIPS Python Packages",
32-
long_description=open('README.md').read(),
37+
long_description=long_description,
3338
long_description_content_type='text/markdown',
3439
url="https://github.com/OpenSIPS/python-opensips",
3540
classifiers=[
3641
"Programming Language :: Python :: 3",
3742
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
3843
"Operating System :: OS Independent",
3944
],
40-
scripts=['scripts/opensips-mi', 'scripts/opensips-event'],
45+
entry_points = {
46+
'console_scripts': [
47+
'openisps-mi = opensips.mi',
48+
'openisps-event = opensips.event',
49+
],
50+
},
4151
python_requires=">=3.6"
4252
)

0 commit comments

Comments
 (0)