* [PATCH] pylibfdt: Fix install location of libfdt.py
@ 2017-11-07 14:17 Tuomas Tynkkynen
[not found] ` <20171107141741.1733-1-tuomas-yrGDUoBaLx3QT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Tuomas Tynkkynen @ 2017-11-07 14:17 UTC (permalink / raw)
To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
Cc: David Gibson, Simon Glass, Tuomas Tynkkynen
Currently 'make install' produces a directory tree like this
for the Python module:
$PREFIX
`-- lib
`-- python2.7
`-- site-packages
|-- _libfdt.so
|-- libfdt-1.4.5-py2.7.egg-info
`-- pylibfdt
|-- libfdt.py
`-- libfdt.pyc
That is, libfdt.py is installed in an unexpected subdirectory pylibfdt
so 'import libfdt' fails. Fix this by properly pointing package_dir to
the root of the Python sources, producing the correct directory tree:
$PREFIX
`-- lib
`-- python2.7
`-- site-packages
|-- _libfdt.so
|-- libfdt-1.4.5-py2.7.egg-info
|-- libfdt.py
`-- libfdt.pyc
Signed-off-by: Tuomas Tynkkynen <tuomas-yrGDUoBaLx3QT0dZR+AlfA@public.gmane.org>
---
pylibfdt/Makefile.pylibfdt | 1 -
pylibfdt/setup.py | 4 ++--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/pylibfdt/Makefile.pylibfdt b/pylibfdt/Makefile.pylibfdt
index 9507d3d..2843ef5 100644
--- a/pylibfdt/Makefile.pylibfdt
+++ b/pylibfdt/Makefile.pylibfdt
@@ -14,7 +14,6 @@ endef
$(PYMODULE): $(PYLIBFDT_srcs)
@$(VECHO) PYMOD $@
$(call run_setup, $^, build_ext --inplace)
- mv _libfdt.so $@
install_pylibfdt: $(PYMODULE)
$(VECHO) INSTALL-PYLIB; \
diff --git a/pylibfdt/setup.py b/pylibfdt/setup.py
index 1a1e832..49ab3cc 100755
--- a/pylibfdt/setup.py
+++ b/pylibfdt/setup.py
@@ -116,6 +116,6 @@ setup(
author='Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>',
description='Python binding for libfdt',
ext_modules=[libfdt_module],
- package_dir={'': objdir},
- py_modules=['pylibfdt/libfdt'],
+ package_dir={'': 'pylibfdt'},
+ py_modules=['libfdt'],
)
--
2.15.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] pylibfdt: Fix install location of libfdt.py
[not found] ` <20171107141741.1733-1-tuomas-yrGDUoBaLx3QT0dZR+AlfA@public.gmane.org>
@ 2017-11-08 2:59 ` David Gibson
[not found] ` <20171108025946.GA7732-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: David Gibson @ 2017-11-08 2:59 UTC (permalink / raw)
To: Tuomas Tynkkynen; +Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA, Simon Glass
[-- Attachment #1: Type: text/plain, Size: 2291 bytes --]
On Tue, Nov 07, 2017 at 04:17:41PM +0200, Tuomas Tynkkynen wrote:
> Currently 'make install' produces a directory tree like this
> for the Python module:
>
> $PREFIX
> `-- lib
> `-- python2.7
> `-- site-packages
> |-- _libfdt.so
> |-- libfdt-1.4.5-py2.7.egg-info
> `-- pylibfdt
> |-- libfdt.py
> `-- libfdt.pyc
>
> That is, libfdt.py is installed in an unexpected subdirectory pylibfdt
> so 'import libfdt' fails. Fix this by properly pointing package_dir to
> the root of the Python sources, producing the correct directory tree:
>
> $PREFIX
> `-- lib
> `-- python2.7
> `-- site-packages
> |-- _libfdt.so
> |-- libfdt-1.4.5-py2.7.egg-info
> |-- libfdt.py
> `-- libfdt.pyc
This doesn't seem like the right fix. Shouldn't all the files go into
the pylibfdt subdirectory, rather than removing that subdirectory.
> Signed-off-by: Tuomas Tynkkynen <tuomas-yrGDUoBaLx3QT0dZR+AlfA@public.gmane.org>
> ---
> pylibfdt/Makefile.pylibfdt | 1 -
> pylibfdt/setup.py | 4 ++--
> 2 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/pylibfdt/Makefile.pylibfdt b/pylibfdt/Makefile.pylibfdt
> index 9507d3d..2843ef5 100644
> --- a/pylibfdt/Makefile.pylibfdt
> +++ b/pylibfdt/Makefile.pylibfdt
> @@ -14,7 +14,6 @@ endef
> $(PYMODULE): $(PYLIBFDT_srcs)
> @$(VECHO) PYMOD $@
> $(call run_setup, $^, build_ext --inplace)
> - mv _libfdt.so $@
>
> install_pylibfdt: $(PYMODULE)
> $(VECHO) INSTALL-PYLIB; \
> diff --git a/pylibfdt/setup.py b/pylibfdt/setup.py
> index 1a1e832..49ab3cc 100755
> --- a/pylibfdt/setup.py
> +++ b/pylibfdt/setup.py
> @@ -116,6 +116,6 @@ setup(
> author='Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>',
> description='Python binding for libfdt',
> ext_modules=[libfdt_module],
> - package_dir={'': objdir},
> - py_modules=['pylibfdt/libfdt'],
> + package_dir={'': 'pylibfdt'},
> + py_modules=['libfdt'],
> )
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pylibfdt: Fix install location of libfdt.py
[not found] ` <20171108025946.GA7732-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
@ 2017-11-08 9:42 ` Tuomas Tynkkynen
0 siblings, 0 replies; 3+ messages in thread
From: Tuomas Tynkkynen @ 2017-11-08 9:42 UTC (permalink / raw)
To: David Gibson; +Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA, Simon Glass
On Wed, 2017-11-08 at 13:59 +1100, David Gibson wrote:
> On Tue, Nov 07, 2017 at 04:17:41PM +0200, Tuomas Tynkkynen wrote:
> > Currently 'make install' produces a directory tree like this
> > for the Python module:
> >
> > $PREFIX
> > `-- lib
> > `-- python2.7
> > `-- site-packages
> > |-- _libfdt.so
> > |-- libfdt-1.4.5-py2.7.egg-info
> > `-- pylibfdt
> > |-- libfdt.py
> > `-- libfdt.pyc
> >
> > That is, libfdt.py is installed in an unexpected subdirectory
> > pylibfdt
> > so 'import libfdt' fails. Fix this by properly pointing package_dir
> > to
> > the root of the Python sources, producing the correct directory
> > tree:
> >
> > $PREFIX
> > `-- lib
> > `-- python2.7
> > `-- site-packages
> > |-- _libfdt.so
> > |-- libfdt-1.4.5-py2.7.egg-info
> > |-- libfdt.py
> > `-- libfdt.pyc
>
> This doesn't seem like the right fix. Shouldn't all the files go
> into
> the pylibfdt subdirectory, rather than removing that subdirectory.
>
AFAIK you can't add that subdirectory there without breaking 'import
libfdt' because the directory structure must match the module
structure.
I think it might be possible to achieve this though:
$PREFIX
`-- lib
`-- python2.7
`-- site-packages
|-- libfdt-1.4.5-py2.7.egg-info
`-- libfdt
|-- _libfdt.so
|-- __init__.py
`-- __init__.pyc
... but I'm not sure that's idiomatic either because now the name of
the native module changes from '_libfdt' to 'libfdt._libfdt'. There are
already existing similar (as in one .py + one .so) packages with the
same directory structure as what I'm trying to achieve:
https://packages.debian.org/sid/amd64/python-gamin/filelist
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-11-08 9:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-07 14:17 [PATCH] pylibfdt: Fix install location of libfdt.py Tuomas Tynkkynen
[not found] ` <20171107141741.1733-1-tuomas-yrGDUoBaLx3QT0dZR+AlfA@public.gmane.org>
2017-11-08 2:59 ` David Gibson
[not found] ` <20171108025946.GA7732-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
2017-11-08 9:42 ` Tuomas Tynkkynen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).