Hey Stefano. (Thanks, also Andrey).
On Fri, Aug 16, 2024 at 9:47 AM Stefano Rivera <stefa...@debian.org> wrote: > > Is that even intended to work with dh_python? > > dh_python doesn't care what form your python package is in. It just > looks for the metadata in .dist-info / .egg-info. Then there must be something I do wrong. What I have is: - src/my-script-file.py (yes, hyphens here, which would of course be bad if it were a package - maybe this is the reason for my troubles?) - pyproject.toml [project] name = "my-script" requires-python = ">=3.11" dynamic = ["version"] dependencies = [ "numpy" ] [build-system] requires = ["setuptools>=61.0.0", "setuptools_scm[toml]>=6.2.0"] build-backend = "setuptools.build_meta" [tool.setuptools] script-files = ["src/my-script-file.py"] [tool.setuptools_scm] At first I tried: [project.scripts] my-script = "my-script:main" instead of the script-files = ["src/my-script-file.py"] But that didn't really work (which I guess is no surprise) as project.scripts expects a packge/module to load from, but my-script is none. With script-files = ["src/my-script-file.py"], the result from: python3 -m build --no-isolation *does* include my script at, and the Debian package also places it in /usr/bin - but I somehow get that my-script-file "into" Python. "into Python" is what I wrote before, namely when I run ptpython and use the completion of import my... it shows me my-script-file as if it were a module. So I think something is still wrong, but I cannot find out what. With the above pyproject.toml, the Debian package would contain: drwxr-xr-x root/root 0 2024-08-15 23:56 ./ drwxr-xr-x root/root 0 2024-08-15 23:56 ./usr/ drwxr-xr-x root/root 0 2024-08-15 23:56 ./usr/bin/ -rwxr-xr-x root/root 109240 2024-08-15 23:56 ./usr/bin/my-script-file.py drwxr-xr-x root/root 0 2024-08-15 23:56 ./usr/lib/ drwxr-xr-x root/root 0 2024-08-15 23:56 ./usr/lib/python3/ drwxr-xr-x root/root 0 2024-08-15 23:56 ./usr/lib/python3/dist-packages/ drwxr-xr-x root/root 0 2024-08-15 23:56 ./usr/lib/python3/dist-packages/my_script_file-1.0.0.dist-info/ -rw-r--r-- root/root 7 2024-08-15 23:56 ./usr/lib/python3/dist-packages/my_script_file-1.0.0.dist-info/INSTALLER -rw-r--r-- root/root 1824 2024-08-15 23:56 ./usr/lib/python3/dist-packages/my_script_file-1.0.0.dist-info/METADATA -rw-r--r-- root/root 91 2024-08-15 23:56 ./usr/lib/python3/dist-packages/my_script_file-1.0.0.dist-info/WHEEL -rw-r--r-- root/root 1 2024-08-15 23:56 ./usr/lib/python3/dist-packages/my_script_file-1.0.0.dist-info/top_level.txt drwxr-xr-x root/root 0 2024-08-15 23:56 ./usr/share/ drwxr-xr-x root/root 0 2024-08-15 23:56 ./usr/share/doc/ drwxr-xr-x root/root 0 2024-08-15 23:56 ./usr/share/doc/my-script-file/ -rw-r--r-- root/root 169 2024-08-15 23:56 ./usr/share/doc/my-script-file/changelog.Debian.gz -rw-r--r-- root/root 1373 2024-08-15 23:56 ./usr/share/doc/my-script-file/copyright So it retains the hypens, execpt for the dir in dist-packages, where it replaces them with _. It also generates a postinst: #!/bin/sh set -e # Automatically added by dh_python3 if command -v py3compile >/dev/null 2>&1; then py3compile -p my-script-file fi if command -v pypy3compile >/dev/null 2>&1; then pypy3compile -p my-script-file || true fi # End automatically added section Which I guess makes no sense (as there is no such package), or does it? And accordingly a prerm. btw: When I rename the src/my-script-file.py to src/my-script-file (no extension), then the contents of the .deb look the same, but the postinst/prerm are gone. Still I fail to understand, where that auto-completed my-script-file comes from in ptpython. Any ideas what I'm doing wrong? > So, if your package declares dependencies in in the packaging, and > installs correctly with python3-build, it'll work. I had some stupid mistake in my pyproject.toml, after noticing that, it correctly "auto-detected" the dependencies from that and translated them into Debian package names :-) Thanks, Philippe