mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Bernhard Walle <bernhard@bwalle.de>
To: ptxdist@pengutronix.de
Cc: Bernhard Walle <bernhard@bwalle.de>
Subject: [ptxdist] [PATCH 5/5] pyserial3: Provide pyserial package for Python 3
Date: Sun, 25 Jan 2015 19:11:56 +0100	[thread overview]
Message-ID: <1422209516-11310-5-git-send-email-bernhard@bwalle.de> (raw)
In-Reply-To: <1422209516-11310-1-git-send-email-bernhard@bwalle.de>

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 <bernhard@bwalle.de>
---
 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 <jbe@pengutronix.de>
+# Copyright (C) 2015 by Bernhard Walle <bernhard@bwalle.de>
+#
+# 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 <bernhard@bwalle.de>")
+	@$(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

  parent reply	other threads:[~2015-01-25 18:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-25 18:11 [ptxdist] [PATCH 1/5] Update host-cmake to 3.1.1 Bernhard Walle
2015-01-25 18:11 ` [ptxdist] [PATCH 2/5] sqlite: version bump 3.8.7.1 -> 3.8.8.1 Bernhard Walle
2015-01-25 18:11 ` [ptxdist] [PATCH 3/5] pyserial: Version bump 2.6 -> 2.7 Bernhard Walle
2015-01-25 18:11 ` [ptxdist] [PATCH 4/5] python3: Add menu for python3 3rd-party modules Bernhard Walle
2015-01-25 18:11 ` Bernhard Walle [this message]
2015-01-27  8:11   ` [ptxdist] [PATCH 5/5] pyserial3: Provide pyserial package for Python 3 Michael Olbrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1422209516-11310-5-git-send-email-bernhard@bwalle.de \
    --to=bernhard@bwalle.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox