[1/1] python-cython: new package

Message ID 20171106203539.26391-1-joseph.kogut@gmail.com
State Changes Requested
Headers show
Series
  • [1/1] python-cython: new package
Related show

Commit Message

Joseph Kogut Nov. 6, 2017, 8:35 p.m.
Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
---
 DEVELOPERS                               |  1 +
 package/Config.in.host                   |  1 +
 package/python-cython/Config.in.host     |  7 +++++++
 package/python-cython/python-cython.hash |  6 ++++++
 package/python-cython/python-cython.mk   | 16 ++++++++++++++++
 5 files changed, 31 insertions(+)
 create mode 100644 package/python-cython/Config.in.host
 create mode 100644 package/python-cython/python-cython.hash
 create mode 100644 package/python-cython/python-cython.mk

Comments

Thomas Petazzoni Nov. 25, 2017, 12:45 p.m. | #1
Hello,

On Mon,  6 Nov 2017 12:35:39 -0800, Joseph Kogut wrote:


> diff --git a/package/python-cython/Config.in.host b/package/python-cython/Config.in.host
> new file mode 100644
> index 0000000000..69d32d5ab3
> --- /dev/null
> +++ b/package/python-cython/Config.in.host
> @@ -0,0 +1,7 @@
> +config BR2_PACKAGE_HOST_PYTHON_CYTHON
> +	bool "host python-cython"
> +	help
> +	  The Cython compiler for writing C extensions for the Python
> +	  language.
> +
> +	  http://cython.org/

Could you briefly explain the use-case for Cython, in the context of
Buildroot? How are you using it? To achieve what?

I'm just trying to understand whether it makes sense to have a visible
option in menuconfig for this package (or not).

Thanks!

Thomas
Joseph Kogut Nov. 25, 2017, 6:34 p.m. | #2
Hi Thomas,

On Sat, Nov 25, 2017 at 4:45 AM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Hello,
>
> On Mon,  6 Nov 2017 12:35:39 -0800, Joseph Kogut wrote:
>
>
>> diff --git a/package/python-cython/Config.in.host b/package/python-cython/Config.in.host
>> new file mode 100644
>> index 0000000000..69d32d5ab3
>> --- /dev/null
>> +++ b/package/python-cython/Config.in.host
>> @@ -0,0 +1,7 @@
>> +config BR2_PACKAGE_HOST_PYTHON_CYTHON
>> +     bool "host python-cython"
>> +     help
>> +       The Cython compiler for writing C extensions for the Python
>> +       language.
>> +
>> +       http://cython.org/
>
> Could you briefly explain the use-case for Cython, in the context of
> Buildroot? How are you using it? To achieve what?

Cython is a dependency of certain Python packages, where it's used in
setup.py to convert Python modules with modified syntax to C, at
which point they're compiled into C extensions. Specifically, I'm
looking to introduce a package for Kivy (https://kivy.org), which
makes use of Cython heavily.

> I'm just trying to understand whether it makes sense to have a visible
> option in menuconfig for this package (or not).

That's a great question, and the answer at this point is that it
probably doesn't. Cython requires a compiler to work, and only the
binaries it generates belong in the target. It might make more sense
for packages that require it to specify it as a dependency in their
makefile.

Would you like me to make that change?
Arnout Vandecappelle (Essensium/Mind) Nov. 25, 2017, 7:37 p.m. | #3
Hi Joseph,

On 25-11-17 19:34, Joseph Kogut wrote:
> Hi Thomas,
> 
> On Sat, Nov 25, 2017 at 4:45 AM, Thomas Petazzoni
> <thomas.petazzoni@free-electrons.com> wrote:
>> Hello,
>>
>> On Mon,  6 Nov 2017 12:35:39 -0800, Joseph Kogut wrote:
>>
>>
>>> diff --git a/package/python-cython/Config.in.host b/package/python-cython/Config.in.host
>>> new file mode 100644
>>> index 0000000000..69d32d5ab3
>>> --- /dev/null
>>> +++ b/package/python-cython/Config.in.host
>>> @@ -0,0 +1,7 @@
>>> +config BR2_PACKAGE_HOST_PYTHON_CYTHON
>>> +     bool "host python-cython"
>>> +     help
>>> +       The Cython compiler for writing C extensions for the Python
>>> +       language.
>>> +
>>> +       http://cython.org/
>>
>> Could you briefly explain the use-case for Cython, in the context of
>> Buildroot? How are you using it? To achieve what?
> 
> Cython is a dependency of certain Python packages, where it's used in
> setup.py to convert Python modules with modified syntax to C, at
> which point they're compiled into C extensions. Specifically, I'm
> looking to introduce a package for Kivy (https://kivy.org), which
> makes use of Cython heavily.
> 
>> I'm just trying to understand whether it makes sense to have a visible
>> option in menuconfig for this package (or not).
> 
> That's a great question, and the answer at this point is that it
> probably doesn't. Cython requires a compiler to work, and only the
> binaries it generates belong in the target. It might make more sense
> for packages that require it to specify it as a dependency in their
> makefile.
> 
> Would you like me to make that change?

 Yes please. But then it doesn't make sense to submit the package until there is
another package that actually uses it. So please submit it in a series when you
submit kivy.

 When you do, could you make one more small change: in the hash file, you have
'locally computed' and later 'locally calculated'. Use just one of the two
expressions. 'computed' seems to be more popular.

 Regards,
 Arnout

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index c651bf26fa..faeab79d63 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -788,6 +788,7 @@  F:	board/qemu/ppc64le-pseries/
 F:	configs/qemu_ppc64le_pseries_defconfig
 
 N:	Joseph Kogut <joseph.kogut@gmail.com>
+F:	package/python-cython/
 F:	package/python-websockets/
 
 N:	Johan Derycke <johanderycke@gmail.com>
diff --git a/package/Config.in.host b/package/Config.in.host
index 3755310de4..a15a11b07d 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -38,6 +38,7 @@  menu "Host utilities"
 	source "package/pkgconf/Config.in.host"
 	source "package/pru-software-support/Config.in.host"
 	source "package/pwgen/Config.in.host"
+	source "package/python-cython/Config.in.host"
 	source "package/python-lxml/Config.in.host"
 	source "package/python-six/Config.in.host"
 	source "package/qemu/Config.in.host"
diff --git a/package/python-cython/Config.in.host b/package/python-cython/Config.in.host
new file mode 100644
index 0000000000..69d32d5ab3
--- /dev/null
+++ b/package/python-cython/Config.in.host
@@ -0,0 +1,7 @@ 
+config BR2_PACKAGE_HOST_PYTHON_CYTHON
+	bool "host python-cython"
+	help
+	  The Cython compiler for writing C extensions for the Python
+	  language.
+
+	  http://cython.org/
diff --git a/package/python-cython/python-cython.hash b/package/python-cython/python-cython.hash
new file mode 100644
index 0000000000..33b6bb6bbf
--- /dev/null
+++ b/package/python-cython/python-cython.hash
@@ -0,0 +1,6 @@ 
+# md5 from https://pypi.python.org/pypi/Cython/json, sha256 locally computed
+md5	6149238287d662bd5d5e572482252493  Cython-0.27.3.tar.gz
+sha256	6a00512de1f2e3ce66ba35c5420babaef1fe2d9c43a8faab4080b0dbcc26bc64  Cython-0.27.3.tar.gz
+# License files, locally calculated
+sha256	a6cba85bc92e0cff7a450b1d873c0eaa2e9fc96bf472df0247a26bec77bf3ff9  LICENSE.txt
+sha256	e1eb1c49a8508e8173dac30157e4a6439a44ad8846194746c424fbc3fc2b95d7  COPYING.txt
diff --git a/package/python-cython/python-cython.mk b/package/python-cython/python-cython.mk
new file mode 100644
index 0000000000..26fbaa4253
--- /dev/null
+++ b/package/python-cython/python-cython.mk
@@ -0,0 +1,16 @@ 
+################################################################################
+#
+# cython
+#
+################################################################################
+
+PYTHON_CYTHON_VERSION = 0.27.3
+PYTHON_CYTHON_SOURCE = Cython-$(PYTHON_CYTHON_VERSION).tar.gz
+PYTHON_CYTHON_SITE = https://pypi.python.org/packages/ee/2a/c4d2cdd19c84c32d978d18e9355d1ba9982a383de87d0fcb5928553d37f4
+PYTHON_CYTHON_SETUP_TYPE = setuptools
+PYTHON_CYTHON_LICENSE = Apache-2.0
+PYTHON_CYTHON_LICENSE_FILES = COPYING.txt LICENSE.txt
+
+# Since there's no toolchain or development files on the target, it makes no
+# sense to allow Cython to be installed to the target
+$(eval $(host-python-package))