pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/lang
Module Name: pkgsrc
Committed By: bouyer
Date: Tue May 30 14:04:54 UTC 2017
Modified Files:
pkgsrc/lang/python34: distinfo
pkgsrc/lang/python34/patches: patch-al
pkgsrc/lang/python35: distinfo
pkgsrc/lang/python35/patches: patch-configure
Added Files:
pkgsrc/lang/python34/patches: patch-Modules_socketmodule.c
patch-Modules_socketmodule.h patch-pyconfig.h.in
pkgsrc/lang/python35/patches: patch-Modules_socketmodule.c
patch-Modules_socketmodule.h patch-pyconfig.h.in
Log Message:
Add support for NetBSD's socketcan implementation.
Tested with the example from
http://www.bencz.com/hacks/2016/07/10/python-and-socketcan/
Needs <netcan/can.h> rev 1.3 or newer.
To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 pkgsrc/lang/python34/distinfo
cvs rdiff -u -r0 -r1.1 \
pkgsrc/lang/python34/patches/patch-Modules_socketmodule.c \
pkgsrc/lang/python34/patches/patch-Modules_socketmodule.h
cvs rdiff -u -r1.5 -r1.6 pkgsrc/lang/python34/patches/patch-al
cvs rdiff -u -r0 -r1.3 pkgsrc/lang/python34/patches/patch-pyconfig.h.in
cvs rdiff -u -r1.10 -r1.11 pkgsrc/lang/python35/distinfo
cvs rdiff -u -r0 -r1.1 \
pkgsrc/lang/python35/patches/patch-Modules_socketmodule.c \
pkgsrc/lang/python35/patches/patch-Modules_socketmodule.h \
pkgsrc/lang/python35/patches/patch-pyconfig.h.in
cvs rdiff -u -r1.1 -r1.2 pkgsrc/lang/python35/patches/patch-configure
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/lang/python34/distinfo
diff -u pkgsrc/lang/python34/distinfo:1.25 pkgsrc/lang/python34/distinfo:1.26
--- pkgsrc/lang/python34/distinfo:1.25 Thu Jan 26 09:45:23 2017
+++ pkgsrc/lang/python34/distinfo Tue May 30 14:04:53 2017
@@ -1,16 +1,19 @@
-$NetBSD: distinfo,v 1.25 2017/01/26 09:45:23 jperkin Exp $
+$NetBSD: distinfo,v 1.26 2017/05/30 14:04:53 bouyer Exp $
SHA1 (Python-3.4.6.tar.xz) = ef7dbec63d45760701534990511d686e3acbbe4f
RMD160 (Python-3.4.6.tar.xz) = a669de69e6728141a6c960877c486c1f094b560d
SHA512 (Python-3.4.6.tar.xz) = f6785cf6a99a8a27823baefe59cc20e34cbec01bb444c8600e7f49b5437159d5137f9d80fce26e219846d71bfe98f68bc6f0c87719a34db0050a4eaca95959ac
Size (Python-3.4.6.tar.xz) = 14473592 bytes
SHA1 (patch-Lib_distutils_unixccompiler.py) = 7d6df07921ad3357757d4681a964256b560b3f57
+SHA1 (patch-Modules_socketmodule.c) = 3b091755d7c104b5d1fc696a0d4a679ed3565ef4
+SHA1 (patch-Modules_socketmodule.h) = ed334a97c2a6662c5b44b4e50c1b8efcc220fa1f
SHA1 (patch-aa) = 14359f8d0527eff08073c0aea60dfe8961d9255d
SHA1 (patch-ah) = 0acdfcbf3ebcb96b18a1cf28f18b286aa507a62f
-SHA1 (patch-al) = 7239d10b67c739c3ee33dd2fc95bb770360d152f
+SHA1 (patch-al) = 5cf4d44d24020a9b6fe41deeb916edbe87a937cb
SHA1 (patch-am) = 5822927f1c315b4fce5078626efe5418c764665e
SHA1 (patch-an) = c9b571eb54fdf0b1e93524a6de6780e8c4119221
SHA1 (patch-au) = b593d64b34531fdd5a936d109854d80e969f1847
SHA1 (patch-av) = 9b44f339f65f029b7f17dbc654739a7ae3c12780
SHA1 (patch-aw) = bd290417c265846e238660180e60e76c0f5f696a
+SHA1 (patch-pyconfig.h.in) = 1fbd8b94a6317e31a3b9db683db0c2c9c4334713
SHA1 (patch-xa) = fb81eaa604b4ed7c1b64c3f4731d58a8aee257be
Index: pkgsrc/lang/python34/patches/patch-al
diff -u pkgsrc/lang/python34/patches/patch-al:1.5 pkgsrc/lang/python34/patches/patch-al:1.6
--- pkgsrc/lang/python34/patches/patch-al:1.5 Thu Oct 9 09:15:38 2014
+++ pkgsrc/lang/python34/patches/patch-al Tue May 30 14:04:53 2017
@@ -1,4 +1,4 @@
-$NetBSD: patch-al,v 1.5 2014/10/09 09:15:38 adam Exp $
+$NetBSD: patch-al,v 1.6 2017/05/30 14:04:53 bouyer Exp $
MirBSD support
http://bugs.python.org/issue21458
@@ -7,9 +7,11 @@ Changes for consistency across pkgsrc pl
XXX: Not sure what the BLDSHARED changes are about.
---- configure.orig 2014-10-08 08:18:16.000000000 +0000
-+++ configure
-@@ -3358,7 +3358,7 @@ case $ac_sys_system/$ac_sys_release in
+detect netcan/can.h on NetBSD
+
+--- configure.orig 2017-01-17 08:57:47.000000000 +0100
++++ configure 2017-05-30 15:49:43.508649775 +0200
+@@ -3369,7 +3369,7 @@
# Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
# In addition, Stefan Krah confirms that issue #1244610 exists through
# OpenBSD 4.6, but is fixed in 4.7.
@@ -18,7 +20,7 @@ XXX: Not sure what the BLDSHARED changes
define_xopen_source=no
# OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
# also defined. This can be overridden by defining _BSD_SOURCE
-@@ -5636,15 +5636,10 @@ $as_echo "#define Py_ENABLE_SHARED 1" >>
+@@ -5650,15 +5650,10 @@
PY3LIBRARY=libpython3.so
fi
;;
@@ -35,7 +37,16 @@ XXX: Not sure what the BLDSHARED changes
INSTSONAME="$LDLIBRARY".$SOVERSION
if test "$with_pydebug" != yes
then
-@@ -8543,8 +8538,8 @@ then
+@@ -7283,7 +7278,7 @@
+
+
+ # On Linux, can.h and can/raw.h require sys/socket.h
+-for ac_header in linux/can.h linux/can/raw.h linux/can/bcm.h
++for ac_header in linux/can.h linux/can/raw.h linux/can/bcm.h netcan/can.h
+ do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "
+@@ -8561,8 +8556,8 @@
LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
else
# No framework, use the Python app as bundle-loader
@@ -46,7 +57,7 @@ XXX: Not sure what the BLDSHARED changes
LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
fi ;;
Darwin/*)
-@@ -8568,9 +8563,9 @@ then
+@@ -8586,9 +8581,9 @@
LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
else
# No framework, use the Python app as bundle-loader
@@ -59,7 +70,7 @@ XXX: Not sure what the BLDSHARED changes
fi
else
# building for OS X 10.3 and later
-@@ -8609,6 +8604,9 @@ then
+@@ -8627,6 +8622,9 @@
;;
esac
fi;;
@@ -69,7 +80,7 @@ XXX: Not sure what the BLDSHARED changes
NetBSD*|DragonFly*)
LDSHARED='$(CC) -shared'
LDCXXSHARED='$(CXX) -shared';;
-@@ -8652,7 +8650,7 @@ then
+@@ -8670,7 +8668,7 @@
fi;;
Linux*|GNU*) CCSHARED="-fPIC";;
BSD/OS*/4*) CCSHARED="-fpic";;
@@ -78,7 +89,7 @@ XXX: Not sure what the BLDSHARED changes
OpenUNIX*|UnixWare*)
if test "$GCC" = "yes"
then CCSHARED="-fPIC"
-@@ -8701,7 +8699,7 @@ then
+@@ -8719,7 +8717,7 @@
OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
@@ -87,7 +98,7 @@ XXX: Not sure what the BLDSHARED changes
if [ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]
then
LINKFORSHARED="-Wl,--export-dynamic"
-@@ -13935,8 +13933,6 @@ $as_echo "$SOABI" >&6; }
+@@ -14017,8 +14015,6 @@
case $ac_sys_system in
Index: pkgsrc/lang/python35/distinfo
diff -u pkgsrc/lang/python35/distinfo:1.10 pkgsrc/lang/python35/distinfo:1.11
--- pkgsrc/lang/python35/distinfo:1.10 Thu Jan 26 09:45:23 2017
+++ pkgsrc/lang/python35/distinfo Tue May 30 14:04:53 2017
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.10 2017/01/26 09:45:23 jperkin Exp $
+$NetBSD: distinfo,v 1.11 2017/05/30 14:04:53 bouyer Exp $
SHA1 (Python-3.5.3.tar.xz) = 127121fdca11e735b3686e300d66f73aba663e93
RMD160 (Python-3.5.3.tar.xz) = 663ad06b0c4b36e7760f5202e73bc53697f225d2
@@ -11,6 +11,9 @@ SHA1 (patch-Makefile.pre.in) = 174e01e44
SHA1 (patch-Modules___cursesmodule.c) = 2ab2779e0418a4529987641c254686ba05d28593
SHA1 (patch-Modules_makesetup) = c9b571eb54fdf0b1e93524a6de6780e8c4119221
SHA1 (patch-Modules_nismodule.c) = bd290417c265846e238660180e60e76c0f5f696a
+SHA1 (patch-Modules_socketmodule.c) = 63d583340b071b07ff3e31cf332fcc2ca9ab50e3
+SHA1 (patch-Modules_socketmodule.h) = 13a3290eb72078067060d3e71b7baa08f3eb591c
SHA1 (patch-Python_thread__pthread.h) = fb81eaa604b4ed7c1b64c3f4731d58a8aee257be
-SHA1 (patch-configure) = 069f7bb10d98e3616f52859a2cf90c7f5732425e
+SHA1 (patch-configure) = fcdc55c8cc84017364f840f35e7ec4a131074520
+SHA1 (patch-pyconfig.h.in) = 5d11bd737a949f89b3fbd14db4920873bcc3282e
SHA1 (patch-setup.py) = 7d8afe5e799c8373fe41fbb65e283e0c6f3967d2
Index: pkgsrc/lang/python35/patches/patch-configure
diff -u pkgsrc/lang/python35/patches/patch-configure:1.1 pkgsrc/lang/python35/patches/patch-configure:1.2
--- pkgsrc/lang/python35/patches/patch-configure:1.1 Sat Dec 5 17:12:13 2015
+++ pkgsrc/lang/python35/patches/patch-configure Tue May 30 14:04:54 2017
@@ -1,4 +1,4 @@
-$NetBSD: patch-configure,v 1.1 2015/12/05 17:12:13 adam Exp $
+$NetBSD: patch-configure,v 1.2 2017/05/30 14:04:54 bouyer Exp $
MirBSD support
http://bugs.python.org/issue21458
@@ -7,9 +7,11 @@ Changes for consistency across pkgsrc pl
XXX: Not sure what the BLDSHARED changes are about.
---- configure.orig 2015-09-13 11:41:26.000000000 +0000
-+++ configure
-@@ -3374,7 +3374,7 @@ case $ac_sys_system/$ac_sys_release in
+detect netcan/can.h on NetBSD
+
+--- configure.orig 2017-01-17 08:57:54.000000000 +0100
++++ configure 2017-05-30 15:40:52.322257152 +0200
+@@ -3462,7 +3462,7 @@
# Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
# In addition, Stefan Krah confirms that issue #1244610 exists through
# OpenBSD 4.6, but is fixed in 4.7.
@@ -18,7 +20,7 @@ XXX: Not sure what the BLDSHARED changes
define_xopen_source=no
# OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
# also defined. This can be overridden by defining _BSD_SOURCE
-@@ -5787,7 +5787,7 @@ $as_echo "#define Py_ENABLE_SHARED 1" >>
+@@ -5996,7 +5996,7 @@
PY3LIBRARY=libpython3.so
fi
;;
@@ -27,7 +29,16 @@ XXX: Not sure what the BLDSHARED changes
LDLIBRARY='libpython$(LDVERSION).so'
BLDLIBRARY='-L. -lpython$(LDVERSION)'
RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
-@@ -8832,8 +8832,8 @@ then
+@@ -7991,7 +7991,7 @@
+
+
+ # On Linux, can.h and can/raw.h require sys/socket.h
+-for ac_header in linux/can.h linux/can/raw.h linux/can/bcm.h
++for ac_header in linux/can.h linux/can/raw.h linux/can/bcm.h netcan/can.h
+ do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "
+@@ -9269,8 +9269,8 @@
LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
else
# No framework, use the Python app as bundle-loader
@@ -38,7 +49,7 @@ XXX: Not sure what the BLDSHARED changes
LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
fi ;;
Darwin/*)
-@@ -8857,9 +8857,9 @@ then
+@@ -9294,9 +9294,9 @@
LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
else
# No framework, use the Python app as bundle-loader
@@ -51,7 +62,7 @@ XXX: Not sure what the BLDSHARED changes
fi
else
# building for OS X 10.3 and later
-@@ -8898,6 +8898,9 @@ then
+@@ -9335,6 +9335,9 @@
;;
esac
fi;;
@@ -61,7 +72,7 @@ XXX: Not sure what the BLDSHARED changes
NetBSD*|DragonFly*)
LDSHARED='$(CC) -shared'
LDCXXSHARED='$(CXX) -shared';;
-@@ -8941,7 +8944,7 @@ then
+@@ -9378,7 +9381,7 @@
fi;;
Linux*|GNU*) CCSHARED="-fPIC";;
BSD/OS*/4*) CCSHARED="-fpic";;
@@ -70,7 +81,7 @@ XXX: Not sure what the BLDSHARED changes
OpenUNIX*|UnixWare*)
if test "$GCC" = "yes"
then CCSHARED="-fPIC"
-@@ -8990,7 +8993,7 @@ then
+@@ -9427,7 +9430,7 @@
OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
@@ -79,7 +90,7 @@ XXX: Not sure what the BLDSHARED changes
if [ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]
then
LINKFORSHARED="-Wl,--export-dynamic"
-@@ -14371,8 +14374,6 @@ $as_echo "$SOABI" >&6; }
+@@ -14758,8 +14761,6 @@
case $ac_sys_system in
Added files:
Index: pkgsrc/lang/python34/patches/patch-Modules_socketmodule.c
diff -u /dev/null pkgsrc/lang/python34/patches/patch-Modules_socketmodule.c:1.1
--- /dev/null Tue May 30 14:04:54 2017
+++ pkgsrc/lang/python34/patches/patch-Modules_socketmodule.c Tue May 30 14:04:53 2017
@@ -0,0 +1,71 @@
+$NetBSD: patch-Modules_socketmodule.c,v 1.1 2017/05/30 14:04:53 bouyer Exp $
+
+Support NetBSD's socketcan implementation
+
+--- Modules/socketmodule.c.orig 2017-01-17 08:57:45.000000000 +0100
++++ Modules/socketmodule.c 2017-05-30 15:52:31.835064114 +0200
+@@ -1174,8 +1174,13 @@
+ /* need to look up interface name given index */
+ if (a->can_ifindex) {
+ ifr.ifr_ifindex = a->can_ifindex;
++#ifdef __NetBSD__
++ if (if_indextoname(a->can_ifindex, ifr.ifr_name) != NULL)
++ ifname = ifr.ifr_name;
++#else
+ if (ioctl(sockfd, SIOCGIFNAME, &ifr) == 0)
+ ifname = ifr.ifr_name;
++#endif /* __NetBSD__ */
+ }
+
+ return Py_BuildValue("O&h", PyUnicode_DecodeFSDefault,
+@@ -1589,12 +1594,14 @@
+ }
+ #endif
+
+-#if defined(AF_CAN) && defined(CAN_RAW) && defined(CAN_BCM)
++#if defined(AF_CAN) && defined(CAN_RAW)
+ case AF_CAN:
+ switch (s->sock_proto) {
+ case CAN_RAW:
++#ifdef CAN_BCM
+ /* fall-through */
+ case CAN_BCM:
++#endif
+ {
+ struct sockaddr_can *addr;
+ PyObject *interfaceName;
+@@ -1614,7 +1621,12 @@
+ } else if (len < sizeof(ifr.ifr_name)) {
+ strncpy(ifr.ifr_name, PyBytes_AS_STRING(interfaceName), sizeof(ifr.ifr_name));
+ ifr.ifr_name[(sizeof(ifr.ifr_name))-1] = '\0';
+- if (ioctl(s->sock_fd, SIOCGIFINDEX, &ifr) < 0) {
++#ifdef __NetBSD__
++ if ((ifr.ifr_ifindex = if_nametoindex(ifr.ifr_name)) == 0)
++#else
++ if (ioctl(s->sock_fd, SIOCGIFINDEX, &ifr) < 0)
++#endif
++ {
+ s->errorhandler();
+ Py_DECREF(interfaceName);
+ return 0;
+@@ -6335,6 +6347,20 @@
+ PyModule_AddIntConstant(m, "CAN_BCM_RX_TIMEOUT", RX_TIMEOUT);
+ PyModule_AddIntConstant(m, "CAN_BCM_RX_CHANGED", RX_CHANGED);
+ #endif
++#ifdef HAVE_NETCAN_CAN_H
++ PyModule_AddIntMacro(m, CAN_EFF_FLAG);
++ PyModule_AddIntMacro(m, CAN_RTR_FLAG);
++ PyModule_AddIntMacro(m, CAN_ERR_FLAG);
++
++ PyModule_AddIntMacro(m, CAN_SFF_MASK);
++ PyModule_AddIntMacro(m, CAN_EFF_MASK);
++ PyModule_AddIntMacro(m, CAN_ERR_MASK);
++
++ PyModule_AddIntMacro(m, CAN_RAW_FILTER);
++ /* PyModule_AddIntMacro(m, CAN_RAW_ERR_FILTER); */
++ PyModule_AddIntMacro(m, CAN_RAW_LOOPBACK);
++ PyModule_AddIntMacro(m, CAN_RAW_RECV_OWN_MSGS);
++#endif
+ #ifdef SOL_RDS
+ PyModule_AddIntMacro(m, SOL_RDS);
+ #endif
Index: pkgsrc/lang/python34/patches/patch-Modules_socketmodule.h
diff -u /dev/null pkgsrc/lang/python34/patches/patch-Modules_socketmodule.h:1.1
--- /dev/null Tue May 30 14:04:54 2017
+++ pkgsrc/lang/python34/patches/patch-Modules_socketmodule.h Tue May 30 14:04:53 2017
@@ -0,0 +1,15 @@
+$NetBSD: patch-Modules_socketmodule.h,v 1.1 2017/05/30 14:04:53 bouyer Exp $
+
+--- Modules/socketmodule.h.orig 2017-01-17 08:57:45.000000000 +0100
++++ Modules/socketmodule.h 2017-05-30 15:51:47.251527645 +0200
+@@ -84,6 +84,10 @@
+ #include <linux/can/bcm.h>
+ #endif
+
++#ifdef HAVE_NETCAN_CAN_H
++#include <netcan/can.h>
++#endif
++
+ #ifdef HAVE_SYS_SYS_DOMAIN_H
+ #include <sys/sys_domain.h>
+ #endif
Index: pkgsrc/lang/python34/patches/patch-pyconfig.h.in
diff -u /dev/null pkgsrc/lang/python34/patches/patch-pyconfig.h.in:1.3
--- /dev/null Tue May 30 14:04:54 2017
+++ pkgsrc/lang/python34/patches/patch-pyconfig.h.in Tue May 30 14:04:53 2017
@@ -0,0 +1,16 @@
+$NetBSD: patch-pyconfig.h.in,v 1.3 2017/05/30 14:04:53 bouyer Exp $
+
+detect netcan/can.h on NetBSD
+
+--- pyconfig.h.in.orig 2017-01-17 08:57:47.000000000 +0100
++++ pyconfig.h.in 2017-05-30 15:51:02.132654510 +0200
+@@ -522,6 +522,9 @@
+ /* Define to 1 if you have the <linux/can/raw.h> header file. */
+ #undef HAVE_LINUX_CAN_RAW_H
+
++/* Define to 1 if you have the <netcan/can.h> header file. */
++#undef HAVE_NETCAN_CAN_H
++
+ /* Define to 1 if you have the <linux/netlink.h> header file. */
+ #undef HAVE_LINUX_NETLINK_H
+
Index: pkgsrc/lang/python35/patches/patch-Modules_socketmodule.c
diff -u /dev/null pkgsrc/lang/python35/patches/patch-Modules_socketmodule.c:1.1
--- /dev/null Tue May 30 14:04:54 2017
+++ pkgsrc/lang/python35/patches/patch-Modules_socketmodule.c Tue May 30 14:04:54 2017
@@ -0,0 +1,71 @@
+$NetBSD: patch-Modules_socketmodule.c,v 1.1 2017/05/30 14:04:54 bouyer Exp $
+
+Support NetBSD's socketcan implementation
+
+--- Modules/socketmodule.c.orig 2017-01-17 08:57:53.000000000 +0100
++++ Modules/socketmodule.c 2017-05-30 15:43:04.200284076 +0200
+@@ -1346,8 +1346,13 @@
+ /* need to look up interface name given index */
+ if (a->can_ifindex) {
+ ifr.ifr_ifindex = a->can_ifindex;
++#ifdef __NetBSD__
++ if (if_indextoname(a->can_ifindex, ifr.ifr_name) != NULL)
++ ifname = ifr.ifr_name;
++#else
+ if (ioctl(sockfd, SIOCGIFNAME, &ifr) == 0)
+ ifname = ifr.ifr_name;
++#endif /* __NetBSD__ */
+ }
+
+ return Py_BuildValue("O&h", PyUnicode_DecodeFSDefault,
+@@ -1834,12 +1839,14 @@
+ }
+ #endif
+
+-#if defined(AF_CAN) && defined(CAN_RAW) && defined(CAN_BCM)
++#if defined(AF_CAN) && defined(CAN_RAW)
+ case AF_CAN:
+ switch (s->sock_proto) {
+ case CAN_RAW:
++#ifdef CAN_BCM
+ /* fall-through */
+ case CAN_BCM:
++#endif
+ {
+ struct sockaddr_can *addr;
+ PyObject *interfaceName;
+@@ -1859,7 +1866,12 @@
+ } else if ((size_t)len < sizeof(ifr.ifr_name)) {
+ strncpy(ifr.ifr_name, PyBytes_AS_STRING(interfaceName), sizeof(ifr.ifr_name));
+ ifr.ifr_name[(sizeof(ifr.ifr_name))-1] = '\0';
+- if (ioctl(s->sock_fd, SIOCGIFINDEX, &ifr) < 0) {
++#ifdef __NetBSD__
++ if ((ifr.ifr_ifindex = if_nametoindex(ifr.ifr_name)) == 0)
++#else
++ if (ioctl(s->sock_fd, SIOCGIFINDEX, &ifr) < 0)
++#endif
++ {
+ s->errorhandler();
+ Py_DECREF(interfaceName);
+ return 0;
+@@ -6688,6 +6700,20 @@
+ PyModule_AddIntConstant(m, "CAN_BCM_RX_TIMEOUT", RX_TIMEOUT);
+ PyModule_AddIntConstant(m, "CAN_BCM_RX_CHANGED", RX_CHANGED);
+ #endif
++#ifdef HAVE_NETCAN_CAN_H
++ PyModule_AddIntMacro(m, CAN_EFF_FLAG);
++ PyModule_AddIntMacro(m, CAN_RTR_FLAG);
++ PyModule_AddIntMacro(m, CAN_ERR_FLAG);
++
++ PyModule_AddIntMacro(m, CAN_SFF_MASK);
++ PyModule_AddIntMacro(m, CAN_EFF_MASK);
++ PyModule_AddIntMacro(m, CAN_ERR_MASK);
++
++ PyModule_AddIntMacro(m, CAN_RAW_FILTER);
++ /* PyModule_AddIntMacro(m, CAN_RAW_ERR_FILTER); */
++ PyModule_AddIntMacro(m, CAN_RAW_LOOPBACK);
++ PyModule_AddIntMacro(m, CAN_RAW_RECV_OWN_MSGS);
++#endif
+ #ifdef SOL_RDS
+ PyModule_AddIntMacro(m, SOL_RDS);
+ #endif
Index: pkgsrc/lang/python35/patches/patch-Modules_socketmodule.h
diff -u /dev/null pkgsrc/lang/python35/patches/patch-Modules_socketmodule.h:1.1
--- /dev/null Tue May 30 14:04:54 2017
+++ pkgsrc/lang/python35/patches/patch-Modules_socketmodule.h Tue May 30 14:04:54 2017
@@ -0,0 +1,15 @@
+$NetBSD: patch-Modules_socketmodule.h,v 1.1 2017/05/30 14:04:54 bouyer Exp $
+
+--- Modules/socketmodule.h.orig 2017-03-21 07:32:38.000000000 +0100
++++ Modules/socketmodule.h 2017-05-30 12:36:59.254776235 +0200
+@@ -91,6 +91,10 @@
+ #include <linux/can/bcm.h>
+ #endif
+
++#ifdef HAVE_NETCAN_CAN_H
++#include <netcan/can.h>
++#endif
++
+ #ifdef HAVE_SYS_SYS_DOMAIN_H
+ #include <sys/sys_domain.h>
+ #endif
Index: pkgsrc/lang/python35/patches/patch-pyconfig.h.in
diff -u /dev/null pkgsrc/lang/python35/patches/patch-pyconfig.h.in:1.1
--- /dev/null Tue May 30 14:04:54 2017
+++ pkgsrc/lang/python35/patches/patch-pyconfig.h.in Tue May 30 14:04:54 2017
@@ -0,0 +1,16 @@
+$NetBSD: patch-pyconfig.h.in,v 1.1 2017/05/30 14:04:54 bouyer Exp $
+
+detect netcan/can.h on NetBSD
+
+--- pyconfig.h.in.orig 2017-01-17 08:57:54.000000000 +0100
++++ pyconfig.h.in 2017-05-30 15:41:41.207090795 +0200
+@@ -540,6 +540,9 @@
+ /* Define to 1 if you have the <linux/can/raw.h> header file. */
+ #undef HAVE_LINUX_CAN_RAW_H
+
++/* Define to 1 if you have the <netcan/can.h> header file. */
++#undef HAVE_NETCAN_CAN_H
++
+ /* Define to 1 if you have the <linux/netlink.h> header file. */
+ #undef HAVE_LINUX_NETLINK_H
+
Home |
Main Index |
Thread Index |
Old Index