c3308d9
# Use forge macros for pulling from GitHub
c3308d9
%global forgeurl https://github.com/spyder-ide/spyder/
de20e7d
fff9a96
Name:           spyder
0528131
Version:        6.0.0~a1
fff9a96
Release:        %autorelease
fff9a96
Summary:        Scientific Python Development Environment
0528131
%global tag v%{version_no_tilde %{quote:%nil}}
c3308d9
%forgemeta
fff9a96
License:        MIT
fff9a96
URL:            https://www.spyder-ide.org/
7902da2
Source:         %forgesource
c9424d3
d983194
# Bump jedi upper bound from <0.19.0 to <0.20.0
5d3418f
# https://github.com/spyder-ide/spyder/pull/21367 (backported)
5d3418f
Patch:          21367.patch
c9424d3
3b05649
# Ensure no source files have useless shebangs
5d3418f
# https://github.com/spyder-ide/spyder/pull/21372 (backported)
5d3418f
Patch:          21372.patch
3b05649
09df114
# Bump python-lsp-server upper bound to <=1.9.0
09df114
# https://github.com/spyder-ide/spyder/pull/21501 (backported)
09df114
Patch:          21501.patch
c1e5c67
0528131
# Remove upper bound from spyder-kernels
0528131
# We are a little out of sync with spyder-kernels
0528131
Patch:          no_upper_bound_for_kernels.patch
0528131
cea4f3d
# Fix deprecated top-level developer_name in AppData XML
ccf4294
# Add a developer id in the AppData
cea4f3d
# https://github.com/spyder-ide/spyder/pull/21510
cea4f3d
Patch:          %{forgeurl}/pull/21510.patch
cea4f3d
fff9a96
BuildArch:      noarch
f4c2178
# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
fff9a96
ExcludeArch:    %{ix86}
0656feb
# Taken from pyqtwebengine's spec file. Since we require this, we need
0656feb
# to follow suit.
0656feb
ExclusiveArch:  %{qt5_qtwebengine_arches}
b9ffb45
17274e7
BuildRequires:  python3-devel
17274e7
266870a
BuildRequires:  dos2unix
266870a
27542f0
BuildRequires:  desktop-file-utils
3cdde28
# Still required by guidelines for now since Fedora uses appstream-builder
3cdde28
# (https://pagure.io/packaging-committee/issue/1053):
3cdde28
BuildRequires:  libappstream-glib
3cdde28
# Matches what gnome-software and others use:
3cdde28
BuildRequires:  appstream
3cdde28
3cdde28
%global appname org.spyder_ide.spyder
3cdde28
c3308d9
%global _description %{expand:
9314002
Spyder is a powerful scientific environment written in Python, for Python, and
9314002
designed by and for scientists, engineers and data analysts. It offers a unique
9314002
combination of the advanced editing, analysis, debugging, and profiling
9314002
functionality of a comprehensive development tool with the data exploration,
9314002
interactive execution, deep inspection, and beautiful visualization
9314002
capabilities of a scientific package.
9314002
9314002
Beyond its many built-in features, its abilities can be extended even further
9314002
via its plugin system and API. Furthermore, Spyder can also be used as a PyQt5
9314002
extension library, allowing you to build upon its functionality and embed its
9314002
components, such as the interactive console, in your own software.}
c3308d9
c3308d9
%description %_description
Chen Lei 47c3b6e
fff9a96
e045d21
%package -n python3-spyder
fff9a96
Summary:    %{summary}
d185d2a
d2d8fc4
# For %%{_datadir}/icons
27542f0
Requires:       hicolor-icon-theme
d2d8fc4
# Unbundled from spyder/plugins/help/utils/js/mathjax
27542f0
Requires:       mathjax
8c72901
# Required for the plugin (but not for building Spyder)
8c72901
Requires:       python3-pylint
d185d2a
e045d21
%description -n python3-spyder %_description
d185d2a
fff9a96
Chen Lei 47c3b6e
%prep
c3308d9
%forgeautosetup -p1
33e2187
86a65fb
# Remove bundled external dependencies
2950d3d
rm -rvf external-deps/ spyder/plugins/help/utils/js/mathjax
86a65fb
266870a
# Fix DOS/CRNL line endings in files that may be installed
266870a
find . -type f \( \
266870a
    -name '*.rst' -o -name '*.md' -o -name '*.py' -o -name '*.css' \
266870a
    \) -exec dos2unix --keepdate '{}' '+'
d185d2a
7bb66df
# Temporary measure since the 6.x pre-releases are behind stable 5.x
7bb66df
# releases wrt to the version boundaries of dependencies, but we would
7bb66df
# like to keep rawhide and F39 in sync.
8c72901
# Drop dependency on linters (pylint and pylint-venv)
8c72901
sed -i \
8c72901
-e '/pylint>.*/d' \
8c72901
-e '/pylint-venv>.*/d' setup.py
8c72901
# Drop upper bound for qtconsole (5.5.0 > 5.5~~)
88894c9
sed -r -i 's|(qtconsole.*),<5.5.0|\1|' setup.py
8c72901
# Do the same for qdarkstyle (3.2.1 > 3.2~~)
7bb66df
sed -r -i 's|(qdarkstyle.*),<3.2.0|\1|' setup.py
0f5dd80
c3308d9
c3308d9
%generate_buildrequires
c3308d9
%pyproject_buildrequires
c3308d9
e61e781
Chen Lei 47c3b6e
%build
c3308d9
%pyproject_wheel
Chen Lei 47c3b6e
Chen Lei 47c3b6e
eb85c6b
%install
c3308d9
%pyproject_install
ae6dd30
%pyproject_save_files -l spyder
Chen Lei 47c3b6e
e045d21
desktop-file-install --dir=%{buildroot}%{_datadir}/applications scripts/spyder.desktop
5042d4b
5042d4b
# cleanup
b05276d
rm -rvf %{buildroot}%{_bindir}/spyder_win_post_install.py
eb85c6b
a6ffa1f
# replace bundled mathjax with a symlink to the system mathjax
1690c6d
ln -s %{_datadir}/javascript/mathjax/ \
1690c6d
    %{buildroot}%{python3_sitelib}/spyder/plugins/help/utils/js/mathjax
1690c6d
7b31599
# provide spyder3 as symlink to spyder binary for continuity
c8bce87
ln -s spyder %{buildroot}%{_bindir}/spyder3
b884ecb
b884ecb
3cdde28
%check
3cdde28
# Still required by guidelines for now since Fedora uses appstream-builder
3cdde28
# (https://pagure.io/packaging-committee/issue/1053):
3cdde28
appstream-util validate-relax --nonet \
3cdde28
    %{buildroot}/%{_metainfodir}/%{appname}.appdata.xml
3cdde28
# Matches what gnome-software and others use:
ed53666
appstreamcli validate --no-net --explain \
3cdde28
    %{buildroot}/%{_metainfodir}/%{appname}.appdata.xml
3cdde28
3cdde28
e045d21
%pretrans -n python3-spyder -p <lua>
b884ecb
--[[Back up any bundled mathjax directory from the old package. See:
b884ecb
https://docs.fedoraproject.org/en-US/packaging-guidelines/Directory_Replacement
b884ecb
]]
b884ecb
path = "%{python3_sitelib}/spyder/plugins/help/utils/js/mathjax"
b884ecb
st = posix.stat(path)
b884ecb
if st and st.type == "directory" then
b884ecb
  status = os.rename(path, path .. ".rpmmoved")
b884ecb
  if not status then
b884ecb
    suffix = 0
b884ecb
    while not status do
b884ecb
      suffix = suffix + 1
b884ecb
      status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix)
b884ecb
    end
b884ecb
    os.rename(path, path .. ".rpmmoved")
b884ecb
  end
b884ecb
end
b884ecb
b884ecb
e045d21
%files -n python3-spyder -f %{pyproject_files}
31c88b8
%doc CHANGELOG.md
31c88b8
%doc README.md
31c88b8
b884ecb
# A backed-up bundled mathjax directory from a previous upgrade may be present:
b884ecb
%ghost %{python3_sitelib}/spyder/plugins/help/utils/js/mathjax.rpmmoved
c3308d9
%{python3_sitelib}/spyder/plugins/help/utils/js/mathjax
85a22a4
e045d21
%{_bindir}/spyder
e045d21
%{_bindir}/spyder3
85a22a4
3cdde28
%{_metainfodir}/%{appname}.appdata.xml
e045d21
%{_datadir}/applications/spyder.desktop
7b31599
%{_datadir}/icons/spyder.png
d185d2a
d185d2a
Chen Lei 47c3b6e
%changelog
376625d
%autochangelog