pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/lang/python36



Module Name:    pkgsrc
Committed By:   bouyer
Date:           Tue May 30 13:36:39 UTC 2017

Modified Files:
        pkgsrc/lang/python36: distinfo
        pkgsrc/lang/python36/patches: patch-configure
Added Files:
        pkgsrc/lang/python36/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.10 -r1.11 pkgsrc/lang/python36/distinfo
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/lang/python36/patches/patch-Modules_socketmodule.c \
    pkgsrc/lang/python36/patches/patch-Modules_socketmodule.h \
    pkgsrc/lang/python36/patches/patch-pyconfig.h.in
cvs rdiff -u -r1.7 -r1.8 pkgsrc/lang/python36/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/python36/distinfo
diff -u pkgsrc/lang/python36/distinfo:1.10 pkgsrc/lang/python36/distinfo:1.11
--- pkgsrc/lang/python36/distinfo:1.10  Mon May 29 23:06:45 2017
+++ pkgsrc/lang/python36/distinfo       Tue May 30 13:36:39 2017
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.10 2017/05/29 23:06:45 he Exp $
+$NetBSD: distinfo,v 1.11 2017/05/30 13:36:39 bouyer Exp $
 
 SHA1 (Python-3.6.1.tar.xz) = 91d880a2a9fcfc6753cbfa132bf47a47e17e7b16
 RMD160 (Python-3.6.1.tar.xz) = 77e70ec6a07b9c17a99ac1df503f12f3a4c49fce
@@ -13,6 +13,9 @@ SHA1 (patch-Makefile.pre.in) = cb93d2cbb
 SHA1 (patch-Modules___cursesmodule.c) = 2ab2779e0418a4529987641c254686ba05d28593
 SHA1 (patch-Modules_makesetup) = a06786eebffadecedba5e3a50a9785fb47613567
 SHA1 (patch-Modules_nismodule.c) = 1bafe9b06359586d027a77011b103877590d947d
+SHA1 (patch-Modules_socketmodule.c) = 706d8a925610e1c55af907accbe53c1e8102530d
+SHA1 (patch-Modules_socketmodule.h) = 13a3290eb72078067060d3e71b7baa08f3eb591c
 SHA1 (patch-Python_thread__pthread.h) = fb81eaa604b4ed7c1b64c3f4731d58a8aee257be
-SHA1 (patch-configure) = a5b943a2fb05b237ff370e5632de0597813d7944
+SHA1 (patch-configure) = 5df4a022cd1994b3d646b0c03cffbbfaa73f2ac4
+SHA1 (patch-pyconfig.h.in) = 58e2c03489f9b6e4d88f144d8c09773f92eacd61
 SHA1 (patch-setup.py) = 1e14b84fc5cb21b3fa61755bf574021ba9b2ab81

Index: pkgsrc/lang/python36/patches/patch-configure
diff -u pkgsrc/lang/python36/patches/patch-configure:1.7 pkgsrc/lang/python36/patches/patch-configure:1.8
--- pkgsrc/lang/python36/patches/patch-configure:1.7    Mon May 29 23:06:45 2017
+++ pkgsrc/lang/python36/patches/patch-configure        Tue May 30 13:36:39 2017
@@ -1,4 +1,4 @@
-$NetBSD: patch-configure,v 1.7 2017/05/29 23:06:45 he Exp $
+$NetBSD: patch-configure,v 1.8 2017/05/30 13:36:39 bouyer Exp $
 
 Simplify _sysconfigdata to include only platform name.
 
@@ -11,9 +11,11 @@ Fix linking on Darwin.
 
 Use gnu99 instead of c99 to avoid "alloca() undefined" problems on macppc.
 
---- configure.orig     2017-03-21 06:32:38.000000000 +0000
-+++ configure
-@@ -2928,7 +2928,7 @@ $as_echo_n "checking for python interpre
+detect netcan/can.h on NetBSD
+
+--- configure.orig     2017-03-21 07:32:38.000000000 +0100
++++ configure  2017-05-30 12:34:22.173986489 +0200
+@@ -2928,7 +2928,7 @@
        fi
          { $as_echo "$as_me:${as_lineno-$LINENO}: result: $interp" >&5
  $as_echo "$interp" >&6; }
@@ -22,7 +24,7 @@ Use gnu99 instead of c99 to avoid "alloc
      fi
      # Used to comment out stuff for rebuilding generated files
      GENERATED_COMMENT='#'
-@@ -3324,7 +3324,7 @@ case $ac_sys_system/$ac_sys_release in
+@@ -3324,7 +3324,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.
@@ -31,7 +33,7 @@ Use gnu99 instead of c99 to avoid "alloc
      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
-@@ -5969,7 +5969,7 @@ $as_echo "#define Py_ENABLE_SHARED 1" >>
+@@ -5969,7 +5969,7 @@
              PY3LIBRARY=libpython3.so
          fi
            ;;
@@ -40,7 +42,7 @@ Use gnu99 instead of c99 to avoid "alloc
          LDLIBRARY='libpython$(LDVERSION).so'
          BLDLIBRARY='-L. -lpython$(LDVERSION)'
          RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
-@@ -6897,7 +6897,7 @@ UNIVERSAL_ARCH_FLAGS=
+@@ -6897,7 +6897,7 @@
  # tweak BASECFLAGS based on compiler and platform
  case $GCC in
  yes)
@@ -49,7 +51,16 @@ Use gnu99 instead of c99 to avoid "alloc
  
      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wextra" >&5
  $as_echo_n "checking for -Wextra... " >&6; }
-@@ -9188,8 +9188,8 @@ then
+@@ -8072,7 +8072,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" "
+@@ -9188,8 +9188,8 @@
                        LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
                else
                        # No framework, use the Python app as bundle-loader
@@ -60,7 +71,7 @@ Use gnu99 instead of c99 to avoid "alloc
                        LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
                fi ;;
        Darwin/*)
-@@ -9213,9 +9213,9 @@ then
+@@ -9213,9 +9213,9 @@
                                LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
                        else
                                # No framework, use the Python app as bundle-loader
@@ -73,7 +84,7 @@ Use gnu99 instead of c99 to avoid "alloc
                        fi
                else
                        # building for OS X 10.3 and later
-@@ -9254,6 +9254,9 @@ then
+@@ -9254,6 +9254,9 @@
                                   ;;
                                esac
                fi;;
@@ -83,7 +94,7 @@ Use gnu99 instead of c99 to avoid "alloc
        NetBSD*|DragonFly*)
                LDSHARED='$(CC) -shared'
                LDCXXSHARED='$(CXX) -shared';;
-@@ -9298,7 +9301,7 @@ then
+@@ -9298,7 +9301,7 @@
        Linux-android*) ;;
        Linux*|GNU*) CCSHARED="-fPIC";;
        BSD/OS*/4*) CCSHARED="-fpic";;
@@ -92,7 +103,7 @@ Use gnu99 instead of c99 to avoid "alloc
        OpenUNIX*|UnixWare*)
                if test "$GCC" = "yes"
                then CCSHARED="-fPIC"
-@@ -9348,7 +9351,7 @@ then
+@@ -9348,7 +9351,7 @@
        OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
        SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
        ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
@@ -101,7 +112,7 @@ Use gnu99 instead of c99 to avoid "alloc
                if [ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]
                then
                        LINKFORSHARED="-Wl,--export-dynamic"
-@@ -11122,7 +11125,7 @@ if ${ac_cv_dtrace_link+:} false; then :
+@@ -11122,7 +11125,7 @@
    $as_echo_n "(cached) " >&6
  else
                ac_cv_dtrace_link=no
@@ -110,7 +121,7 @@ Use gnu99 instead of c99 to avoid "alloc
              "$DTRACE" -G -s conftest.d -o conftest.o > /dev/null 2>&1 && \
                  ac_cv_dtrace_link=yes
  
-@@ -14949,8 +14952,6 @@ $as_echo "$SOABI" >&6; }
+@@ -14949,8 +14952,6 @@
  
  
  case $ac_sys_system in
@@ -119,7 +130,7 @@ Use gnu99 instead of c99 to avoid "alloc
      *)
        EXT_SUFFIX=${SHLIB_SUFFIX};;
  esac
-@@ -14962,11 +14963,7 @@ LDVERSION='$(VERSION)$(ABIFLAGS)'
+@@ -14962,11 +14963,7 @@
  $as_echo "$LDVERSION" >&6; }
  
  
@@ -132,3 +143,12 @@ Use gnu99 instead of c99 to avoid "alloc
  
  
  # Check whether right shifting a negative integer extends the sign bit
+@@ -17217,6 +17214,8 @@
+   case $ac_option in
+   # Handling of the options.
+   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
++      : Avoid regenerating within pkgsrc
++      exit 0
+     ac_cs_recheck=: ;;
+   --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+     $as_echo "$ac_cs_version"; exit ;;

Added files:

Index: pkgsrc/lang/python36/patches/patch-Modules_socketmodule.c
diff -u /dev/null pkgsrc/lang/python36/patches/patch-Modules_socketmodule.c:1.1
--- /dev/null   Tue May 30 13:36:39 2017
+++ pkgsrc/lang/python36/patches/patch-Modules_socketmodule.c   Tue May 30 13:36:39 2017
@@ -0,0 +1,71 @@
+$NetBSD: patch-Modules_socketmodule.c,v 1.1 2017/05/30 13:36:39 bouyer Exp $
+
+Support NetBSD's socketcan implementation
+
+--- Modules/socketmodule.c.orig        2017-05-30 13:31:59.096006411 +0200
++++ Modules/socketmodule.c     2017-05-30 13:37:39.696032387 +0200
+@@ -1405,8 +1405,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,
+@@ -1905,12 +1910,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;
+@@ -1930,7 +1937,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;
+@@ -7136,6 +7148,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/python36/patches/patch-Modules_socketmodule.h
diff -u /dev/null pkgsrc/lang/python36/patches/patch-Modules_socketmodule.h:1.1
--- /dev/null   Tue May 30 13:36:39 2017
+++ pkgsrc/lang/python36/patches/patch-Modules_socketmodule.h   Tue May 30 13:36:39 2017
@@ -0,0 +1,15 @@
+$NetBSD: patch-Modules_socketmodule.h,v 1.1 2017/05/30 13:36:39 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/python36/patches/patch-pyconfig.h.in
diff -u /dev/null pkgsrc/lang/python36/patches/patch-pyconfig.h.in:1.1
--- /dev/null   Tue May 30 13:36:39 2017
+++ pkgsrc/lang/python36/patches/patch-pyconfig.h.in    Tue May 30 13:36:39 2017
@@ -0,0 +1,16 @@
+$NetBSD: patch-pyconfig.h.in,v 1.1 2017/05/30 13:36:39 bouyer Exp $
+
+detect netcan/can.h on NetBSD
+
+--- pyconfig.h.in.orig 2017-05-30 12:31:24.586818399 +0200
++++ pyconfig.h.in      2017-05-30 12:32:29.367288479 +0200
+@@ -565,6 +565,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