Introduce New Package PySnmp
cover Introduce New Package PySnmp
This patchset adds support for building PySnmp. One thing that I'm not sure on and am open to debate is the naming of the packages under Target Packages > Interpreter languages and scripting > external python modules in the menuconfig since the majority of the packages are named python-<pkg_name> but pygame and pyparsing don't fall under this category.
Menuconfig
-> python-nfc
-> python-protobuf
-> pygame
-> pyparsing
-> python-pyro
-> python-pyzmq
The make rules for the pygame and pyparsing packages are python-pygame python-pyparsing.
Location of the packages in buildroot is package/python-pygame and package/python-pyparsing.
Question I have for the packages I added is the following:
Should I follow what is currently done for pygame and pyparsing or should I keep them how I have things done and change the name of pygame and pyparsing in seperate patches? Whatever is chosen, I would just like to have consistency with naming.
My vote is to change pygame and pyparsing names. But my mind can easily be changed.
Ryan Barnett (5):
python-pyasn: new package
python-pycrypto: new package
python-pysnmp: new package
python-pysnmp-apps: new package
python-pysnmp-mibs: new package
package/Config.in | 7 ++++ package/python-pyasn/Config.in | 13 +++++++ package/python-pyasn/python-pyasn.mk | 38 ++++++++++++++++++++++ package/python-pycrypto/Config.in | 8 ++++ package/python-pycrypto/python-pycrypto.mk | 25 ++++++++++++++ package/python-pysnmp-apps/Config.in | 7 ++++ package/python-pysnmp-apps/python-pysnmp-apps.mk | 23 +++++++++++++ package/python-pysnmp-mibs/Config.in | 8 ++++ package/python-pysnmp-mibs/python-pysnmp-mibs.mk | 23 +++++++++++++ package/python-pysnmp/Config.in | 10 ++++++ package/python-pysnmp/python-pysnmp.mk | 23 +++++++++++++ 11 files changed, 185 insertions(+), 0 deletions(-) create mode 100644 package/python-pyasn/Config.in create mode 100644 package/python-pyasn/python-pyasn.mk create mode 100644 package/python-pycrypto/Config.in create mode 100644 package/python-pycrypto/python-pycrypto.mk create mode 100644 package/python-pysnmp-apps/Config.in create mode 100644 package/python-pysnmp-apps/python-pysnmp-apps.mk create mode 100644 package/python-pysnmp-mibs/Config.in create mode 100644 package/python-pysnmp-mibs/python-pysnmp-mibs.mk create mode 100644 package/python-pysnmp/Config.in create mode 100644 package/python-pysnmp/python-pysnmp.mk
PATCH 1/5 python-pyasn: new package
---
The definition of CFLAGS/LDFLAGS/LDSHARED is necessary since the compilation of won't work correctly using either TARGET_CONFIGURE_OPTS because it won't link against the correct python library. Also using python-distutilcross doesn't work as the setup.py doesn't understand the -x option.
--- package/Config.in | 1 + package/python-pyasn/Config.in | 13 +++++++++++ package/python-pyasn/python-pyasn.mk | 38 ++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 0 deletions(-) create mode 100644 package/python-pyasn/Config.in create mode 100644 package/python-pyasn/python-pyasn.mk
package/Config.in +1 -0
@@ -396,6 +396,7 @@ source "package/python-meld3/Config.in" source "package/python-netifaces/Config.in" source "package/python-nfc/Config.in" source "package/python-protobuf/Config.in" +source "package/python-pyasn/Config.in" source "package/python-pygame/Config.in" source "package/python-pyparsing/Config.in" source "package/python-pyro/Config.in"
package/python-pyasn/Config.in new file +13 -0
@@ -0,0 +1,13 @@ +config BR2_PACKAGE_PYTHON_PYASN + bool "python-pyasn" + depends on BR2_PACKAGE_PYTHON + depends on BR2_INSTALL_LIBSTDCPP + help + PyASN is a Python extension module that enables you to + perform very fast IP address to Autonomous System Number + lookups. + + https://code.google.com/p/pyasn/ + +comment "python-pyasn requires C++ support in toolchain" + depends on !BR2_INSTALL_LIBSTDCPP
package/python-pyasn/python-pyasn.mk new file +38 -0
@@ -0,0 +1,38 @@ +################################################################################ +# +# python-pyasn +# +################################################################################ + +PYTHON_PYASN_VERSION = 1.2 +PYTHON_PYASN_SOURCE = PyASN-$(PYTHON_PYASN_VERSION).zip +PYTHON_PYASN_SITE = https://pyasn.googlecode.com/files +PYTHON_PYASN_LICENSE = LGPL + +PYTHON_PYASN_DEPENDENCIES = python + +define PYTHON_PYASN_EXTRACT_CMDS + unzip -d $(@D) $(DL_DIR)/$(PYTHON_PYASN_SOURCE) + mv $(@D)/PyASN-$(PYTHON_PYASN_VERSION)/* $(@D) + $(RM) -r $(@D)/PyASN-$(PYTHON_PYASN_VERSION) +endef + +define PYTHON_PYASN_BUILD_CMDS + (cd $(@D); \ + CC="$(TARGET_CC)" \ + CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \ + CXX="$(TARGET_CXX)" \ + CXXFLAGS="$(TARGET_CXXFLAGS) -I$(STAGING_DIR)/usr/include" \ + LDSHARED="$(TARGET_CC) -shared" \ + LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib" \ + $(HOST_DIR)/usr/bin/python setup.py build_ext \ + --include-dirs=$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR) \ + ) + (cd $(@D); $(HOST_DIR)/usr/bin/python setup.py build) +endef + +define PYTHON_PYASN_INSTALL_TARGET_CMDS + (cd $(@D); $(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr) +endef + +$(eval $(generic-package))
Signature · 1 line
1.7.1
PATCH 1/5 python-pyasn: new package
Dear Ryan Barnett,
package/python-pyasn/python-pyasn.mk line 27
Quoted 5 lines · Ryan Barnett
package/python-pyasn/python-pyasn.mk new file +5
-0+ CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \ + CXX="$(TARGET_CXX)" \ + CXXFLAGS="$(TARGET_CXXFLAGS) -I$(STAGING_DIR)/usr/include" \ + LDSHARED="$(TARGET_CC) -shared" \ + LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib" \
These additional -I and -L are rather weird because they simply pass what are already the default search paths for headers and libraries.
Thomas
Signature · 3 lines
Thomas Petazzoni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 1/5 python-pyasn: new package
Thomas,
Thomas Petazzoni <[email protected]> wrote on 10/03/2013 04:17:55 PM:
Quoted 9 lines
Dear Ryan Barnett,
package/python-pyasn/python-pyasn.mk
Quoted 5 lines · Ryan Barnett
package/python-pyasn/python-pyasn.mk new file +5
-0+ CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \ + CXX="$(TARGET_CXX)" \ + CXXFLAGS="$(TARGET_CXXFLAGS) -I$(STAGING_DIR)/usr/include" \ + LDSHARED="$(TARGET_CC) -shared" \ + LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/lib -L$
Quoted 4 lines
(STAGING_DIR)/usr/lib" \
These additional -I and -L are rather weird because they simply pass what are already the default search paths for headers and libraries.
The additional -I and -L are needed to ensure that the $(STAGING_DIR) header and library files are pulled. Otherwise the distutils package before the ones that the distutils package will find the headers/libraries that are located at $(HOST_DIR)/usr.
I've added this comment to both pyasn and pycrypto. I'm not a fan of it but I don't really want to rewrite the setup.py in order to support cross compiling.
Quoted 5 lines
Thomas
Signature · 3 lines
Thomas Petazzoni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 2/5 python-pycrypto: new package
In reply to Ryan Barnett--- package/Config.in | 1 + package/python-pycrypto/Config.in | 8 ++++++++ package/python-pycrypto/python-pycrypto.mk | 25 +++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 0 deletions(-) create mode 100644 package/python-pycrypto/Config.in create mode 100644 package/python-pycrypto/python-pycrypto.mk
package/Config.in +1 -0
@@ -397,6 +397,7 @@ source "package/python-netifaces/Config.in" source "package/python-nfc/Config.in" source "package/python-protobuf/Config.in" source "package/python-pyasn/Config.in" +source "package/python-pycrypto/Config.in" source "package/python-pygame/Config.in" source "package/python-pyparsing/Config.in" source "package/python-pyro/Config.in"
package/python-pycrypto/Config.in new file +8 -0
@@ -0,0 +1,8 @@ +config BR2_PACKAGE_PYTHON_PYCRYPTO + bool "python-pycrypto" + depends on BR2_PACKAGE_PYTHON + help + PyCrypto is a collection of cryptographic algorithms and + protocols, implemented for use from Python. + + http://www.pycrypto.org/
package/python-pycrypto/python-pycrypto.mk new file +25 -0
@@ -0,0 +1,25 @@ +################################################################################ +# +# python-pycrypto +# +################################################################################ + +PYTHON_PYCRYPTO_VERSION = 2.6 +PYTHON_PYCRYPTO_SOURCE = pycrypto-$(PYTHON_PYCRYPTO_VERSION).tar.gz +PYTHON_PYCRYPTO_SITE = http://ftp.dlitz.net/pub/dlitz/crypto/pycrypto +PYTHON_PYCRYPTO_LICENSE = Public Domain, Python 2.2 License (HMAC.py, setup.py) + +PYTHON_PYCRYPTO_LICENSE_FILES = COPYRIGHT LEGAL/copy/LICENSE.libtom \ + LEGAL/copy/LICENSE.orig LEGAL/copy/LICENSE.python-2.2 + +PYTHON_PYCRYPTO_DEPENDENCIES = python + +define PYTHON_PYCRYPTO_BUILD_CMDS + (cd $(@D); $(HOST_DIR)/usr/bin/python setup.py build --executable=/usr/bin/python) +endef + +define PYTHON_PYCRYPTO_INSTALL_TARGET_CMDS + (cd $(@D); $(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr) +endef + +$(eval $(generic-package))
Signature · 1 line
1.7.1
PATCH 2/5 python-pycrypto: new package
Ryan Barnett <[email protected]> wrote on 10/03/2013 03:01:02 PM:
[...]
Review
Quoted 2 lines
(quoted diff) +0
-0@@ -0,0 +1,25 @@
+################################################################################
package/python-pycrypto/python-pycrypto.mk line 4
Quoted 4 lines
package/python-pycrypto/python-pycrypto.mk new file +3
-0+# +# python-pycrypto +#
+################################################################################
package/python-pycrypto/python-pycrypto.mk
Quoted 4 lines
package/python-pycrypto/python-pycrypto.mk new file +4
-0+ +PYTHON_PYCRYPTO_VERSION = 2.6 +PYTHON_PYCRYPTO_SOURCE = pycrypto-$(PYTHON_PYCRYPTO_VERSION).tar.gz +PYTHON_PYCRYPTO_SITE =
Review line 8
Quoted 1 line
(quoted diff) +1
-0+PYTHON_PYCRYPTO_LICENSE = Public Domain, Python 2.2 License
(HMAC.py,setup.py)
Quoted 10 lines
package/python-pycrypto/python-pycrypto.mk new file +8
-0+ +PYTHON_PYCRYPTO_LICENSE_FILES = COPYRIGHT LEGAL/copy/LICENSE.libtom \ + LEGAL/copy/LICENSE.orig LEGAL/copy/LICENSE.python-2.2 + +PYTHON_PYCRYPTO_DEPENDENCIES = python + +define PYTHON_PYCRYPTO_BUILD_CMDS + (cd $(@D); $(HOST_DIR)/usr/bin/python setup.py build --executable=/usr/bin/python)
+endef
I realized now that I'm not actually compiling some of the shared library objects for the target. I will fix this in my next version of this patchset.
I need to more closely follow what I did in python-pyasn with attempting to use TARGET_CONFIG_OPT or python-distutilscross.
package/python-pycrypto/python-pycrypto.mk line 25
Quoted 7 lines
package/python-pycrypto/python-pycrypto.mk new file +3
-0+ +define PYTHON_PYCRYPTO_INSTALL_TARGET_CMDS + (cd $(@D); $(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr)
package/python-pycrypto/python-pycrypto.mk new file +3
-0+endef + +$(eval $(generic-package))
Thanks,
-Ryan
PATCH 3/5 python-pysnmp: new package
In reply to Ryan Barnett---
Even though the documentation for PySNMP says PyCrypto is an optional dependancy, it is required for any system besides Windows. (see Setup.py)
--- package/Config.in | 1 + package/python-pysnmp/Config.in | 10 ++++++++++ package/python-pysnmp/python-pysnmp.mk | 23 +++++++++++++++++++++++ 3 files changed, 34 insertions(+), 0 deletions(-) create mode 100644 package/python-pysnmp/Config.in create mode 100644 package/python-pysnmp/python-pysnmp.mk
package/Config.in +1 -0
@@ -401,6 +401,7 @@ source "package/python-pycrypto/Config.in" source "package/python-pygame/Config.in" source "package/python-pyparsing/Config.in" source "package/python-pyro/Config.in" +source "package/python-pysnmp/Config.in" source "package/python-pyzmq/Config.in" source "package/python-serial/Config.in" source "package/python-setuptools/Config.in"
package/python-pysnmp/Config.in new file +10 -0
@@ -0,0 +1,10 @@ +config BR2_PACKAGE_PYTHON_PYSNMP + bool "python-pysnmp" + depends on BR2_PACKAGE_PYTHON + select BR2_PACKAGE_PYTHON_PYASN + select BR2_PACKAGE_PYTHON_PYCRYPTO + help + PySNMP is a cross-platform, pure-Python SNMP engine + implementation. + + http://pysnmp.sf.net
package/python-pysnmp/python-pysnmp.mk new file +23 -0
@@ -0,0 +1,23 @@ +################################################################################ +# +# python-pysnmp +# +################################################################################ + +PYTHON_PYSNMP_VERSION = 4.2.4 +PYTHON_PYSNMP_SOURCE = pysnmp-$(PYTHON_PYSNMP_VERSION).tar.gz +PYTHON_PYSNMP_SITE = https://pypi.python.org/packages/source/p/pysnmp +PYTHON_PYSNMP_LICENSE = BSD-3c +PYTHON_PYSNMP_LICENSE_FILES = LICENSE + +PYTHON_PYSNMP_DEPENDENCIES = python python-pyasn python-pycrypto + +define PYTHON_PYSNMP_BUILD_CMDS + (cd $(@D); $(HOST_DIR)/usr/bin/python setup.py build --executable=/usr/bin/python) +endef + +define PYTHON_PYSNMP_INSTALL_TARGET_CMDS + (cd $(@D); $(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr) +endef + +$(eval $(generic-package))
Signature · 1 line
1.7.1
PATCH 4/5 python-pysnmp-apps: new package
In reply to Ryan Barnett--- package/Config.in | 3 ++ package/python-pysnmp-apps/Config.in | 7 ++++++ package/python-pysnmp-apps/python-pysnmp-apps.mk | 23 ++++++++++++++++++++++ 3 files changed, 33 insertions(+), 0 deletions(-) create mode 100644 package/python-pysnmp-apps/Config.in create mode 100644 package/python-pysnmp-apps/python-pysnmp-apps.mk
package/Config.in +3 -0
@@ -402,6 +402,9 @@ source "package/python-pygame/Config.in" source "package/python-pyparsing/Config.in" source "package/python-pyro/Config.in" source "package/python-pysnmp/Config.in" +if BR2_PACKAGE_PYTHON_PYSNMP +source "package/python-pysnmp-apps/Config.in" +endif source "package/python-pyzmq/Config.in" source "package/python-serial/Config.in" source "package/python-setuptools/Config.in"
package/python-pysnmp-apps/Config.in new file +7 -0
@@ -0,0 +1,7 @@ +config BR2_PACKAGE_PYTHON_PYSNMP_APPS + bool "python-pysnmp-apps" + help + PySNMP MIBs is a set of IETF & IANA MIBs pre-compiled and + packaged to simplify their use with the PySNMP library. + + http://pysnmp.sf.net
package/python-pysnmp-apps/python-pysnmp-apps.mk new file +23 -0
@@ -0,0 +1,23 @@ +################################################################################ +# +# python-pysnmp-apps +# +################################################################################ + +PYTHON_PYSNMP_APPS_VERSION = 0.3.3 +PYTHON_PYSNMP_APPS_SOURCE = pysnmp-apps-$(PYTHON_PYSNMP_APPS_VERSION).tar.gz +PYTHON_PYSNMP_APPS_SITE = https://pypi.python.org/packages/source/p/pysnmp-apps +PYTHON_PYSNMP_APPS_LICENSE = BSD-3c +PYTHON_PYSNMP_APPS_LICENSE_FILES = LICENSE + +PYTHON_PYSNMP_APPS_DEPENDENCIES = python python-pysnmp + +define PYTHON_PYSNMP_APPS_BUILD_CMDS + (cd $(@D); $(HOST_DIR)/usr/bin/python setup.py build --executable=/usr/bin/python) +endef + +define PYTHON_PYSNMP_APPS_INSTALL_TARGET_CMDS + (cd $(@D); $(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr) +endef + +$(eval $(generic-package))
Signature · 1 line
1.7.1
PATCH 5/5 python-pysnmp-mibs: new package
In reply to Ryan Barnett--- package/Config.in | 1 + package/python-pysnmp-mibs/Config.in | 8 +++++++ package/python-pysnmp-mibs/python-pysnmp-mibs.mk | 23 ++++++++++++++++++++++ 3 files changed, 32 insertions(+), 0 deletions(-) create mode 100644 package/python-pysnmp-mibs/Config.in create mode 100644 package/python-pysnmp-mibs/python-pysnmp-mibs.mk
package/Config.in +1 -0
@@ -404,6 +404,7 @@ source "package/python-pyro/Config.in" source "package/python-pysnmp/Config.in" if BR2_PACKAGE_PYTHON_PYSNMP source "package/python-pysnmp-apps/Config.in" +source "package/python-pysnmp-mibs/Config.in" endif source "package/python-pyzmq/Config.in" source "package/python-serial/Config.in"
package/python-pysnmp-mibs/Config.in new file +8 -0
@@ -0,0 +1,8 @@ +config BR2_PACKAGE_PYTHON_PYSNMP_MIBS + bool "python-pysnmp-mibs" + depends on BR2_PACKAGE_PYTHON && BR2_PACKAGE_PYTHON_PYSNMP + help + PySNMP MIBs is a set of IETF & IANA MIBs pre-compiled and + packaged to simplify their use with the PySNMP library. + + http://pysnmp.sf.net
package/python-pysnmp-mibs/python-pysnmp-mibs.mk new file +23 -0
@@ -0,0 +1,23 @@ +################################################################################ +# +# python-pysnmp-mibs +# +################################################################################ + +PYTHON_PYSNMP_MIBS_VERSION = 0.1.4 +PYTHON_PYSNMP_MIBS_SOURCE = pysnmp-mibs-$(PYTHON_PYSNMP_MIBS_VERSION).tar.gz +PYTHON_PYSNMP_MIBS_SITE = https://pypi.python.org/packages/source/p/pysnmp-mibs +PYTHON_PYSNMP_MIBS_LICENSE = BSD-3c +PYTHON_PYSNMP_MIBS_LICENSE_FILES = LICENSE + +PYTHON_PYSNMP_MIBS_DEPENDENCIES = python python-pysnmp + +define PYTHON_PYSNMP_MIBS_BUILD_CMDS + (cd $(@D); $(HOST_DIR)/usr/bin/python setup.py build --executable=/usr/bin/python) +endef + +define PYTHON_PYSNMP_MIBS_INSTALL_TARGET_CMDS + (cd $(@D); $(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr) +endef + +$(eval $(generic-package))
Signature · 1 line
1.7.1
cover Introduce New Package PySnmp
In reply to Ryan BarnettDear Ryan Barnett,
Quoted 15 lines · Ryan Barnett
This patchset adds support for building PySnmp. One thing that I'm not sure on and am open to debate is the naming of the packages under Target Packages > Interpreter languages and scripting > external python modules in the menuconfig since the majority of the packages are named python-<pkg_name> but pygame and pyparsing don't fall under this category.
Menuconfig
-> python-nfc
-> python-protobuf
-> pygame
-> pyparsing
-> python-pyro
-> python-pyzmq
Quoted 5 lines
The make rules for the pygame and pyparsing packages are python-pygame python-pyparsing.
Location of the packages in buildroot is package/python-pygame and package/python-pyparsing.
Aaah, I now understand better what you were mentioning on IRC. Sorry for not understanding earlier. I did understand that the name of the package was "pyparsing", i.e that it was located in package/pyparsing/. But indeed, it is located in package/python-pyparsing/, so the package name is 'python-pyparsing'. The only thing that doesn't match is the Config.in option prompt, and this is not nice.
So clearly, I'm all for changing the Config.in option name, i.e:
- bool "pyparsing"
+ bool "python-pyparsing"
Thanks, and sorry again for the misunderstanding,
Thomas
Signature · 3 lines
Thomas Petazzoni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
cover Introduce New Package PySnmp
Thomas,
Thomas Petazzoni <[email protected]> wrote on 10/03/2013 04:15:52 PM:
Quoted 6 lines
Dear Ryan Barnett,
Quoted 3 lines · Ryan Barnett
This patchset adds support for building PySnmp. One thing that I'm not sure on and am open to debate is the naming of the packages under Target Packages > Interpreter languages and scripting > external
python
Quoted 30 lines
Quoted 12 lines
modules in the menuconfig since the majority of the packages are named python-<pkg_name> but pygame and pyparsing don't fall under this category.
Menuconfig
-> python-nfc
-> python-protobuf
-> pygame
-> pyparsing
-> python-pyro
-> python-pyzmqQuoted 5 lines
The make rules for the pygame and pyparsing packages are python-pygame python-pyparsing.
Location of the packages in buildroot is package/python-pygame and package/python-pyparsing.
Aaah, I now understand better what you were mentioning on IRC. Sorry for not understanding earlier. I did understand that the name of the package was "pyparsing", i.e that it was located in package/pyparsing/. But indeed, it is located in package/python-pyparsing/, so the package name is 'python-pyparsing'. The only thing that doesn't match is the Config.in option prompt, and this is not nice.
So clearly, I'm all for changing the Config.in option name, i.e:
(quoted diff) +1
-1- bool "pyparsing" + bool "python-pyparsing"
Quoted 1 line
Thanks, and sorry again for the misunderstanding,
Not a problem, I figured I would explain the problem better in this email. I'll work on the patch later but for now I've got to figure how to get pycrypto to cross compile.
Quoted 5 lines
Thomas
Signature · 3 lines
Thomas Petazzoni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com