Re: [question] how to install a directory to pythondir?

Mike Frysinger <[email protected]>
Newsgroups gmane.comp.sysutils.automake.general
Message-ID <ZaIu9QHxvy7X9Arv@vapier>
On 06 Apr 2023 02:34, Wu Zhenyu wrote:
> https://www.gnu.org/software/automake/manual/html_node/Python.html
> describe how to package python by automake. I have
> 
>     $ tree src/foobar
>      src/foobar
>     ├──  __init__.py
>     ├──  __main__.py
>     └──  utils
>        ├──  a.py
>        ├──  b.py
>        └──  c.py
> 
> And my Makefile.am contains
> 
>     python_PYTHON = src/foobar

i think there might be a philosophical mismatch here.  Automake doesn't
take arbitrary dirs as inputs, much like it doesn't accept wildcards.
it wants every file that it's responsible for to be enumerated.  this
avoids things like `cp src/foobar/__init__.py src/foobar/todo-backup.py`
and then having todo-backup.py automatically get sucked up into release
tarballs.

what about src/foobar/.test.py ?  should we include that too ?
what about src/foobar/__init__.py~ ?  should we include that too ?

the practical result is that the build code gets a bit verbose ...

> If I
> 
>     python_PYTHON = src/foobar/__init__.py src/foobar/__main__.py  src/foobar/utils/a.py src/foobar/utils/b.py src/foobar/utils/c.py
> 
> I got
> 
>     $ ls /tmp/abc/lib/python3.10/site-packages
>     __init__.py __main__.py a.py b.py c.py
> 
> I expected
> 
>     $ ls /tmp/abc/lib/python3.10/site-packages
>     foobar
>     $ ls /tmp/abc/lib/python3.10/site-packages/foobar
>     __init__.py __main__.py utils/
>     $ ls /tmp/abc/lib/python3.10/site-packages/foobar/utils
>     a.py b.py c.py
> 
> So, how to install a directory to pythondir?

i would guess something like (untested):

python_foobardir = $(pythondir)/foobar
python_foobar_PYTHON = src/foobar/__init__.py src/foobar/__main__.py
python_foobar_utilsdir = $(python_foobardir)/utils
python_foobar_utils_PYTHON = src/foobar/utils/a.py src/foobar/utils/b.py src/foobar/utils/c.py

prob want to write a script to automatically generate this boilerplate
for your project so you don't have to manually keep it up-to-date ...
-mike
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmWiLvUACgkQQWM7n+g3
9YHXpg/8CkroZhPFzTgbdOyc0RB1PlImRP/40APbo4IaJ9MQ3b/e4biBv2gBGtjX
xEYGqRhpMTVaDJFOwkobT+AOkFeSG6c6fWSxvhjR7XkK85h8TJ+U85vqGQmBexo8
bhEuNdhM+EhgMjS4mm9vGfeksrVWZN62NJNX+i/ij8WT3ug3UwfsMWrD0mF9Hfi9
aaddDUEAhWW/Vf6vrZRYwBZB1iJchURmCpmfsEOMfB1bbo5HoT9o8oqyLEECGkIh
MMtepGXjcKh42KENG8RQE59l4O9vHn9Gqgzem8jJhaIv1sozODMPRSHivncYz48X
h9OaKdfp4wP0+S0r3YOahD0uKL6o6Vsw6rvQKQIbFvspdL6P76LDPDu8etPMAHeG
t8GmJhlqiuk0qkBhPLp9E6fp8YPbEkCosiEz4VvOwfc8+9s3bFGYGT0zzNoX6dth
7Bxn4B6VUq7bA/u82uwYmbBurqpQxb8pAyNYOmoodjNe17scCcbS28bzljScMmcG
YJWEGfEcoN6smZLRocDzGAjPgE5f0kryUvr5y8eDP2wkQilzLrbFNDUnFz29ajR8
2bSsVZoCMub+CNoYEbueuqmSZ6vksa0t2dm0FSmZBp+saMSjT1qx2mgU3pDSRuSu
rNZoFjvY/yx1Nro1hoivMYEP7B/IH0AukUj6ExsHCWT2K5/8mUc=
=9Psv
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.