mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] django: new package to provide Django 1.6.5
@ 2014-07-30 18:12 Uwe Kleine-König
  2014-07-31  8:14 ` Michael Olbrich
  0 siblings, 1 reply; 7+ messages in thread
From: Uwe Kleine-König @ 2014-07-30 18:12 UTC (permalink / raw)
  To: ptxdist

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 rules/django.in   | 29 +++++++++++++++++
 rules/django.make | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 122 insertions(+)
 create mode 100644 rules/django.in
 create mode 100644 rules/django.make

diff --git a/rules/django.in b/rules/django.in
new file mode 100644
index 000000000000..8b66702d4c67
--- /dev/null
+++ b/rules/django.in
@@ -0,0 +1,29 @@
+## SECTION=networking
+
+menuconfig DJANGO
+	tristate
+	select PYTHON
+	select PYTHON_SQLITE
+	select PYTHON_ZLIB
+	prompt "Django                        "
+	help
+	  Django is a high-level Python Web framework that encourages rapid
+	  development and clean, pragmatic design.
+
+if DJANGO
+
+menu "locales"
+
+	config DJANGO_LOCALE_DE
+		bool
+		prompt "de"
+
+	config DJANGO_LOCALE_EN
+		bool
+		prompt "en"
+
+	# add more if needed
+
+endmenu
+
+endif
diff --git a/rules/django.make b/rules/django.make
new file mode 100644
index 000000000000..256f7b8dab0a
--- /dev/null
+++ b/rules/django.make
@@ -0,0 +1,93 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2014 by Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.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_DJANGO) += django
+
+#
+# Paths and names
+#
+DJANGO_VERSION	:= 1.6.5
+DJANGO_MD5	:= e4c5b2d35ecb3807317713afa70a0c77
+DJANGO		:= Django-$(DJANGO_VERSION)
+DJANGO_SUFFIX	:= tar.gz
+DJANGO_URL	:= https://www.djangoproject.com/download/$(DJANGO_VERSION)/tarball/
+DJANGO_SOURCE	:= $(SRCDIR)/$(DJANGO).$(DJANGO_SUFFIX)
+DJANGO_DIR	:= $(BUILDDIR)/$(DJANGO)
+DJANGO_LICENSE	:= BSD
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+DJANGO_PATH		:= PATH=$(CROSS_PATH)
+DJANGO_CONF_TOOL	:= NO
+DJANGO_MAKE_ENV		:= $(CROSS_ENV)
+
+DJANGO_LOCALES-y :=
+DJANGO_LOCALES-$(PTXCONF_DJANGO_LOCALE_DE) += de
+DJANGO_LOCALES-$(PTXCONF_DJANGO_LOCALE_EN) += en
+
+# ----------------------------------------------------------------------------
+# Compile
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/django.compile:
+	@$(call targetinfo)
+	cd $(DJANGO_DIR) && \
+		$(DJANGO_PATH) $(DJANGO_MAKE_ENV) \
+		$(CROSS_PYTHON) setup.py build
+	@$(call touch)
+
+# ----------------------------------------------------------------------------
+# Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/django.install:
+	@$(call targetinfo)
+	cd $(DJANGO_DIR) && \
+		$(DJANGO_PATH) $(DJANGO_MAKE_ENV) \
+		$(CROSS_PYTHON) setup.py install --root=$(DJANGO_PKGDIR) --prefix=/usr -O2
+	@$(call touch)
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/django.targetinstall:
+	@$(call targetinfo)
+
+	@$(call install_init, django)
+	@$(call install_fixup, django, PRIORITY, optional)
+	@$(call install_fixup, django, SECTION, base)
+	@$(call install_fixup, django, AUTHOR, "Robert Schwebel <r.schwebel@pengutronix.de>")
+	@$(call install_fixup, django, DESCRIPTION, missing)
+
+	# everything but locales
+	find "$(DJANGO_PKGDIR)" -type d -name locale -prune -o -type f -printf '/%P\n' | while read fn; do \
+		$(call install_copy, django, 0, 0, 0644, -, $$fn); \
+	done
+
+	# locales
+	find "$(DJANGO_PKGDIR)" -type d -name locale -printf '/%P\n' | while read localedir; do \
+		for locale in $(DJANGO_LOCALES-y); do \
+			find "$(DJANGO_PKGDIR)$$localedir/$$locale" -type f -printf "$$localedir/$$locale/%P\n" | while read fn; do \
+				$(call install_copy, django, 0, 0, 0644, -, $$fn); \
+			done; \
+		done; \
+	done
+
+	@$(call install_finish, django)
+
+	@$(call touch)
+
+# vim: syntax=make
-- 
2.0.1


-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ptxdist] [PATCH] django: new package to provide Django 1.6.5
  2014-07-30 18:12 [ptxdist] [PATCH] django: new package to provide Django 1.6.5 Uwe Kleine-König
@ 2014-07-31  8:14 ` Michael Olbrich
  2014-07-31  8:44   ` Uwe Kleine-König
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Olbrich @ 2014-07-31  8:14 UTC (permalink / raw)
  To: ptxdist

On Wed, Jul 30, 2014 at 08:12:35PM +0200, Uwe Kleine-König wrote:
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  rules/django.in   | 29 +++++++++++++++++
>  rules/django.make | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 122 insertions(+)
>  create mode 100644 rules/django.in
>  create mode 100644 rules/django.make
> 
> diff --git a/rules/django.in b/rules/django.in
> new file mode 100644
> index 000000000000..8b66702d4c67
> --- /dev/null
> +++ b/rules/django.in
> @@ -0,0 +1,29 @@
> +## SECTION=networking
> +
> +menuconfig DJANGO
> +	tristate
> +	select PYTHON
> +	select PYTHON_SQLITE
> +	select PYTHON_ZLIB
> +	prompt "Django                        "
> +	help
> +	  Django is a high-level Python Web framework that encourages rapid
> +	  development and clean, pragmatic design.
> +
> +if DJANGO
> +
> +menu "locales"

Hmmm, I think a string with a proper comment here is better. 'Space
separated list of locales, e.g. "de en"...'
No need to make it harder than necessary to add new locales.

> +
> +	config DJANGO_LOCALE_DE
> +		bool
> +		prompt "de"
> +
> +	config DJANGO_LOCALE_EN
> +		bool
> +		prompt "en"
> +
> +	# add more if needed
> +
> +endmenu
> +
> +endif
> diff --git a/rules/django.make b/rules/django.make
> new file mode 100644
> index 000000000000..256f7b8dab0a
> --- /dev/null
> +++ b/rules/django.make
> @@ -0,0 +1,93 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2014 by Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.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_DJANGO) += django
> +
> +#
> +# Paths and names
> +#
> +DJANGO_VERSION	:= 1.6.5
> +DJANGO_MD5	:= e4c5b2d35ecb3807317713afa70a0c77
> +DJANGO		:= Django-$(DJANGO_VERSION)
> +DJANGO_SUFFIX	:= tar.gz
> +DJANGO_URL	:= https://www.djangoproject.com/download/$(DJANGO_VERSION)/tarball/
> +DJANGO_SOURCE	:= $(SRCDIR)/$(DJANGO).$(DJANGO_SUFFIX)
> +DJANGO_DIR	:= $(BUILDDIR)/$(DJANGO)
> +DJANGO_LICENSE	:= BSD
> +
> +# ----------------------------------------------------------------------------
> +# Prepare
> +# ----------------------------------------------------------------------------
> +
> +DJANGO_PATH		:= PATH=$(CROSS_PATH)
> +DJANGO_CONF_TOOL	:= NO
> +DJANGO_MAKE_ENV		:= $(CROSS_ENV)
> +
> +DJANGO_LOCALES-y :=
> +DJANGO_LOCALES-$(PTXCONF_DJANGO_LOCALE_DE) += de
> +DJANGO_LOCALES-$(PTXCONF_DJANGO_LOCALE_EN) += en
> +
> +# ----------------------------------------------------------------------------
> +# Compile
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/django.compile:
> +	@$(call targetinfo)
> +	cd $(DJANGO_DIR) && \
> +		$(DJANGO_PATH) $(DJANGO_MAKE_ENV) \
> +		$(CROSS_PYTHON) setup.py build

I think the prefix should be added here as well, in case it's used in some
code generation etc.

> +	@$(call touch)
> +
> +# ----------------------------------------------------------------------------
> +# Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/django.install:
> +	@$(call targetinfo)
> +	cd $(DJANGO_DIR) && \
> +		$(DJANGO_PATH) $(DJANGO_MAKE_ENV) \
> +		$(CROSS_PYTHON) setup.py install --root=$(DJANGO_PKGDIR) --prefix=/usr -O2

Why '-O2' here and not in the compile stage?

> +	@$(call touch)
> +
> +# ----------------------------------------------------------------------------
> +# Target-Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/django.targetinstall:
> +	@$(call targetinfo)
> +
> +	@$(call install_init, django)
> +	@$(call install_fixup, django, PRIORITY, optional)
> +	@$(call install_fixup, django, SECTION, base)
> +	@$(call install_fixup, django, AUTHOR, "Robert Schwebel <r.schwebel@pengutronix.de>")
> +	@$(call install_fixup, django, DESCRIPTION, missing)
> +
> +	# everything but locales
> +	find "$(DJANGO_PKGDIR)" -type d -name locale -prune -o -type f -printf '/%P\n' | while read fn; do \
> +		$(call install_copy, django, 0, 0, 0644, -, $$fn); \
> +	done

I dislike just dumping everything in the package, e.g. the egg-info is not
needed. Install /usr/bin/django-admin.py explicitly and then use:

	@cd /usr/lib/python$(PYTHON_MAJORMINOR)/site-packages/django/ && find ...

This way it breaks in case something went wrong and the directory is
missing.

> +
> +	# locales
> +	find "$(DJANGO_PKGDIR)" -type d -name locale -printf '/%P\n' | while read localedir; do \
> +		for locale in $(DJANGO_LOCALES-y); do \
> +			find "$(DJANGO_PKGDIR)$$localedir/$$locale" -type f -printf "$$localedir/$$locale/%P\n" | while read fn; do \

Same here with 'cd' and I think the django.po files are not needed, just
the Python stuff and the compiled django.mo

Michael

> +				$(call install_copy, django, 0, 0, 0644, -, $$fn); \
> +			done; \
> +		done; \
> +	done
> +
> +	@$(call install_finish, django)
> +
> +	@$(call touch)
> +
> +# vim: syntax=make
> -- 
> 2.0.1
> 
> 
> -- 
> ptxdist mailing list
> ptxdist@pengutronix.de

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ptxdist] [PATCH] django: new package to provide Django 1.6.5
  2014-07-31  8:14 ` Michael Olbrich
@ 2014-07-31  8:44   ` Uwe Kleine-König
  2014-07-31  9:08     ` Michael Olbrich
  0 siblings, 1 reply; 7+ messages in thread
From: Uwe Kleine-König @ 2014-07-31  8:44 UTC (permalink / raw)
  To: ptxdist

On Thu, Jul 31, 2014 at 10:14:14AM +0200, Michael Olbrich wrote:
> On Wed, Jul 30, 2014 at 08:12:35PM +0200, Uwe Kleine-König wrote:
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > ---
> >  rules/django.in   | 29 +++++++++++++++++
> >  rules/django.make | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 122 insertions(+)
> >  create mode 100644 rules/django.in
> >  create mode 100644 rules/django.make
> > 
> > diff --git a/rules/django.in b/rules/django.in
> > new file mode 100644
> > index 000000000000..8b66702d4c67
> > --- /dev/null
> > +++ b/rules/django.in
> > @@ -0,0 +1,29 @@
> > +## SECTION=networking
> > +
> > +menuconfig DJANGO
> > +	tristate
> > +	select PYTHON
> > +	select PYTHON_SQLITE
> > +	select PYTHON_ZLIB
> > +	prompt "Django                        "
> > +	help
> > +	  Django is a high-level Python Web framework that encourages rapid
> > +	  development and clean, pragmatic design.
> > +
> > +if DJANGO
> > +
> > +menu "locales"
> 
> Hmmm, I think a string with a proper comment here is better. 'Space
> separated list of locales, e.g. "de en"...'
> No need to make it harder than necessary to add new locales.
ok.

> > new file mode 100644
> > index 000000000000..256f7b8dab0a
> > --- /dev/null
> > +++ b/rules/django.make
> > @@ -0,0 +1,93 @@
> > [...]
> > +
> > +# ----------------------------------------------------------------------------
> > +# Compile
> > +# ----------------------------------------------------------------------------
> > +
> > +$(STATEDIR)/django.compile:
> > +	@$(call targetinfo)
> > +	cd $(DJANGO_DIR) && \
> > +		$(DJANGO_PATH) $(DJANGO_MAKE_ENV) \
> > +		$(CROSS_PYTHON) setup.py build
> 
> I think the prefix should be added here as well, in case it's used in some
> code generation etc.
I wondered about that, too, but:

	.../Django-1.6.5$ python setup.py build --prefix=/usr
	usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
	   or: setup.py --help [cmd1 cmd2 ...]
	   or: setup.py --help-commands
	   or: setup.py cmd --help

	error: option --prefix not recognized

> > +	@$(call touch)
> > +
> > +# ----------------------------------------------------------------------------
> > +# Install
> > +# ----------------------------------------------------------------------------
> > +
> > +$(STATEDIR)/django.install:
> > +	@$(call targetinfo)
> > +	cd $(DJANGO_DIR) && \
> > +		$(DJANGO_PATH) $(DJANGO_MAKE_ENV) \
> > +		$(CROSS_PYTHON) setup.py install --root=$(DJANGO_PKGDIR) --prefix=/usr -O2
> 
> Why '-O2' here and not in the compile stage?
Same thing here:

	.../Django-1.6.5$ python setup.py build -O2
	usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
	   or: setup.py --help [cmd1 cmd2 ...]
	   or: setup.py --help-commands
	   or: setup.py cmd --help

	error: option -O not recognized

and this is not specific to Django. I see the same with my custom python
script that uses plain distutils.

> > +	# everything but locales
> > +	find "$(DJANGO_PKGDIR)" -type d -name locale -prune -o -type f -printf '/%P\n' | while read fn; do \
> > +		$(call install_copy, django, 0, 0, 0644, -, $$fn); \
> > +	done
> 
> I dislike just dumping everything in the package, e.g. the egg-info is not
> needed. Install /usr/bin/django-admin.py explicitly and then use:
> 
> 	@cd /usr/lib/python$(PYTHON_MAJORMINOR)/site-packages/django/ && find ...
> 
> This way it breaks in case something went wrong and the directory is
> missing.
I didn't do that because your approach also breaks when the path for
such packages changes. AFAIK this is the case for Python 3.
But I don't care much and can use your approach.

> > +	# locales
> > +	find "$(DJANGO_PKGDIR)" -type d -name locale -printf '/%P\n' | while read localedir; do \
> > +		for locale in $(DJANGO_LOCALES-y); do \
> > +			find "$(DJANGO_PKGDIR)$$localedir/$$locale" -type f -printf "$$localedir/$$locale/%P\n" | while read fn; do \
> 
> Same here with 'cd' and I think the django.po files are not needed, just
> the Python stuff and the compiled django.mo

	.../Django-1.6.5$ find django -type d -name locale  | wc -l
	14

should I really list all these explicitly?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ptxdist] [PATCH] django: new package to provide Django 1.6.5
  2014-07-31  8:44   ` Uwe Kleine-König
@ 2014-07-31  9:08     ` Michael Olbrich
  2014-07-31  9:17       ` Uwe Kleine-König
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Olbrich @ 2014-07-31  9:08 UTC (permalink / raw)
  To: ptxdist

On Thu, Jul 31, 2014 at 10:44:09AM +0200, Uwe Kleine-König wrote:
> On Thu, Jul 31, 2014 at 10:14:14AM +0200, Michael Olbrich wrote:
> > On Wed, Jul 30, 2014 at 08:12:35PM +0200, Uwe Kleine-König wrote:
> > > +# ----------------------------------------------------------------------------
> > > +# Compile
> > > +# ----------------------------------------------------------------------------
> > > +
> > > +$(STATEDIR)/django.compile:
> > > +	@$(call targetinfo)
> > > +	cd $(DJANGO_DIR) && \
> > > +		$(DJANGO_PATH) $(DJANGO_MAKE_ENV) \
> > > +		$(CROSS_PYTHON) setup.py build
> > 
> > I think the prefix should be added here as well, in case it's used in some
> > code generation etc.
> I wondered about that, too, but:
> 
> 	.../Django-1.6.5$ python setup.py build --prefix=/usr
> 	usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
> 	   or: setup.py --help [cmd1 cmd2 ...]
> 	   or: setup.py --help-commands
> 	   or: setup.py cmd --help
> 
> 	error: option --prefix not recognized

ok, keep it as is.

> 
> > > +	@$(call touch)
> > > +
> > > +# ----------------------------------------------------------------------------
> > > +# Install
> > > +# ----------------------------------------------------------------------------
> > > +
> > > +$(STATEDIR)/django.install:
> > > +	@$(call targetinfo)
> > > +	cd $(DJANGO_DIR) && \
> > > +		$(DJANGO_PATH) $(DJANGO_MAKE_ENV) \
> > > +		$(CROSS_PYTHON) setup.py install --root=$(DJANGO_PKGDIR) --prefix=/usr -O2
> > 
> > Why '-O2' here and not in the compile stage?
> Same thing here:
> 
> 	.../Django-1.6.5$ python setup.py build -O2
> 	usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
> 	   or: setup.py --help [cmd1 cmd2 ...]
> 	   or: setup.py --help-commands
> 	   or: setup.py cmd --help
> 
> 	error: option -O not recognized
> 
> and this is not specific to Django. I see the same with my custom python
> script that uses plain distutils.

dito.

> 
> > > +	# everything but locales
> > > +	find "$(DJANGO_PKGDIR)" -type d -name locale -prune -o -type f -printf '/%P\n' | while read fn; do \
> > > +		$(call install_copy, django, 0, 0, 0644, -, $$fn); \
> > > +	done
> > 
> > I dislike just dumping everything in the package, e.g. the egg-info is not
> > needed. Install /usr/bin/django-admin.py explicitly and then use:
> > 
> > 	@cd /usr/lib/python$(PYTHON_MAJORMINOR)/site-packages/django/ && find ...
> > 
> > This way it breaks in case something went wrong and the directory is
> > missing.
> I didn't do that because your approach also breaks when the path for
> such packages changes. AFAIK this is the case for Python 3.
> But I don't care much and can use your approach.
> 
> > > +	# locales
> > > +	find "$(DJANGO_PKGDIR)" -type d -name locale -printf '/%P\n' | while read localedir; do \
> > > +		for locale in $(DJANGO_LOCALES-y); do \
> > > +			find "$(DJANGO_PKGDIR)$$localedir/$$locale" -type f -printf "$$localedir/$$locale/%P\n" | while read fn; do \
> > 
> > Same here with 'cd' and I think the django.po files are not needed, just
> > the Python stuff and the compiled django.mo
> 
> 	.../Django-1.6.5$ find django -type d -name locale  | wc -l
> 	14
> 
> should I really list all these explicitly?

What I meant is:

	cd "$(DJANGO_PKGDIR)" && find ...
		for locale in $(DJANGO_LOCALES-y); do
			cd "$(DJANGO_PKGDIR)$$localedir/$$locale" && find ...

Michael

> 
> Best regards
> Uwe
> 
> -- 
> Pengutronix e.K.                           | Uwe Kleine-König            |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> 
> -- 
> ptxdist mailing list
> ptxdist@pengutronix.de
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ptxdist] [PATCH] django: new package to provide Django 1.6.5
  2014-07-31  9:08     ` Michael Olbrich
@ 2014-07-31  9:17       ` Uwe Kleine-König
  2014-07-31  9:59         ` Michael Olbrich
  0 siblings, 1 reply; 7+ messages in thread
From: Uwe Kleine-König @ 2014-07-31  9:17 UTC (permalink / raw)
  To: ptxdist

Hello Michael,

On Thu, Jul 31, 2014 at 11:08:32AM +0200, Michael Olbrich wrote:
> On Thu, Jul 31, 2014 at 10:44:09AM +0200, Uwe Kleine-König wrote:
> > On Thu, Jul 31, 2014 at 10:14:14AM +0200, Michael Olbrich wrote:
> > > On Wed, Jul 30, 2014 at 08:12:35PM +0200, Uwe Kleine-König wrote:
> > > > +	# everything but locales
> > > > +	find "$(DJANGO_PKGDIR)" -type d -name locale -prune -o -type f -printf '/%P\n' | while read fn; do \
> > > > +		$(call install_copy, django, 0, 0, 0644, -, $$fn); \
> > > > +	done
> > > 
> > > I dislike just dumping everything in the package, e.g. the egg-info is not
> > > needed. Install /usr/bin/django-admin.py explicitly and then use:
> > > 
> > > 	@cd /usr/lib/python$(PYTHON_MAJORMINOR)/site-packages/django/ && find ...
> > > 
> > > This way it breaks in case something went wrong and the directory is
> > > missing.
> > I didn't do that because your approach also breaks when the path for
> > such packages changes. AFAIK this is the case for Python 3.
> > But I don't care much and can use your approach.
> > 
> > > > +	# locales
> > > > +	find "$(DJANGO_PKGDIR)" -type d -name locale -printf '/%P\n' | while read localedir; do \
> > > > +		for locale in $(DJANGO_LOCALES-y); do \
> > > > +			find "$(DJANGO_PKGDIR)$$localedir/$$locale" -type f -printf "$$localedir/$$locale/%P\n" | while read fn; do \
> > > 
> > > Same here with 'cd' and I think the django.po files are not needed, just
> > > the Python stuff and the compiled django.mo
> > 
> > 	.../Django-1.6.5$ find django -type d -name locale  | wc -l
> > 	14
> > 
> > should I really list all these explicitly?
> 
> What I meant is:
> 
> 	cd "$(DJANGO_PKGDIR)" && find ...
> 		for locale in $(DJANGO_LOCALES-y); do
> 			cd "$(DJANGO_PKGDIR)$$localedir/$$locale" && find ...
So you consider it an error if I want locale "sv" and this only exists
for django, but there is a contrib module that lacks "sv" l10n?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ptxdist] [PATCH] django: new package to provide Django 1.6.5
  2014-07-31  9:17       ` Uwe Kleine-König
@ 2014-07-31  9:59         ` Michael Olbrich
  2014-07-31 19:34           ` [ptxdist] [PATCH v2] " Uwe Kleine-König
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Olbrich @ 2014-07-31  9:59 UTC (permalink / raw)
  To: ptxdist

On Thu, Jul 31, 2014 at 11:17:02AM +0200, Uwe Kleine-König wrote:
> On Thu, Jul 31, 2014 at 11:08:32AM +0200, Michael Olbrich wrote:
> > On Thu, Jul 31, 2014 at 10:44:09AM +0200, Uwe Kleine-König wrote:
> > > On Thu, Jul 31, 2014 at 10:14:14AM +0200, Michael Olbrich wrote:
> > > > On Wed, Jul 30, 2014 at 08:12:35PM +0200, Uwe Kleine-König wrote:
> > > > > +	# everything but locales
> > > > > +	find "$(DJANGO_PKGDIR)" -type d -name locale -prune -o -type f -printf '/%P\n' | while read fn; do \
> > > > > +		$(call install_copy, django, 0, 0, 0644, -, $$fn); \
> > > > > +	done
> > > > 
> > > > I dislike just dumping everything in the package, e.g. the egg-info is not
> > > > needed. Install /usr/bin/django-admin.py explicitly and then use:
> > > > 
> > > > 	@cd /usr/lib/python$(PYTHON_MAJORMINOR)/site-packages/django/ && find ...
> > > > 
> > > > This way it breaks in case something went wrong and the directory is
> > > > missing.
> > > I didn't do that because your approach also breaks when the path for
> > > such packages changes. AFAIK this is the case for Python 3.
> > > But I don't care much and can use your approach.
> > > 
> > > > > +	# locales
> > > > > +	find "$(DJANGO_PKGDIR)" -type d -name locale -printf '/%P\n' | while read localedir; do \
> > > > > +		for locale in $(DJANGO_LOCALES-y); do \
> > > > > +			find "$(DJANGO_PKGDIR)$$localedir/$$locale" -type f -printf "$$localedir/$$locale/%P\n" | while read fn; do \
> > > > 
> > > > Same here with 'cd' and I think the django.po files are not needed, just
> > > > the Python stuff and the compiled django.mo
> > > 
> > > 	.../Django-1.6.5$ find django -type d -name locale  | wc -l
> > > 	14
> > > 
> > > should I really list all these explicitly?
> > 
> > What I meant is:
> > 
> > 	cd "$(DJANGO_PKGDIR)" && find ...
> > 		for locale in $(DJANGO_LOCALES-y); do
> > 			cd "$(DJANGO_PKGDIR)$$localedir/$$locale" && find ...
> So you consider it an error if I want locale "sv" and this only exists
> for django, but there is a contrib module that lacks "sv" l10n?

Yes, it's an error on django... :-)

All jokes aside, if we don't do it like this, then a typo or some change in
a new version can mean that nothing is installed.
We've had that in the past with other packages. That's why I hate
installing with find.

Are any important locales affected? I'd say, be strict for now, and when it
becomes relevant, we can introduce an option for 'incomplete' locales.

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ptxdist] [PATCH v2] django: new package to provide Django 1.6.5
  2014-07-31  9:59         ` Michael Olbrich
@ 2014-07-31 19:34           ` Uwe Kleine-König
  0 siblings, 0 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2014-07-31 19:34 UTC (permalink / raw)
  To: ptxdist

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---

Notes:
    Changes since (implicit) v1:
    
     - rename package to python-django
     - drop -O2 in install stage because that results in a bigger installation without
       measureable gain
     - use cd && find instead of plain find to get a list of files to install.
     - make list of locales a single Kconfig variable
     - don't install .po and .py files for locales

 rules/python-django.in   | 22 ++++++++++++
 rules/python-django.make | 92 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 114 insertions(+)
 create mode 100644 rules/python-django.in
 create mode 100644 rules/python-django.make

diff --git a/rules/python-django.in b/rules/python-django.in
new file mode 100644
index 000000000000..cf2a16489d55
--- /dev/null
+++ b/rules/python-django.in
@@ -0,0 +1,22 @@
+## SECTION=networking
+
+menuconfig PYTHON_DJANGO
+	tristate
+	select PYTHON
+	select PYTHON_SQLITE
+	select PYTHON_ZLIB
+	prompt "Django                        "
+	help
+	  Django is a high-level Python Web framework that encourages rapid
+	  development and clean, pragmatic design.
+
+if PYTHON_DJANGO
+
+	config PYTHON_DJANGO_LOCALES
+		string
+		prompt "Django locales"
+		default "de en"
+		help
+		  Space separated list of locales to install, e.g. "de en"
+
+endif
diff --git a/rules/python-django.make b/rules/python-django.make
new file mode 100644
index 000000000000..dab38db57717
--- /dev/null
+++ b/rules/python-django.make
@@ -0,0 +1,92 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2014 by Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.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_PYTHON_DJANGO) += python-django
+
+#
+# Paths and names
+#
+PYTHON_DJANGO_VERSION	:= 1.6.5
+PYTHON_DJANGO_MD5	:= e4c5b2d35ecb3807317713afa70a0c77
+PYTHON_DJANGO		:= Django-$(PYTHON_DJANGO_VERSION)
+PYTHON_DJANGO_SUFFIX	:= tar.gz
+PYTHON_DJANGO_URL	:= https://www.djangoproject.com/download/$(PYTHON_DJANGO_VERSION)/tarball/
+PYTHON_DJANGO_SOURCE	:= $(SRCDIR)/$(PYTHON_DJANGO).$(PYTHON_DJANGO_SUFFIX)
+PYTHON_DJANGO_DIR	:= $(BUILDDIR)/$(PYTHON_DJANGO)
+PYTHON_DJANGO_LICENSE	:= BSD
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+PYTHON_DJANGO_PATH	:= PATH=$(CROSS_PATH)
+PYTHON_DJANGO_CONF_TOOL	:= NO
+PYTHON_DJANGO_MAKE_ENV	:= $(CROSS_ENV)
+
+# ----------------------------------------------------------------------------
+# Compile
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/python-django.compile:
+	@$(call targetinfo)
+	cd $(PYTHON_DJANGO_DIR) && \
+		$(PYTHON_DJANGO_PATH) $(PYTHON_DJANGO_MAKE_ENV) \
+		$(CROSS_PYTHON) setup.py build
+	@$(call touch)
+
+# ----------------------------------------------------------------------------
+# Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/python-django.install:
+	@$(call targetinfo)
+	cd $(PYTHON_DJANGO_DIR) && \
+		$(PYTHON_DJANGO_PATH) $(PYTHON_DJANGO_MAKE_ENV) \
+		$(CROSS_PYTHON) setup.py install --root=$(PYTHON_DJANGO_PKGDIR) --prefix=/usr
+	@$(call touch)
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+PYTHON_DJANGO_PYTHON_PATH = /usr/lib/python$(PYTHON_MAJORMINOR)/site-packages/django
+
+$(STATEDIR)/python-django.targetinstall:
+	@$(call targetinfo)
+
+	@$(call install_init, python-django)
+	@$(call install_fixup, python-django, PRIORITY, optional)
+	@$(call install_fixup, python-django, SECTION, base)
+	@$(call install_fixup, python-django, AUTHOR, "Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>")
+	@$(call install_fixup, python-django, DESCRIPTION, missing)
+
+	# everything but locales
+	cd "$(PYTHON_DJANGO_PKGDIR)$(PYTHON_DJANGO_PYTHON_PATH)" && find -type d -name locale -prune -o -type f -printf '%P\n' | while read fn; do \
+		$(call install_copy, python-django, 0, 0, 0644, -, $(PYTHON_DJANGO_PYTHON_PATH)/$$fn); \
+	done
+
+	# locales
+	cd "$(PYTHON_DJANGO_PKGDIR)$(PYTHON_DJANGO_PYTHON_PATH)" && find -type d -name locale -printf '/%P\n' | while read localedir; do \
+		for locale in $(shell echo $(PTXCONF_PYTHON_DJANGO_LOCALES)); do \
+			cd "$(PYTHON_DJANGO_PKGDIR)$(PYTHON_DJANGO_PYTHON_PATH)/$$localedir/$$locale" && \
+					find -type f -not \( -name \*.py -o -name \*.po \) -printf "%P\n" | while read fn; do \
+				$(call install_copy, python-django, 0, 0, 0644, -, $(PYTHON_DJANGO_PYTHON_PATH)/$$localedir/$$locale/$$fn); \
+			done; \
+		done; \
+	done
+
+	@$(call install_finish, python-django)
+
+	@$(call touch)
+
+# vim: syntax=make
-- 
2.0.1


-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-07-31 19:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-30 18:12 [ptxdist] [PATCH] django: new package to provide Django 1.6.5 Uwe Kleine-König
2014-07-31  8:14 ` Michael Olbrich
2014-07-31  8:44   ` Uwe Kleine-König
2014-07-31  9:08     ` Michael Olbrich
2014-07-31  9:17       ` Uwe Kleine-König
2014-07-31  9:59         ` Michael Olbrich
2014-07-31 19:34           ` [ptxdist] [PATCH v2] " Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox