diff options
author | Bernhard Walle <bernhard@bwalle.de> | 2015-01-25 19:11:56 +0100 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2015-01-26 15:10:37 +0100 |
commit | fc4a6d579307356f9ab7c4edd1118deee5ad31d0 (patch) | |
tree | 4d7726c52c604b10fbfa1f94c5f4d8b160b42abd /rules/pyserial3.make | |
parent | 5ccd874a5602c236f71d9b68f365374b7c5b2aa0 (diff) | |
download | ptxdist-fc4a6d579307356f9ab7c4edd1118deee5ad31d0.tar.gz ptxdist-fc4a6d579307356f9ab7c4edd1118deee5ad31d0.tar.xz |
pyserial3: Provide pyserial package for Python 3
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>
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'rules/pyserial3.make')
-rw-r--r-- | rules/pyserial3.make | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/rules/pyserial3.make b/rules/pyserial3.make new file mode 100644 index 000000000..534ced6eb --- /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 |