Blob Blame History Raw

%global _description %{expand:
Spyder is a powerful scientific environment written in Python, for Python, and 
designed by and for scientists, engineers and data analysts. It features a 
unique combination of the advanced editing, analysis, debugging and profiling 
functionality of a comprehensive development tool with the data exploration, 
interactive execution, deep inspection and beautiful visualization capabilities 
of an analysis package. Furthermore, Spyder offers built-in integration with 
many popular scientific libraries, including NumPy, SciPy, Pandas, IPython, 
QtConsole, Matplotlib, SymPy, and more, and can be extended further with 
full plugin support.

Name:		spyder
Version:	5.3.1
Release:	%autorelease
Summary:	Scientific Python Development Environment


Patch0:		%{name}-%{version}_relax_versions.patch
License:	MIT
BuildArch:	noarch
ExcludeArch: %{ix86}


%package -n python3-%{name}
Summary:	%{summary}

%{?python_provide:%python_provide python3-%{name}}

BuildRequires:	python3-devel
BuildRequires:	python3-sphinx
BuildRequires:	python3-setuptools
BuildRequires:	desktop-file-utils
BuildRequires:	libappstream-glib

Requires:	hicolor-icon-theme
Requires:	mathjax

%description -n python3-%{name}

%setup -q -n %{name}-%{version}
sed -i 's/\xe2\x80\x8b//g' scripts/org.spyder_ide.spyder.appdata.xml


rm -rf PKG-INFO external-deps

# Remove DOS line endings
for file in `find -name "*.rst" -o -name "*.py" -o -name "*.css"`; do
	sed "s|\r||g" $file > $ && \
	touch -r $file $ && \
	mv $ $file

# remove bundled mathjax
rm -rvf spyder/plugins/help/utils/js/mathjax


mkdir -p %{buildroot}%{_datadir}/appdata
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/

desktop-file-install --dir=%{buildroot}%{_datadir}/applications scripts/%{name}.desktop

# install appdata file
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/metainfo/org.spyder_ide.spyder.appdata.xml

# cleanup
rm -rvf %{buildroot}%{python3_sitelib}/spyderlib/doc/{.buildinfo,.doctrees}
rm -rvf %{buildroot}%{_bindir}/

# replace bundled mathjax with a symlink to the system mathjax
ln -s %{_datadir}/javascript/mathjax/ \

# provide spyder3 as symlink to spyder binary for continuity
ln -s %{_bindir}/spyder %{buildroot}%{_bindir}/spyder3


%pretrans -n python3-%{name} -p <lua>
--[[Back up any bundled mathjax directory from the old package. See:
path = "%{python3_sitelib}/spyder/plugins/help/utils/js/mathjax"
st = posix.stat(path)
if st and st.type == "directory" then
  status = os.rename(path, path .. ".rpmmoved")
  if not status then
    suffix = 0
    while not status do
      suffix = suffix + 1
      status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix)
    os.rename(path, path .. ".rpmmoved")

%files -n python3-%{name}
# A backed-up bundled mathjax directory from a previous upgrade may be present:
%ghost %{python3_sitelib}/spyder/plugins/help/utils/js/mathjax.rpmmoved