diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..78fc47e --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +include LICENSE +recursive-include homekit *.py \ No newline at end of file diff --git a/homekit/__init__.py b/homekit/__init__.py index 0d84fbc..6cb7917 100644 --- a/homekit/__init__.py +++ b/homekit/__init__.py @@ -31,6 +31,7 @@ MaxPeersError, MaxTriesError, ProtocolError, RequestRejected, UnavailableError, UnknownError, UnpairedError from homekit.tools import IP_TRANSPORT_SUPPORTED +from .version import __version__ if IP_TRANSPORT_SUPPORTED: # TODO: change import and let it be imported from its specific file diff --git a/homekit/version.py b/homekit/version.py new file mode 100644 index 0000000..aa070c2 --- /dev/null +++ b/homekit/version.py @@ -0,0 +1 @@ +__version__ = "0.19.2" diff --git a/homekit/zeroconf_impl/__init__.py b/homekit/zeroconf_impl/__init__.py index 287192b..e7cc1ce 100644 --- a/homekit/zeroconf_impl/__init__.py +++ b/homekit/zeroconf_impl/__init__.py @@ -49,7 +49,7 @@ def get_data(self): """ return self.data - def update_service(self, zeroconf, service_type, name, state_change): + def update_service(self, zeroconf, service_type, name, state_change=None): # prevent FutureWarning: XXX has no update_service method. Provide one # (it can be empty if you don't care about the updates), it'll become # mandatory. diff --git a/setup.py b/setup.py index f10fd8f..7317b1d 100644 --- a/setup.py +++ b/setup.py @@ -13,22 +13,39 @@ # See the License for the specific language governing permissions and # limitations under the License. # - -import setuptools +import os.path +from setuptools import find_packages, setup with open("README.md", "r") as fh: long_description = fh.read() -setuptools.setup( +def read(rel_path: str) -> str: + here = os.path.abspath(os.path.dirname(__file__)) + # intentionally *not* adding an encoding option to open + with open(os.path.join(here, rel_path)) as fp: + return fp.read() + + +def get_version(rel_path: str) -> str: + for line in read(rel_path).splitlines(): + if line.startswith("__version__"): + # __version__ = "0.9" + delim = '"' if '"' in line else "'" + return line.split(delim)[1] + raise RuntimeError("Unable to find version string.") + + +setup( name='homekit', - packages=setuptools.find_packages(exclude=['tests']), - version='0.18.0', + packages=find_packages(exclude=['tests']), + version=get_version("homekit/version.py"), description='Python code to interface HomeKit Accessories and Controllers', author='Joachim Lusiardi', author_email='pypi@lusiardi.de', url='https://github.com/jlusiardi/homekit_python', - download_url='https://github.com/jlusiardi/homekit_python/archive/0.18.0.tar.gz', +# Commented out as download_url is no longer used due to regular misuse and issues +# download_url='https://github.com/jlusiardi/homekit_python/archive/0.18.0.tar.gz', keywords=['HomeKit'], classifiers=[ 'License :: OSI Approved :: Apache Software License',