ea74733
Name:           mu
fb7cfce
Version:        1.1.1
fb7cfce
Release:        1%{?dist}
d62782a
Summary:        A simple Python editor not only for micro:bit
ea74733
License:        GPLv3
d62782a
URL:            https://github.com/mu-editor/mu
fb7cfce
Source0:        %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
107a3e8
ae118b8
# Mu 1.1+ creates a virtual environment when it starts and installs
ae118b8
# a bunch of packages from PyPI to it.
ae118b8
# See https://github.com/mu-editor/mu/commit/37a0e0df46
ae118b8
# The downloaded wheels from PyPI are cached to %%{python3_sitelib}, which fails without root/sudo.
ae118b8
# See https://github.com/mu-editor/mu/issues/1634
ae118b8
# Downloading software from the internet cannot be required for an official RPM package to function,
ae118b8
# so we disable it here.
ae118b8
# With this patch, the packages normally installed to the virtual environment
ae118b8
# are required on runtime and the virtual environment is created with --system-site-packages.
ae118b8
# This kinda goes against the entire idea of the virtualenv feature,
ae118b8
# but it is the only reasonable way to have Mu packaged.
ae118b8
Patch:          system-site-packages.patch
ae118b8
ea74733
BuildArch:      noarch
d62782a
980041c
BuildRequires:  pyproject-rpm-macros
d62782a
BuildRequires:  python3-devel
980041c
BuildRequires:  python3-pytest
b80e022
# no dist provide for this:
ea74733
BuildRequires:  python3-qt5
b80e022
BuildRequires:  python3-qscintilla-qt5
980041c
BuildRequires:  qt5-qtserialport >= 5.5.0
b80e022
b80e022
BuildRequires:  systemd
d62782a
8f95914
BuildRequires:  /usr/bin/desktop-file-install
8f95914
BuildRequires:  /usr/bin/xvfb-run
8f95914
BuildRequires:  /usr/bin/msgfmt
d62782a
d9fb838
# unbundled
980041c
BuildRequires:  python3dist(microfs) >= 1.3
62ff9cb
BuildRequires:  python3dist(uflash) >= 2
980041c
980041c
Requires:       python%{python3_version}dist(microfs) >= 1.3
62ff9cb
Requires:       python%{python3_version}dist(uflash) >= 2
d9fb838
Requires:       python3-qt5 >= 5.11
d9fb838
Requires:       python3-qscintilla-qt5 >= 2.10.7
b80e022
Requires:       hicolor-icon-theme
ea74733
1f1cf66
# The name on PyPI and the Shell command
1f1cf66
Provides:       mu-editor = %{version}-%{release}
1f1cf66
ea74733
%description
d62782a
mu is a simple Python editor also for BBC micro:bit devices.
ea74733
ea74733
%prep
d9fb838
%autosetup -p1
d9fb838
d9fb838
# make the versions not pinned for the entry_point to work
d9fb838
# also pyqt and qscintilla are not properly provided in Fedora :(
fb7cfce
# relax as well the python version requirement
d9fb838
# upstream removes some reqs on arm, we don't
fb7cfce
sed -i -e 's/PyQt5==5.13.2"/PyQt5>=5.13.2",/' \
fb7cfce
       -e 's/QScintilla==2.11.3"/QScintilla>=2.11.3",/' \
fb7cfce
       -e 's/PyQtChart==5.13.1"/PyQtChart >= 5.13.1, < 6",/' \
fb7cfce
       -e '/platform_machine/d' \
fb7cfce
       -e 's/jupyter-client>=4.1,<6.2/jupyter-client>=4.1/' \
fb7cfce
       -e 's/ipykernel>=4.1,<6/ipykernel>=4.1/' \
fb7cfce
       -e 's/qtconsole==4.7.7/qtconsole >= 4.7.7, < 6/' \
fb7cfce
       -e 's/pyserial~=3.5/pyserial>=3.4/' \
fb7cfce
       -e 's/black>=19.10b0,<22.1.0/black>=19.10b0/' \
fb7cfce
       -e 's/python_requires=">=3.5,<3.9"/python_requires=">=3.5"/' \
d9fb838
       setup.py
ea74733
d62782a
# unbundle things
fb7cfce
sed -i 's/from mu.contrib import /import /' mu/modes/microbit.py tests/modes/test_microbit.py \
fb7cfce
                                            mu/modes/base.py
b80e022
rm -rf mu/contrib
fb7cfce
sed -i '/"mu.contrib",/d' setup.py
fb7cfce
sed -i 's/mu.contrib.//' tests/modes/test_microbit.py
b80e022
fb7cfce
# Fix locale typo
fb7cfce
# https://github.com/mu-editor/mu/pull/2168
fb7cfce
sed -i 's/Black"\\/Black\\"/' mu/locale/ru_RU/LC_MESSAGES/mu.po
980041c
fb7cfce
# Remove the pytest-random-order requirement as it's not packaged in Fedora
fb7cfce
sed -i '/random-order/d' pytest.ini
980041c
980041c
%generate_buildrequires
980041c
%pyproject_buildrequires -r
980041c
d62782a
ea74733
%build
8f95914
# rebuild locales
8f95914
cd mu/locale
8f95914
for FILE in *; do
8f95914
  rm $FILE/LC_MESSAGES/mu.mo
8f95914
  msgfmt $FILE/LC_MESSAGES/mu.po -o $FILE/LC_MESSAGES/mu.mo
8f95914
  rm $FILE/LC_MESSAGES/mu.po
8f95914
done
8f95914
cd -
980041c
%pyproject_wheel
ea74733
b80e022
ea74733
%install
980041c
%pyproject_install
980041c
%pyproject_save_files mu
b80e022
b80e022
mkdir -p %{buildroot}%{_datadir}/applications \
b80e022
         %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/ \
b80e022
         %{buildroot}%{_udevrulesdir} \
b80e022
         %{buildroot}%{_metainfodir}
b80e022
b80e022
desktop-file-install --dir=%{buildroot}%{_datadir}/applications conf/mu.codewith.editor.desktop
b80e022
cp -p conf/mu.codewith.editor.png %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/
b80e022
cp -p conf/90-usb-microbit.rules %{buildroot}%{_udevrulesdir}/
b80e022
cp -p conf/mu.appdata.xml %{buildroot}%{_metainfodir}/
b80e022
ea74733
d62782a
%check
a15d825
# test_ButtonBar_add_action mocks `super` which conflicts with pkg_resources
a15d825
# Issue: https://github.com/mu-editor/mu/issues/2091
a15d825
xvfb-run %{python3} -m pytest -vv tests -k "not test_ButtonBar_add_action"
d62782a
b80e022
980041c
%files -f %{pyproject_files}
ea74733
%doc README.rst LICENSE
b80e022
%{_bindir}/mu-editor
b80e022
%{_udevrulesdir}/90-usb-microbit.rules
b80e022
%{_datadir}/icons/hicolor/256x256/apps/mu.codewith.editor.png
b80e022
%{_datadir}/applications/mu.codewith.editor.desktop
b80e022
%{_metainfodir}/mu.appdata.xml
b80e022
ea74733
ea74733
%changelog
fb7cfce
* Tue Apr 19 2022 Charalampos Stratakis <cstratak@redhat.com> - 1.1.1-1
fb7cfce
- Update to 1.1.1
fb7cfce
42c1773
* Tue Apr 19 2022 Miro Hrončok <mhroncok@redhat.com> - 1.0.3-16
42c1773
- Allow pyserial 3.5
42c1773
- Fixes rhbz#2074419
42c1773
a15d825
* Mon Mar 07 2022 Karolina Surma <ksurma@redhat.com> - 1.0.3-15
a15d825
- Skip test that fails with setuptools >= 60.6
a15d825
54d13fe
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.3-14
54d13fe
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
54d13fe
f31e2ab
* Mon Oct 25 2021 Miro Hrončok <mhroncok@redhat.com> - 1.0.3-13
f31e2ab
- Allow pyflakes 2.4
f31e2ab
- Fixes rhbz#2016933
f31e2ab
54818a4
* Tue Oct 12 2021 Miro Hrončok <mhroncok@redhat.com> - 1.0.3-12
54818a4
- Allow pycodestyle 2.8
54818a4
- Fixes rhbz#2013269
54818a4
107a3e8
* Tue Sep 28 2021 Miro Hrončok <mhroncok@redhat.com> - 1.0.3-11
107a3e8
- Fix crash on startup on Python 3.10+
107a3e8
- Fixes: rhbz#2008378
107a3e8
421e0b4
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.3-10
421e0b4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
421e0b4
a215fde
* Wed Jul 07 2021 Miro Hrončok <mhroncok@redhat.com> - 1.0.3-9
a215fde
- Relax the required versions of pyflakes and pycodestyle
a215fde
- Fixes rhbz#1979411
a215fde
2c56f69
* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 1.0.3-8
2c56f69
- Rebuilt for Python 3.10
2c56f69
431f2e2
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.3-7
431f2e2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
431f2e2
980041c
* Wed Nov 25 2020 Miro Hrončok <mhroncok@redhat.com> - 1.0.3-6
980041c
- Mark language files as such
8f95914
- Remove *.po files
980041c
- Remove useless shebang
980041c
3fe484b
* Wed Nov 25 2020 Miro Hrončok <mhroncok@redhat.com> - 1.0.3-5
3fe484b
- Allow qtconsole 5
3fe484b
- Fixes: rhbz#1901573
3fe484b
fd688c4
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.3-4
fd688c4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
fd688c4
c78b12d
* Mon Jun 01 2020 Miro Hrončok <mhroncok@redhat.com> - 1.0.3-3
c78b12d
- Allow pyflakes 2.2 and pycodestyle 2.6 (#1841648)
c78b12d
e15e748
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 1.0.3-2
e15e748
- Rebuilt for Python 3.9
e15e748
1f1cf66
* Sat Apr 18 2020 Miro Hrončok <mhroncok@redhat.com> - 1.0.3-1
1f1cf66
- Update to 1.0.3
1f1cf66
- Provide mu-editor
1f1cf66
05ed6bd
* Thu Feb 06 2020 Miro Hrončok <mhroncok@redhat.com> - 1.0.2-8
05ed6bd
- Adapt the shebang to use the -s flag and only use system installed modules (#1799790)
05ed6bd
00df16d
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.2-7
00df16d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
00df16d
2505427
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 1.0.2-6
2505427
- Rebuilt for Python 3.8.0rc1 (#1748018)
2505427
284e84b
* Fri Aug 30 2019 Miro Hrončok <mhroncok@redhat.com> - 1.0.2-5
284e84b
- Relax the dependency version restrictions for matplotlib
284e84b
63027ac
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 1.0.2-4
63027ac
- Rebuilt for Python 3.8
63027ac
ea85489
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.2-3
ea85489
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
ea85489
4b4d07d
* Sat Jul 20 2019 Miro Hrončok <mhroncok@redhat.com> - 1.0.2-2
4b4d07d
- Relax the dependency version restrictions even further (#1731655)
4b4d07d
cefefef
* Sun Mar 24 2019 Miro Hrončok <mhroncok@redhat.com> - 1.0.2-1
cefefef
- Update to 1.0.2
cefefef
- Loosen some strict dependency declarations
cefefef
- Fix test failure
cefefef
d680c11
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.0-4
d680c11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
d680c11
1af70c7
* Fri Nov 30 2018 Miro Hrončok <mhroncok@redhat.com> - 1.0.0-3
1af70c7
- Mu works with matplotlib 3.0
1af70c7
d9fb838
* Thu Sep 13 2018 Miro Hrončok <mhroncok@redhat.com> - 1.0.0-2
d9fb838
- Fix requires to allow startup
d9fb838
- Fix the desktop file
d9fb838
b80e022
* Tue Aug 14 2018 Miro Hrončok <mhroncok@redhat.com> - 1.0.0-1
b80e022
- Update to 1.0.0 (#1387943)
b80e022
- Move udev rules to /usr/lib/udev/rules.d (#1602361)
b80e022
84f0193
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.13-4
84f0193
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
84f0193
dff3a86
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.9.13-3
dff3a86
- Rebuilt for Python 3.7
dff3a86
e6b9171
* Sun May 27 2018 Miro Hrončok <mhroncok@redhat.com> - 0.9.13-2
e6b9171
- Add missing requires (pyflakes, pep8) (#1582237)
e6b9171
d62782a
* Tue Apr 10 2018 Miro Hrončok <mhroncok@redhat.com> - 0.9.13-1
d62782a
- Updated to 0.9.13
d62782a
- Unbundle things
d62782a
- Run tests
d62782a
79c7dcc
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.2-6
79c7dcc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
79c7dcc
96cb4ce
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.2-5
96cb4ce
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
96cb4ce
f36c7b1
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.2-4
f36c7b1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
f36c7b1
823ea0b
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 0.2-3
823ea0b
- Rebuild for Python 3.6
823ea0b
9d2e5c6
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2-2
9d2e5c6
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
9d2e5c6
ea74733
* Wed Apr 13 2016 Kushal Das <kushal@fedoraprojects.org> - 0.2-1
ea74733
- Updates to 0.2 release
ea74733
ea74733
* Fri Feb 26 2016 Kushal Das <kushal@fedoraprojects.org> - 0.1-2
ea74733
- Updates the desktop file creation
ea74733
ea74733
* Tue Feb 02 2016 Kushal Das <kushal@fedoraprojects.org> - 0.1-1
ea74733
- Initial package creation