# # spec file for package python-pytimeparse # # Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-pytimeparse Version: 1.1.8 Release: 0 Summary: Time expression parser License: MIT Group: Development/Languages/Python URL: https://github.com/wroberts/pytimeparse Source: https://files.pythonhosted.org/packages/source/p/pytimeparse/pytimeparse-%{version}.tar.gz BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros BuildArch: noarch %python_subpackages %description A small Python library to parse various kinds of time expressions, inspired by a StackOverflow question. The single function pytimeparse.timeparse.timeparse defined in the library (also available as pytimeparse.parse) parses time expressions like the following: * 32m * 2h32m * 3d2h32m * 1w3d2h32m * 1w 3d 2h 32m * 1 w 3 d 2 h 32 m * ... It returns the time as a number of seconds (an integer value if possible, otherwise a floating-point number) A number of seconds can be converted back into a string using the datetime module in the standard library. %prep %setup -q -n pytimeparse-%{version} sed -i '/nose/d' setup.py %build %python_build %install %python_install %python_expand %fdupes %{buildroot}%{$python_sitelib} %check %pytest pytimeparse/tests/test*.py %files %{python_files} %doc README.rst %license LICENSE.rst %{python_sitelib}/* %changelog