====== Debian-Paket aus Python-Anwendung erstellen ======
===== Verzeichnisstruktur =====
myproject/
├── src/
│ ├── myproject/
│ │ ├── __init__.py
│ │ ├── entry.py
│ │ └── module1.py
├── setup.py
├── README.md
===== Build setup =====
//setup.py//
from setuptools import setup, find_packages
setup(
name="myproject",
version="0.1.0",
packages=find_packages(where="src"),
package_dir={"": "src"},
entry_points={
"console_scripts": [
"myproject=myproject.entry:main",
],
},
)
**Important notes:**
* packages=find_packages(where="src") → ensures all packages inside src/ are included.
* package_dir={"": "src"} → tells setuptools that the root of packages is src/.
* entry_points → your CLI script. It must point to a function, e.g., main() in entry.py:
===== Build =====
- Create source distribution python3 setup.py sdist
- Convert to Debian package format py2dsc dist/myproject-0.1.0.tar.gz
- Build the actual .deb cd deb_dist/myproject-0.1.0-1
dpkg-buildpackage -us -uc