diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-04-10 10:33:26 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-04-10 10:33:26 +0000 |
| commit | 2b77f32146c36070cf07dbcdc0f773a7d6b7faaf (patch) | |
| tree | 74476c12ad0e2c0a74f3dbc34eb525bd4409ef4c | |
| parent | d3e06452a2e7b8f43dbb9782ecf75b143873d7ed (diff) | |
automatic import of python-suntime
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-suntime.spec | 286 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 288 insertions, 0 deletions
@@ -0,0 +1 @@ +/suntime-1.2.5.tar.gz diff --git a/python-suntime.spec b/python-suntime.spec new file mode 100644 index 0000000..a7c7592 --- /dev/null +++ b/python-suntime.spec @@ -0,0 +1,286 @@ +%global _empty_manifest_terminate_build 0 +Name: python-suntime +Version: 1.2.5 +Release: 1 +Summary: Simple sunset and sunrise time calculation python library +License: LGPLv3 +URL: https://github.com/SatAgro/suntime +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/ee/0a/3c8cf603700e2d9987ce5dcf06845fbf889eaa1b781f6b7b028773e3b765/suntime-1.2.5.tar.gz +BuildArch: noarch + +Requires: python3-dateutil + +%description +# SunTime +Simple sunset and sunrise time calculation python library. + +## Installation + +Using pip: + + pip3 install suntime + +Or download and type: + + python3 setup.py install + +## Usage + +You can use the library to get UTC and local time sunrise and sunset times typing: + +```python3 +import datetime +from suntime import Sun, SunTimeException + +latitude = 51.21 +longitude = 21.01 + +sun = Sun(latitude, longitude) + +# Get today's sunrise and sunset in UTC +today_sr = sun.get_sunrise_time() +today_ss = sun.get_sunset_time() +print('Today at Warsaw the sun raised at {} and get down at {} UTC'. + format(today_sr.strftime('%H:%M'), today_ss.strftime('%H:%M'))) + +# On a special date in your machine's local time zone +abd = datetime.date(2014, 10, 3) +abd_sr = sun.get_local_sunrise_time(abd) +abd_ss = sun.get_local_sunset_time(abd) +print('On {} the sun at Warsaw raised at {} and get down at {}.'. + format(abd, abd_sr.strftime('%H:%M'), abd_ss.strftime('%H:%M'))) + +# Error handling (no sunset or sunrise on given location) +latitude = 87.55 +longitude = 0.1 +sun = Sun(latitude, longitude) +try: + abd_sr = sun.get_local_sunrise_time(abd) + abd_ss = sun.get_local_sunset_time(abd) + print('On {} at somewhere in the north the sun raised at {} and get down at {}.'. + format(abd, abd_sr.strftime('%H:%M'), abd_ss.strftime('%H:%M'))) +except SunTimeException as e: + print("Error: {0}.".format(e)) +``` + +## License + +Copyright © 2019 SatAgro Sp. z o.o. and contributors: + +* Krzysztof Stopa ([kstopa](https://github.com/kstopa)) +* Andrey Kobyshev ([yokotoka](https://github.com/yokotoka)) +* Matthias ([palto42](https://github.com/plato42)) +* Hadrien Bertrand ([hbertrand](https://github.com/hbertrand)) + + +This file is part of SunTime library for python (SunTime). + +SunTime is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. + +SunTime is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along with CAMS tools. If not, see http://www.gnu.org/licenses/. + + + + +%package -n python3-suntime +Summary: Simple sunset and sunrise time calculation python library +Provides: python-suntime +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-suntime +# SunTime +Simple sunset and sunrise time calculation python library. + +## Installation + +Using pip: + + pip3 install suntime + +Or download and type: + + python3 setup.py install + +## Usage + +You can use the library to get UTC and local time sunrise and sunset times typing: + +```python3 +import datetime +from suntime import Sun, SunTimeException + +latitude = 51.21 +longitude = 21.01 + +sun = Sun(latitude, longitude) + +# Get today's sunrise and sunset in UTC +today_sr = sun.get_sunrise_time() +today_ss = sun.get_sunset_time() +print('Today at Warsaw the sun raised at {} and get down at {} UTC'. + format(today_sr.strftime('%H:%M'), today_ss.strftime('%H:%M'))) + +# On a special date in your machine's local time zone +abd = datetime.date(2014, 10, 3) +abd_sr = sun.get_local_sunrise_time(abd) +abd_ss = sun.get_local_sunset_time(abd) +print('On {} the sun at Warsaw raised at {} and get down at {}.'. + format(abd, abd_sr.strftime('%H:%M'), abd_ss.strftime('%H:%M'))) + +# Error handling (no sunset or sunrise on given location) +latitude = 87.55 +longitude = 0.1 +sun = Sun(latitude, longitude) +try: + abd_sr = sun.get_local_sunrise_time(abd) + abd_ss = sun.get_local_sunset_time(abd) + print('On {} at somewhere in the north the sun raised at {} and get down at {}.'. + format(abd, abd_sr.strftime('%H:%M'), abd_ss.strftime('%H:%M'))) +except SunTimeException as e: + print("Error: {0}.".format(e)) +``` + +## License + +Copyright © 2019 SatAgro Sp. z o.o. and contributors: + +* Krzysztof Stopa ([kstopa](https://github.com/kstopa)) +* Andrey Kobyshev ([yokotoka](https://github.com/yokotoka)) +* Matthias ([palto42](https://github.com/plato42)) +* Hadrien Bertrand ([hbertrand](https://github.com/hbertrand)) + + +This file is part of SunTime library for python (SunTime). + +SunTime is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. + +SunTime is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along with CAMS tools. If not, see http://www.gnu.org/licenses/. + + + + +%package help +Summary: Development documents and examples for suntime +Provides: python3-suntime-doc +%description help +# SunTime +Simple sunset and sunrise time calculation python library. + +## Installation + +Using pip: + + pip3 install suntime + +Or download and type: + + python3 setup.py install + +## Usage + +You can use the library to get UTC and local time sunrise and sunset times typing: + +```python3 +import datetime +from suntime import Sun, SunTimeException + +latitude = 51.21 +longitude = 21.01 + +sun = Sun(latitude, longitude) + +# Get today's sunrise and sunset in UTC +today_sr = sun.get_sunrise_time() +today_ss = sun.get_sunset_time() +print('Today at Warsaw the sun raised at {} and get down at {} UTC'. + format(today_sr.strftime('%H:%M'), today_ss.strftime('%H:%M'))) + +# On a special date in your machine's local time zone +abd = datetime.date(2014, 10, 3) +abd_sr = sun.get_local_sunrise_time(abd) +abd_ss = sun.get_local_sunset_time(abd) +print('On {} the sun at Warsaw raised at {} and get down at {}.'. + format(abd, abd_sr.strftime('%H:%M'), abd_ss.strftime('%H:%M'))) + +# Error handling (no sunset or sunrise on given location) +latitude = 87.55 +longitude = 0.1 +sun = Sun(latitude, longitude) +try: + abd_sr = sun.get_local_sunrise_time(abd) + abd_ss = sun.get_local_sunset_time(abd) + print('On {} at somewhere in the north the sun raised at {} and get down at {}.'. + format(abd, abd_sr.strftime('%H:%M'), abd_ss.strftime('%H:%M'))) +except SunTimeException as e: + print("Error: {0}.".format(e)) +``` + +## License + +Copyright © 2019 SatAgro Sp. z o.o. and contributors: + +* Krzysztof Stopa ([kstopa](https://github.com/kstopa)) +* Andrey Kobyshev ([yokotoka](https://github.com/yokotoka)) +* Matthias ([palto42](https://github.com/plato42)) +* Hadrien Bertrand ([hbertrand](https://github.com/hbertrand)) + + +This file is part of SunTime library for python (SunTime). + +SunTime is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. + +SunTime is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along with CAMS tools. If not, see http://www.gnu.org/licenses/. + + + + +%prep +%autosetup -n suntime-1.2.5 + +%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-suntime -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 1.2.5-1 +- Package Spec generated @@ -0,0 +1 @@ +fdcd5b10700d29494a6a326f86597a95 suntime-1.2.5.tar.gz |
