|
1 | | -"""Setup configuration for Tado Local.""" |
2 | | -# |
3 | | -# Copyright 2025 The TadoLocal and AmpScm contributors. |
4 | | -# |
5 | | -# Licensed under the Apache License, Version 2.0 (the "License"); |
6 | | -# you may not use this file except in compliance with the License. |
7 | | -# You may obtain a copy of the License at |
8 | | -# |
9 | | -# http://www.apache.org/licenses/LICENSE-2.0 |
10 | | -# |
11 | | -# Unless required by applicable law or agreed to in writing, software |
12 | | -# distributed under the License is distributed on an "AS IS" BASIS, |
13 | | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
14 | | -# See the License for the specific language governing permissions and |
15 | | -# limitations under the License. |
| 1 | +"""Setup configuration for Tado Local. |
16 | 2 |
|
17 | | -from setuptools import setup, find_packages |
| 3 | +Configuration is primarily defined in pyproject.toml. |
| 4 | +This file provides custom version discovery from __version__.py. |
| 5 | +""" |
| 6 | + |
| 7 | +from setuptools import setup |
18 | 8 | from pathlib import Path |
19 | 9 | import re |
20 | 10 |
|
21 | | -# Read version without importing the package (to avoid dependency issues during setup) |
22 | | -version_file = Path(__file__).parent / "tado_local" / "__version__.py" |
23 | | -version_content = version_file.read_text(encoding="utf-8") |
24 | | -version_match = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', version_content, re.MULTILINE) |
25 | | -if not version_match: |
26 | | - raise RuntimeError("Unable to find version string in __version__.py") |
27 | | -__version__ = version_match.group(1) |
| 11 | +def get_version(): |
| 12 | + """Read version from tado_local/__version__.py""" |
| 13 | + version_file = Path(__file__).parent / "tado_local" / "__version__.py" |
| 14 | + content = version_file.read_text(encoding="utf-8") |
| 15 | + match = re.search(r'^__version__\s*=\s*[\'"]([^\'"]+)[\'"]', content, re.MULTILINE) |
| 16 | + if match: |
| 17 | + return match.group(1) |
| 18 | + raise RuntimeError("Unable to find __version__ in tado_local/__version__.py") |
28 | 19 |
|
29 | | -# Read the README file |
30 | | -readme_file = Path(__file__).parent / "README.md" |
31 | | -long_description = readme_file.read_text(encoding="utf-8") if readme_file.exists() else "" |
| 20 | +# Use custom version discovery |
| 21 | +setup(version=get_version()) |
32 | 22 |
|
33 | | -# Read requirements |
34 | | -requirements_file = Path(__file__).parent / "requirements.txt" |
35 | | -requirements = [] |
36 | | -if requirements_file.exists(): |
37 | | - requirements = [ |
38 | | - line.strip() |
39 | | - for line in requirements_file.read_text(encoding="utf-8").splitlines() |
40 | | - if line.strip() and not line.startswith("#") |
41 | | - ] |
42 | 23 |
|
43 | | -setup( |
44 | | - name="tado-local", |
45 | | - version=__version__, |
46 | | - author="Tado Local Contributors", |
47 | | - description="REST API for Tado devices via HomeKit bridge", |
48 | | - long_description=long_description, |
49 | | - long_description_content_type="text/markdown", |
50 | | - url="https://github.com/ampscm/TadoLocal", |
51 | | - packages=find_packages(), |
52 | | - classifiers=[ |
53 | | - "Development Status :: 3 - Alpha", |
54 | | - "Intended Audience :: Developers", |
55 | | - "License :: OSI Approved :: Apache Software License", |
56 | | - "Programming Language :: Python :: 3", |
57 | | - "Programming Language :: Python :: 3.11", |
58 | | - "Programming Language :: Python :: 3.12", |
59 | | - "Topic :: Home Automation", |
60 | | - "Topic :: Software Development :: Libraries :: Python Modules", |
61 | | - ], |
62 | | - python_requires=">=3.11", |
63 | | - install_requires=requirements, |
64 | | - extras_require={ |
65 | | - # Optional Avahi/dbus support for platforms that provide dbus-next |
66 | | - 'avahi': ['dbus-next>=0.6.0'], |
67 | | - }, |
68 | | - entry_points={ |
69 | | - "console_scripts": [ |
70 | | - "tado-local=tado_local.__main__:main", |
71 | | - ], |
72 | | - }, |
73 | | - include_package_data=True, |
74 | | - zip_safe=False, |
75 | | -) |
0 commit comments