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
Description: PGP signature