%global _empty_manifest_terminate_build 0 Name: python-pi1wire Version: 0.3.0 Release: 1 Summary: 1Wire Sensor Library for Raspberry PI License: MIT URL: https://github.com/ushiboy/pi1wire Source0: https://mirrors.nju.edu.cn/pypi/web/packages/a0/85/15d2fb53d4d136c0eba69d26427da3fd85b81649a421b00a82ac4a2100cd/pi1wire-0.3.0.tar.gz BuildArch: noarch %description pi1wire is a library for the Raspberry PI 1Wire sensor. ## Quick Sample Here is a simple usecase. ```python from pi1wire import Pi1Wire, Resolution for s in Pi1Wire().find_all_sensors(): print(f'{s.mac_address} = {s.get_temperature():.3f}') s.change_resolution(Resolution.X0_5) print(f'{s.mac_address} = {s.get_temperature():.3f}') ``` ## OS Environment (For Raspbian OS) Enable 1wire in raspi-config. ``` $ sudo raspi-config nonint do_onewire 0 ``` ## API ### Pi1Wire This is a class that looks for sensors. #### `find_all_sensors() -> List[OneWire]` Get a list of OneWire instances. #### `find(mac_address: str) -> OneWire` Get a OneWire instance of the specified MAC address. #### `find_all_and_change_resolution(resolution: Resolution, use_sudo: bool = True) -> List[OneWire]` Change the resolution of all sensors found and get them as a list of OneWire instances. The executing user must be able to use sudo. If the executing user has root privileges and does not need sudo, set the `use_sudo` option to False. ### OneWire This class controls the sensors. #### `mac_address` The MAC address property of the sensor. #### `get_temperature() -> float` Get the temperature. #### `change_resolution(resolution: Resolution, use_sudo: bool = True) -> None` Change the resolution of the temperature sensor. Depending on the `Resolution` definition, change to a resolution equivalent to increments of 0.5°C, 0.25°C, 0.125°C, or 0.0625°C. The executing user must be able to use sudo. If the executing user has root privileges and does not need sudo, set the `use_sudo` option to False. ### Resolution An enumeration that defines the resolution setting values. #### `X0_5` Resolution is set at 0.5°C. #### `X0_25` Resolution is set at 0.25°C. #### `X0_125` Resolution is set at 0.125°C. #### `X0_0625` Resolution is set at 0.0625°C. ## Change Log ### 0.3.0 - Added function to change resolution. - Fixed so that the order of sensor detection does not change depending on the file system. ### 0.2.0 - Added check for PowerOnResetValue. ### 0.1.0 - Initial release. ## License MIT %package -n python3-pi1wire Summary: 1Wire Sensor Library for Raspberry PI Provides: python-pi1wire BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-pi1wire pi1wire is a library for the Raspberry PI 1Wire sensor. ## Quick Sample Here is a simple usecase. ```python from pi1wire import Pi1Wire, Resolution for s in Pi1Wire().find_all_sensors(): print(f'{s.mac_address} = {s.get_temperature():.3f}') s.change_resolution(Resolution.X0_5) print(f'{s.mac_address} = {s.get_temperature():.3f}') ``` ## OS Environment (For Raspbian OS) Enable 1wire in raspi-config. ``` $ sudo raspi-config nonint do_onewire 0 ``` ## API ### Pi1Wire This is a class that looks for sensors. #### `find_all_sensors() -> List[OneWire]` Get a list of OneWire instances. #### `find(mac_address: str) -> OneWire` Get a OneWire instance of the specified MAC address. #### `find_all_and_change_resolution(resolution: Resolution, use_sudo: bool = True) -> List[OneWire]` Change the resolution of all sensors found and get them as a list of OneWire instances. The executing user must be able to use sudo. If the executing user has root privileges and does not need sudo, set the `use_sudo` option to False. ### OneWire This class controls the sensors. #### `mac_address` The MAC address property of the sensor. #### `get_temperature() -> float` Get the temperature. #### `change_resolution(resolution: Resolution, use_sudo: bool = True) -> None` Change the resolution of the temperature sensor. Depending on the `Resolution` definition, change to a resolution equivalent to increments of 0.5°C, 0.25°C, 0.125°C, or 0.0625°C. The executing user must be able to use sudo. If the executing user has root privileges and does not need sudo, set the `use_sudo` option to False. ### Resolution An enumeration that defines the resolution setting values. #### `X0_5` Resolution is set at 0.5°C. #### `X0_25` Resolution is set at 0.25°C. #### `X0_125` Resolution is set at 0.125°C. #### `X0_0625` Resolution is set at 0.0625°C. ## Change Log ### 0.3.0 - Added function to change resolution. - Fixed so that the order of sensor detection does not change depending on the file system. ### 0.2.0 - Added check for PowerOnResetValue. ### 0.1.0 - Initial release. ## License MIT %package help Summary: Development documents and examples for pi1wire Provides: python3-pi1wire-doc %description help pi1wire is a library for the Raspberry PI 1Wire sensor. ## Quick Sample Here is a simple usecase. ```python from pi1wire import Pi1Wire, Resolution for s in Pi1Wire().find_all_sensors(): print(f'{s.mac_address} = {s.get_temperature():.3f}') s.change_resolution(Resolution.X0_5) print(f'{s.mac_address} = {s.get_temperature():.3f}') ``` ## OS Environment (For Raspbian OS) Enable 1wire in raspi-config. ``` $ sudo raspi-config nonint do_onewire 0 ``` ## API ### Pi1Wire This is a class that looks for sensors. #### `find_all_sensors() -> List[OneWire]` Get a list of OneWire instances. #### `find(mac_address: str) -> OneWire` Get a OneWire instance of the specified MAC address. #### `find_all_and_change_resolution(resolution: Resolution, use_sudo: bool = True) -> List[OneWire]` Change the resolution of all sensors found and get them as a list of OneWire instances. The executing user must be able to use sudo. If the executing user has root privileges and does not need sudo, set the `use_sudo` option to False. ### OneWire This class controls the sensors. #### `mac_address` The MAC address property of the sensor. #### `get_temperature() -> float` Get the temperature. #### `change_resolution(resolution: Resolution, use_sudo: bool = True) -> None` Change the resolution of the temperature sensor. Depending on the `Resolution` definition, change to a resolution equivalent to increments of 0.5°C, 0.25°C, 0.125°C, or 0.0625°C. The executing user must be able to use sudo. If the executing user has root privileges and does not need sudo, set the `use_sudo` option to False. ### Resolution An enumeration that defines the resolution setting values. #### `X0_5` Resolution is set at 0.5°C. #### `X0_25` Resolution is set at 0.25°C. #### `X0_125` Resolution is set at 0.125°C. #### `X0_0625` Resolution is set at 0.0625°C. ## Change Log ### 0.3.0 - Added function to change resolution. - Fixed so that the order of sensor detection does not change depending on the file system. ### 0.2.0 - Added check for PowerOnResetValue. ### 0.1.0 - Initial release. ## License MIT %prep %autosetup -n pi1wire-0.3.0 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-pi1wire -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Fri May 05 2023 Python_Bot - 0.3.0-1 - Package Spec generated