Skip to content

Commit

Permalink
devel/py-pnio-dcp: New port: Library to PROFINET Discovery and basic …
Browse files Browse the repository at this point in the history
…DCP protocol

A simple Python library to send and receive messages with the Profinet
Discovery and basic Configuration Protocol (DCP) protocol. It can send requests
and parse the corresponding responses to identify devices over the network, get
and set their parameters or reset them to factory settings.
  • Loading branch information
alonsobsd committed Feb 19, 2024
1 parent 72b0721 commit 1472a55
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 0 deletions.
1 change: 1 addition & 0 deletions devel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5220,6 +5220,7 @@
SUBDIR += py-pluginbase
SUBDIR += py-plux
SUBDIR += py-ply
SUBDIR += py-pnio-dcp
SUBDIR += py-pockets
SUBDIR += py-podcastparser
SUBDIR += py-poetry
Expand Down
29 changes: 29 additions & 0 deletions devel/py-pnio-dcp/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
PORTNAME= pnio-dcp
PORTVERSION= 1.2.0
CATEGORIES= devel python
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}

MAINTAINER= acm@FreeBSD.org
COMMENT= Library to PROFINET Discovery and basic DCP protocol
WWW= https://gitlab.com/pyshacks/pnio_dcp

LICENSE= MIT

BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}setuptools_scm>0:devel/py-setuptools_scm@${PY_FLAVOR}
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}psutil>=0:sysutils/py-psutil@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}importlib-metadata>0:devel/py-importlib-metadata@${PY_FLAVOR}

USES= python
USE_PYTHON= autoplist distutils

USE_GITLAB= yes
GL_ACCOUNT= pyshacks
GL_PROJECT= ${PORTNAME:S/-/_/}
GL_COMMIT= 6156aa9c10bca35a118a58a02837b97a7e5a829e

NO_ARCH= yes

post-patch:
${REINPLACE_CMD} -e 's|%%PORTVERSION%%|${PORTVERSION}|g' ${WRKSRC}/setup.py

.include <bsd.port.mk>
3 changes: 3 additions & 0 deletions devel/py-pnio-dcp/distinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
TIMESTAMP = 1708286638
SHA256 (pyshacks-pnio_dcp-6156aa9c10bca35a118a58a02837b97a7e5a829e_GL0.tar.gz) = c5aa5822faf78cae39ae1c7dc9010528acd322cef5d7037c6b71522e03f601e5
SIZE (pyshacks-pnio_dcp-6156aa9c10bca35a118a58a02837b97a7e5a829e_GL0.tar.gz) = 32613
10 changes: 10 additions & 0 deletions devel/py-pnio-dcp/files/patch-pnio__dcp_l2socket_____init____.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- pnio_dcp/l2socket/__init__.py.orig 2024-02-18 23:35:44 UTC
+++ pnio_dcp/l2socket/__init__.py
@@ -10,5 +10,7 @@ if sys.platform == 'win32':
L2Socket = L2PcapSocket
elif sys.platform.startswith('linux'):
L2Socket = L2LinuxSocket
+elif sys.platform.startswith('freebsd'):
+ L2Socket = L2LinuxSocket
else:
raise NotImplementedError(f"Platform {sys.platform} is currently not supported.")
22 changes: 22 additions & 0 deletions devel/py-pnio-dcp/files/patch-pnio__dcp_pnio__dcp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--- pnio_dcp/pnio_dcp.py.orig 2024-02-18 23:53:00 UTC
+++ pnio_dcp/pnio_dcp.py
@@ -49,7 +49,7 @@ class DCP:
available through this instance.
"""

- def __init__(self, ip):
+ def __init__(self, ip, timeout=7):
"""
Create a new instance, use the given ip to select the network interface.
:param ip: The ip address used to select the network interface.
@@ -57,8 +57,8 @@ class DCP:
"""
self.src_mac, network_interface = self.__get_network_interface_and_mac_address(ip)

- self.default_timeout = 7 # default timeout for requests (in seconds)
- self.identify_all_timeout = 7 # timeout to receive all responses for identify_all
+ self.default_timeout = timeout # default timeout for requests (in seconds)
+ self.identify_all_timeout = timeout # timeout to receive all responses for identify_all

# the XID is the id of the current transaction and can be used to identify the responses to a request
self.__xid = int(random.getrandbits(32)) # initialize it with a random value
11 changes: 11 additions & 0 deletions devel/py-pnio-dcp/files/patch-setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- setup.py.orig 2023-10-04 11:20:39 UTC
+++ setup.py
@@ -30,7 +30,7 @@ classifiers = [
]

setup(name="pnio_dcp",
- use_scm_version={"local_scheme": "no-local-version"},
+ version='1.2.0',
setup_requires=['setuptools_scm'],
description='Discover and configure PROFINET devices with the PROFINET Discovery and basic Configuration Protocol (DCP) '
'protocol.',
4 changes: 4 additions & 0 deletions devel/py-pnio-dcp/pkg-descr
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
A simple Python library to send and receive messages with the Profinet
Discovery and basic Configuration Protocol (DCP) protocol. It can send requests
and parse the corresponding responses to identify devices over the network, get
and set their parameters or reset them to factory settings.

0 comments on commit 1472a55

Please sign in to comment.