|
| 1 | +# Copyright 1999-2024 Gentoo Authors |
| 2 | +# Distributed under the terms of the GNU General Public License v2 |
| 3 | + |
| 4 | +EAPI=8 |
| 5 | +DISTUTILS_USE_PEP517=setuptools |
| 6 | +DISTUTILS_SINGLE_IMPL=1 |
| 7 | +PYTHON_COMPAT=( python3_{11..13} ) |
| 8 | + |
| 9 | +inherit readme.gentoo-r1 distutils-r1 |
| 10 | + |
| 11 | +if [[ ${PV} == *9999* ]]; then |
| 12 | + inherit git-r3 |
| 13 | + EGIT_REPO_URI="https://github.com/esphome/esphome.git" |
| 14 | + EGIT_BRANCH="dev" |
| 15 | + S="${WORKDIR}/${P}/" |
| 16 | +else |
| 17 | + inherit pypi |
| 18 | + MY_P=${P/_beta/b} |
| 19 | + MY_PV=${PV/_beta/b} |
| 20 | + S="${WORKDIR}/${MY_P}/" |
| 21 | +fi |
| 22 | + |
| 23 | +DESCRIPTION="Make creating custom firmwares for ESP32/ESP8266 super easy." |
| 24 | +HOMEPAGE="https://github.com/esphome/esphome https://pypi.org/project/esphome/" |
| 25 | + |
| 26 | +LICENSE="MIT" |
| 27 | +SLOT="0" |
| 28 | +KEYWORDS="amd64 arm arm64 x86" |
| 29 | +IUSE="+server test" |
| 30 | +RESTRICT="!test? ( test )" |
| 31 | + |
| 32 | +DOCS="README.md" |
| 33 | + |
| 34 | +RDEPEND=" |
| 35 | + server? ( acct-group/${PN} acct-user/${PN} ) |
| 36 | + $(python_gen_cond_dep ' |
| 37 | + dev-python/cryptography[${PYTHON_USEDEP}] |
| 38 | + dev-python/voluptuous[${PYTHON_USEDEP}] |
| 39 | + ~dev-python/pyyaml-6.0.1[${PYTHON_USEDEP}] |
| 40 | + ~dev-python/paho-mqtt-1.6.1[${PYTHON_USEDEP}] |
| 41 | + ~dev-python/colorama-0.4.6[${PYTHON_USEDEP}] |
| 42 | + dev-python/icmplib[${PYTHON_USEDEP}] |
| 43 | + server? ( ~dev-python/tornado-6.4[${PYTHON_USEDEP}] ) |
| 44 | + ~dev-python/tzlocal-5.2[${PYTHON_USEDEP}] |
| 45 | + >=dev-python/tzdata-2021.1[${PYTHON_USEDEP}] |
| 46 | + ~dev-python/pyserial-3.5[${PYTHON_USEDEP}] |
| 47 | + ~dev-embedded/platformio-6.1.15[${PYTHON_SINGLE_USEDEP}] |
| 48 | + ~dev-embedded/esptool-4.7.0[${PYTHON_USEDEP}] |
| 49 | + ~dev-python/click-8.1.7[${PYTHON_USEDEP}] |
| 50 | + ~dev-embedded/esphome-dashboard-20240412.0[${PYTHON_USEDEP}] |
| 51 | + dev-python/aioesphomeapi[${PYTHON_USEDEP}] |
| 52 | + dev-python/zeroconf[${PYTHON_USEDEP}] |
| 53 | + ~dev-python/python-magic-0.4.27[${PYTHON_USEDEP}] |
| 54 | + ~dev-python/ruamel-yaml-0.18.6[${PYTHON_USEDEP}] |
| 55 | + ~dev-python/kconfiglib-13.7.1[${PYTHON_USEDEP}] |
| 56 | + >=dev-python/pyparsing-3.0[${PYTHON_USEDEP}] |
| 57 | + >=dev-python/argcomplete-2.0.0[${PYTHON_USEDEP}] |
| 58 | + ')" |
| 59 | + |
| 60 | +BDEPEND="$(python_gen_cond_dep ' |
| 61 | + test? ( |
| 62 | + dev-python/pytest-cov[${PYTHON_USEDEP}] |
| 63 | + dev-python/pytest-mock[${PYTHON_USEDEP}] |
| 64 | + dev-python/pytest-asyncio[${PYTHON_USEDEP}] |
| 65 | + dev-python/asyncmock[${PYTHON_USEDEP}] |
| 66 | + dev-python/hypothesis[${PYTHON_USEDEP}] |
| 67 | + ) |
| 68 | + ')" |
| 69 | + |
| 70 | +DISABLE_AUTOFORMATTING=1 |
| 71 | +DOC_CONTENTS=" |
| 72 | +The ESPHome dashboard listens on port 6052 |
| 73 | +ESPHome configuration is in: /etc/${PN} |
| 74 | +dashboard command line arguments are configured in: /etc/conf.d/${PN} |
| 75 | +logging is to: /var/log/${PN}/{dashboard,warnings}.log |
| 76 | +support at https://git.edevau.net/onkelbeh/HomeAssistantRepository |
| 77 | +" |
| 78 | + |
| 79 | +src_prepare() { |
| 80 | + sed "/aioesphomeapi==/c\aioesphomeapi" -i requirements.txt || die |
| 81 | + sed "/click==/c\click" -i requirements.txt || die |
| 82 | + sed "/colorama==/c\colorama" -i requirements.txt || die |
| 83 | + sed "/zeroconf==/c\zeroconf" -i requirements.txt || die |
| 84 | + sed "/voluptuous==/c\voluptuous" -i requirements.txt || die |
| 85 | + sed "/cryptography==/c\cryptography" -i requirements.txt || die |
| 86 | + sed "/icmplib==/c\icmplib" -i requirements.txt || die |
| 87 | + |
| 88 | + # esphome/esphome/components/font/__init__.py pillow version check |
| 89 | + sed "s/10.2.0/10.3.0/g" -i esphome/esphome/components/font/__init__.py || die |
| 90 | + |
| 91 | + eapply_user |
| 92 | +} |
| 93 | + |
| 94 | +python_install_all() { |
| 95 | + dodoc ${DOCS} |
| 96 | + distutils-r1_python_install_all |
| 97 | + if use server; then |
| 98 | + keepdir "/etc/${PN}" |
| 99 | + fowners -R "${PN}:${PN}" "/etc/${PN}" |
| 100 | + keepdir "/var/log/${PN}" |
| 101 | + fowners -R "${PN}:${PN}" "/var/log/${PN}" |
| 102 | + newconfd "${FILESDIR}/${PN}.conf.d" "${PN}" |
| 103 | + newinitd "${FILESDIR}/${PN}.init.d-r3" "${PN}" |
| 104 | + readme.gentoo_create_doc |
| 105 | + fi |
| 106 | +} |
| 107 | + |
| 108 | +pkg_postinst() { |
| 109 | + if use server; then |
| 110 | + readme.gentoo_print_elog |
| 111 | + fi |
| 112 | +} |
| 113 | + |
| 114 | +distutils_enable_tests pytest |
0 commit comments