File python-pyxdg.spec of Package python-pyxdg

#
# spec file for package python-pyxdg
#
# Copyright (c) 2023 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-%{**}}
%define oldpython python
%{?sle15_python_module_pythons}
Name:           python-pyxdg
Version:        0.28
Release:        150400.7.3.1
Summary:        Implementations of freedesktop.org standards in python
License:        LGPL-2.1-only
URL:            https://freedesktop.org/wiki/Software/pyxdg
Source0:        https://files.pythonhosted.org/packages/source/p/pyxdg/pyxdg-%{version}.tar.gz
# Test data: examples
Source1:        https://gitlab.freedesktop.org/xdg/pyxdg/-/archive/rel-%{version}/pyxdg-rel-%{version}.tar.gz?path=test/example#/pyxdg-%{version}-test-example.tar.gz
BuildRequires:  %{python_module pytest}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
BuildRequires:  python-rpm-macros
BuildRequires:  shared-mime-info
Requires:       hicolor-icon-theme
Requires:       shared-mime-info
Conflicts:      python-xdg
Obsoletes:      python-xdg
BuildArch:      noarch
%python_subpackages

%description
PyXDG is a python library to access freedesktop.org standards. Currently supported are:
 * Base Directory Specification Version 0.6
 * Menu Specification Version 1.0
 * Desktop Entry Specification Version 1.0
 * Icon Theme Specification Version 0.8
 * Recent File Spec 0.2
 * Shared-MIME-Database Specification 0.13

%prep
%setup -q -n pyxdg-%{version} -b 1
%autopatch -p1
cp -r ../pyxdg-rel-%{version}-test-example/test/example test/
sed -i 's/imp /importlib /' test/test_basedirectory.py

%build
%python_build

%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}

%check
%pytest test/test*.py -v

%files %{python_files}
%license COPYING
%doc README AUTHORS ChangeLog
%{python_sitelib}/xdg
%{python_sitelib}/pyxdg-%{version}-py*.egg-info

%changelog
* Tue Sep 26 2023 mmachova@suse.com
- Don't import deprecated imp module
* Fri Apr 21 2023 dmueller@suse.com
- add sle15_python_module_pythons (jsc#PED-68)
* Thu Apr 13 2023 mcepl@suse.com
- Make calling of %%{sle15modernpython} optional.
* Sat Sep 24 2022 dmueller@suse.com
- update to 0.28:
  * BaseDirectory: Add support for $XDG_STATE_DIR
* Thu Apr 29 2021 mmachova@suse.com
- Obsolete python-xdg to resolve conflicting state (boo#1178803)
  * see https://bbs.archlinux.org/viewtopic.php?id=262403 for a workaround
* Thu Dec  3 2020 code@bnavigator.de
- Update to version 0.27
  * Menu: Fix compatibility with Python >= 3.8.4
  * Menu: Fix several AttributeErrors
  * Menu: Fix duplication of menu entries due when Layout is provided
  * MenuEditor: Fix fromstring typo
  * Certain tests are more independent of external system conditions
  * Standardise shebangs to /usr/bin/env python3
- drop new-api.patch, resource_leak.patch merged upstream
- get example test data from gitlab repository -- pass all tests
* Mon Oct  5 2020 tchvatal@suse.com
- Also conflict with the python-xdg as we provide same namespace
* Wed Sep 30 2020 tchvatal@suse.com
- Do not provide xdg namespace as there is python-xdg package now
* Thu Jul 16 2020 mcepl@suse.com
- Skip over RulesTest.test_rule_from_node test
  (https://gitlab.freedesktop.org/xdg/pyxdg/-/issues/20)
* Mon Mar  2 2020 tchvatal@suse.com
- Add setuptools dependency
- Use pytest to run tests rather than nose that will break with
  python 3.10
* Sun Mar  1 2020 mook.moz+com.novell@gmail.com
- Fix Menu.py using attributes that no longer exist
  Patch from https://gitlab.freedesktop.org/xdg/pyxdg/-/merge_requests/2
  * new-api.patch
* Sun Sep 15 2019 jayvdb@gmail.com
- Fix test data to use sys.executable
* Wed Apr 24 2019 mimi.vx@gmail.com
- add resource_leak.patch - Fix several ResourceWarnings: unclosed file
* Tue Dec  4 2018 mcepl@suse.com
- Remove superfluous devel dependency for noarch package
* Tue May 22 2018 tchvatal@suse.com
- Update to 0.26.0:
  * IconTheme: Add support for Scale and ScaledDirectories keys.
  * DesktopEntry: New method findTryExec()
  * Menu: More efficient processing of filter rules by building a Python AST
  * Mime: Prefer the first mimetype found for a file extension, instead of the last
  * Mime: Allow unknown magic-matching rule formats
  * Mime: GlobDB has new methods first_match and all_matches for matching paths
  * Mime: New function get_extensions to get extensions for a given mime type
  * Mime: Fix MagicDB.match_data crashing with an unknown 'possible' mimetype
  * Mime: Correctly handle __NOMAGIC__ rule removing previous magic matches
  * Menu: XML parsing reworked
  * BaseDirectory: More secure creation of a fallback runtime directory with get_runtime_dir(strict=False)
  * Various miscellaneous improvements to testing.
* Tue May 22 2018 tchvatal@suse.com
- Fix provides/obsoletes to actually provide python2-xdg too
* Mon Oct  2 2017 jmatejek@suse.com
- drop test-icon test that fails because its standard is too old
- drop hicolor-icon-theme requirement which was needed for that test
* Fri May  5 2017 toddrme2178@gmail.com
- Don't provide python2-xdg. Singlespec packages should use the
  correct name.
* Mon May  1 2017 toddrme2178@gmail.com
- Add literal python-xdg provides.
* Mon Apr 24 2017 toddrme2178@gmail.com
- Fix source url
- Various small spec file cleanups.
* Thu Apr 13 2017 aloisio@gmx.com
- Converted to single-spec
- Updated source URL
* Thu Oct 22 2015 toddrme2178@gmail.com
- It doesn't need a shared-mime-info version that high.
  The unit tests just compare against pre-set values based on that
  version.  So remove BuildRequires version check and disable
  tests for earlier openSUSE versions.
* Sun Oct 11 2015 matwey.kornilov@gmail.com
- Provide/Obsolete python-xdg
  For some reason there is already python-xdg which should be
  python-pyxdg according to guidelines (pypi name is pyxdg).
* Sat Oct 10 2015 matwey.kornilov@gmail.com
- Initial version
openSUSE Build Service is sponsored by