From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from smtprelay02.ispgateway.de ([80.67.31.25]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1YFRfK-0003x7-Tn for ptxdist@pengutronix.de; Sun, 25 Jan 2015 19:12:07 +0100 From: Bernhard Walle Date: Sun, 25 Jan 2015 19:11:56 +0100 Message-Id: <1422209516-11310-5-git-send-email-bernhard@bwalle.de> In-Reply-To: <1422209516-11310-1-git-send-email-bernhard@bwalle.de> References: <1422209516-11310-1-git-send-email-bernhard@bwalle.de> Subject: [ptxdist] [PATCH 5/5] pyserial3: Provide pyserial package for Python 3 Reply-To: ptxdist@pengutronix.de List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: ptxdist@pengutronix.de Cc: Bernhard Walle This upstream package can be used for both Python 2.7 and Python 3. I'm providing the python 3 variant as 'pyserial3'. The package is designed so that it can be built and installed in parallel to pyserial (Python 2 installation). So I renamed the miniterm.py to miniterm3.py. The other example are not installed as renaming all of them wasn't worth the effort in my opinion. Signed-off-by: Bernhard Walle --- rules/pyserial3.in | 26 +++++++++++++ rules/pyserial3.make | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 rules/pyserial3.in create mode 100644 rules/pyserial3.make diff --git a/rules/pyserial3.in b/rules/pyserial3.in new file mode 100644 index 0000000..3cb83e5 --- /dev/null +++ b/rules/pyserial3.in @@ -0,0 +1,26 @@ +## SECTION=python3 + +menuconfig PYSERIAL3 + tristate + select PYTHON3 + prompt "pyserial " + help + This module encapsulates the access for the serial port. It provides + backends for Python running on Windows, Linux, BSD (possibly any + POSIX compliant system), Jython and IronPython (.NET and Mono). The + module named "serial" automatically selects the appropriate backend. + + - Project Homepage: http://pyserial.sourceforge.net + - Project page on SourceForge: http://sourceforge.net/projects/pyserial/ + - SVN repository: http://sourceforge.net/svn/?group_id=46487 + - Download Page: http://sourceforge.net/project/showfiles.php?group_id=46487 + +if PYSERIAL3 + +config PYSERIAL3_MINITERM + bool + prompt "Install 'miniterm'" + help + Install the miniterm script coming with this package. + +endif diff --git a/rules/pyserial3.make b/rules/pyserial3.make new file mode 100644 index 0000000..534ced6 --- /dev/null +++ b/rules/pyserial3.make @@ -0,0 +1,105 @@ +# -*-makefile-*- +# +# Copyright (C) 2011 by Juergen Beisert +# Copyright (C) 2015 by Bernhard Walle +# +# See CREDITS for details about who has contributed to this project. +# +# For further information about the PTXdist project and license conditions +# see the README file. +# + +# +# We provide this package +# +PACKAGES-$(PTXCONF_PYSERIAL3) += pyserial3 + +# +# Paths and names +# +PYSERIAL3_VERSION := 2.7 +PYSERIAL3_MD5 := 794506184df83ef2290de0d18803dd11 +PYSERIAL3 := pyserial3-$(PYSERIAL3_VERSION) +PYSERIAL3_SUFFIX := tar.gz +PYSERIAL3_URL := http://pypi.python.org/packages/source/p/pyserial/pyserial-$(PYSERIAL3_VERSION).$(PYSERIAL3_SUFFIX) +PYSERIAL3_SOURCE := $(SRCDIR)/$(PYSERIAL3).$(PYSERIAL3_SUFFIX) +PYSERIAL3_DIR := $(BUILDDIR)/$(PYSERIAL3) +PYSERIAL3_LICENSE := BSD + +# ---------------------------------------------------------------------------- +# Extract +# ---------------------------------------------------------------------------- + +$(STATEDIR)/pyserial3.extract: + @$(call targetinfo) + @$(call clean, $(PYSERIAL3_DIR)) + @$(call extract, PYSERIAL3) + @$(call patchin, PYSERIAL3) + @(cd $(PYSERIAL3_DIR) ; \ + find . -name '*.py' -exec sed -i \ + 's@#! \?/usr/bin/env python@#!/usr/bin/env python3@g' {} \;) + @$(call touch) + +# ---------------------------------------------------------------------------- +# Prepare +# ---------------------------------------------------------------------------- + +PYSERIAL3_PATH := PATH=$(CROSS_PATH) +PYSERIAL3_CONF_TOOL := NO +PYSERIAL3_MAKE_ENV := $(CROSS_ENV) + +# ---------------------------------------------------------------------------- +# Compile +# ---------------------------------------------------------------------------- + +$(STATEDIR)/pyserial3.compile: + @$(call targetinfo) + @$(call touch) + +# ---------------------------------------------------------------------------- +# Install +# ---------------------------------------------------------------------------- + +$(STATEDIR)/pyserial3.install: + @$(call targetinfo) + @cd $(PYSERIAL3_DIR) && \ + $(PYSERIAL3_PATH) $(PYSERIAL3_MAKE_ENV) \ + python3 setup.py install --root=$(PYSERIAL3_PKGDIR) --prefix=/usr + @$(call touch) + +# ---------------------------------------------------------------------------- +# Target-Install +# ---------------------------------------------------------------------------- + +$(STATEDIR)/pyserial3.targetinstall: + @$(call targetinfo) + + @$(call install_init, pyserial3) + @$(call install_fixup, pyserial3,PRIORITY,optional) + @$(call install_fixup, pyserial3,SECTION,base) + @$(call install_fixup, pyserial3,AUTHOR,"Bernhard Walle ") + @$(call install_fixup, pyserial3,DESCRIPTION, "Serial Communication for Python") + + @$(call install_copy, pyserial3, 0, 0, 0755, $(PYTHON3_SITEPACKAGES)) + @$(call install_copy, pyserial3, 0, 0, 0755, $(PYTHON3_SITEPACKAGES)/serial) + @$(call install_copy, pyserial3, 0, 0, 0755, $(PYTHON3_SITEPACKAGES)/serial/tools) + @$(call install_copy, pyserial3, 0, 0, 0755, $(PYTHON3_SITEPACKAGES)/serial/urlhandler) + + @for file in $(shell cd $(PYSERIAL3_PKGDIR) && find . -name "*.pyc"); \ + do \ + $(call install_copy, pyserial3, 0, 0, 0644, -, /$$file); \ + done + +# note: the setup.py also installs the miniterm.py script, but with a really +# broken path to the python interpreter. As a workaround we use the plain script +# from the build directory instead +ifdef PTXCONF_PYSERIAL3_MINITERM + $(call install_copy, pyserial3, 0, 0, 0755, \ + $(PYSERIAL3_DIR)/build/lib/serial/tools/miniterm.py, /usr/bin/miniterm3.py) +endif + + @$(call install_finish, pyserial3) + + @$(call touch) + +# vim: syntax=make -- 2.2.2 -- ptxdist mailing list ptxdist@pengutronix.de