# Detect the distribution in use
%global __despace head -n 1 | tr -d '[:space:]' | sed -e 's/[(].*[)]//g'
%global __lower4 cut -c 1-4 | tr '[:upper:]' '[:lower:]'
%global __distfile %([ -f /etc/SuSE-release ] && echo /etc/SuSE-release || echo /etc/redhat-release)
%global __distinit %(sed -e 's/ release .*//' -e 's/\\([A-Za-z]\\)[^ ]*/\\1/g' %{__distfile} | %{__despace} | %{__lower4})
%global __distvers %(sed -e 's/.* release \\([^. ]*\\).*/\\1/' %{__distfile} | %{__despace})
# Identify Alma, CentOS, CentOS Stream and Rocky Linux as rhel
%if "%{__distinit}" == "a" || "%{__distinit}" == "c" || "%{__distinit}" == "cl" || "%{__distinit}" == "cs" || "%{__distinit}" == "rl"
%global __distinit rhel
%endif
# Dist tag for Fedora is still "fc"
%if "%{__distinit}" == "f"
%global __distinit fc
%endif
%global python2ver %(python2 -c "import sys; print sys.version[:3]" || echo none)
%{!?python2_sitelib: %global python2_sitelib %{_prefix}/lib/python%{python2ver}/site-packages}
%global moin_static_content_dir %{python2_sitelib}/MoinMoin/web/static/htdocs
Summary: The "mentalwealth" theme for the moin wiki engine
Name: moin-theme-mentalwealth
Version: 0.96
Release: 8.%{__distinit}%{__distvers}
URL: http://moinmo.in/ThemeMarket/MentalWealth
Source0: mentalwealth-%(echo %{version} | sed -e 's/0\./0/').zip
Patch1: moin-theme-mentalwealth-0.95.2-style-dd-p.patch
Patch2: moin-theme-mentalwealth-0.95.2-moin-1.9.x.patch
License: GPL-2.0-or-later
BuildArch: noarch
BuildRequires: coreutils
BuildRequires: python2
BuildRequires: sed
Requires: moin >= 1.9.0
Requires: python(abi) = %{python2ver}
%description
The popular MentalHealth theme has been retired to make way for MentalWealth,
now version MoinMoin 1.5 compatible and with a left-side menu bar... because
having it on the right is just too prone to problems.
%package orange
Summary: Orange variant of the "mentalwealth" theme for the moin wiki engine
Requires: %{name} = %{version}-%{release}
%description orange
%{summary}.
%package purple
Summary: Purple variant of the "mentalwealth" theme for the moin wiki engine
Requires: %{name} = %{version}-%{release}
%description purple
%{summary}.
%package red
Summary: Red variant of the "mentalwealth" theme for the moin wiki engine
Requires: %{name} = %{version}-%{release}
%description red
%{summary}.
%prep
%setup -q -n mentalwealth
# Fix line endings
sed -i -e 's/\r$//' readme.* mentalwealth.py
# Patch from Chris Lawther to fix up CSS for
within
%patch -P 1 -p1
# Fix for compatibility with moin ≥ 1.9.0
%patch -P 2 -p1
cat << EOF > README.rpm
After installing this package, any newly-created wiki instances should
automatically have the mentalwealth theme available.
To make the mentalwealth theme available to an existing wiki instance, copy
%{_datadir}/moin/data/plugin/theme/mentalwealth.py*
to the data/plugin/theme directory of the wiki instance and do:
chown apache:apache /path/to/wiki/data/plugin/theme/mentalwealth.py*
EOF
# Make all the different variants
ln -s . mentalwealth
for subtheme in orange purple red
do
mkdir -p mentalwealth-${subtheme}/css
sed -e "s/mentalwealth\([ .]\)/mentalwealth-${subtheme}\1/g" \
README.rpm > mentalwealth-${subtheme}/README.rpm
sed -e 's/\(name[[:space:]]*=[[:space:]]*\)'\''mentalwealth'\''/\1'\''mentalwealth-'${subtheme}\'/ \
mentalwealth.py > mentalwealth-${subtheme}/mentalwealth-${subtheme}.py
cd mentalwealth-${subtheme}/css
ln -s ../../mentalwealth/css/*.css .
rm -f skin-*.css screen.css
mv ../../mentalwealth/css/skin-${subtheme}.css .
sed -e 's#.*skin-blue.*#/* & */#' -e 's#.*\(@import url(skin-'${subtheme}'.css);\).*#\1#' \
../../mentalwealth/css/screen.css > screen.css
cd -
cd mentalwealth-${subtheme}
ln -s ../mentalwealth/img .
cd -
done
%build
# Generate normal (.pyc) byte-compiled files.
python2 -c 'import compileall; compileall.compile_dir(".", 1, "/", 1)'
# Generate optimized (.pyo) byte-compiled files.
python2 -O -c 'import compileall; compileall.compile_dir(".", 1, "/", 1)'
%install
install -d -m 755 %{buildroot}%{_datadir}/moin/data/plugin/theme
install -p -m 644 mentalwealth.py* %{buildroot}%{_datadir}/moin/data/plugin/theme/
install -d -m 755 %{buildroot}%{moin_static_content_dir}/mentalwealth/{css,img}
install -p -m 644 css/*.css %{buildroot}%{moin_static_content_dir}/mentalwealth/css/
install -p -m 644 img/*.png %{buildroot}%{moin_static_content_dir}/mentalwealth/img/
for subtheme in orange purple red
do
install -p -m 644 mentalwealth-${subtheme}/mentalwealth-${subtheme}.py* \
%{buildroot}%{_datadir}/moin/data/plugin/theme/
install -d -m 755 %{buildroot}%{moin_static_content_dir}/mentalwealth-${subtheme}/css
install -p -m 644 mentalwealth-${subtheme}/css/*.css \
%{buildroot}%{moin_static_content_dir}/mentalwealth-${subtheme}/css/
ln -s ../mentalwealth/img \
%{buildroot}%{moin_static_content_dir}/mentalwealth-${subtheme}/img
done
# Symlink to conflict and renamed icons from modern theme
ln -s ../../modern/img/moin-{conflict,renamed}.png %{buildroot}%{moin_static_content_dir}/mentalwealth/img/
%pretrans -p
-- Remove old compat symlink, if present
path = "%{moin_static_content_dir}/mentalwealth"
st = posix.stat(path)
if st and st.type == "link" then
os.remove(path)
end
%pretrans -p orange
-- Remove old compat symlink, if present
path = "%{moin_static_content_dir}/mentalwealth-orange"
st = posix.stat(path)
if st and st.type == "link" then
os.remove(path)
end
%pretrans -p purple
-- Remove old compat symlink, if present
path = "%{moin_static_content_dir}/mentalwealth-purple"
st = posix.stat(path)
if st and st.type == "link" then
os.remove(path)
end
%pretrans -p red
-- Remove old compat symlink, if present
path = "%{moin_static_content_dir}/mentalwealth-red"
st = posix.stat(path)
if st and st.type == "link" then
os.remove(path)
end
%files
%doc README.rpm readme.*
%{_datadir}/moin/data/plugin/theme/mentalwealth.py*
%{moin_static_content_dir}/mentalwealth/
%files orange
%doc mentalwealth-orange/README.rpm
%{_datadir}/moin/data/plugin/theme/mentalwealth-orange.py*
%{moin_static_content_dir}/mentalwealth-orange/
%files purple
%doc mentalwealth-purple/README.rpm
%{_datadir}/moin/data/plugin/theme/mentalwealth-purple.py*
%{moin_static_content_dir}/mentalwealth-purple/
%files red
%doc mentalwealth-red/README.rpm
%{_datadir}/moin/data/plugin/theme/mentalwealth-red.py*
%{moin_static_content_dir}/mentalwealth-red/
%changelog
* Wed Mar 29 2023 Paul Howarth - 0.96-8
- Use SPDX-format license tag
- Avoid deprecated patch syntax
* Sat Nov 10 2018 Paul Howarth - 0.96-7
- Use python2 instead of generic python
- Manually add python(abi) dependency
* Sat Jan 6 2018 Paul Howarth - 0.96-6
- Drop support for EOL distributions prior to F-13
- Drop BuildRoot: and Group: tags
- Drop explicit buildroot cleaning in %%install section
- Drop explicit %%clean section
* Wed Feb 18 2015 Paul Howarth - 0.96-5
- Drop support for old distributions prior to FC-5
- No need to support python < 2.4 or moin < 1.9.0
- Drop %%defattr, redundant since rpm 4.4
- Move static content from %%{_datadir} to %%{python_sitelib} as wanted by
moin ≥ 1.9.0 and remove any old compat symlink with a %%pretrans script
* Thu Oct 13 2011 Paul Howarth - 0.96-4
- Nobody else likes macros for commands
- Fix dist tag for CentOS 6 and Scientific Linux
- BR: python2 rather than just python
* Wed Jul 28 2010 Paul Howarth - 0.96-3
- Rebuilt for python 2.7 in Rawhide
* Wed May 26 2010 Paul Howarth - 0.96-2
- Fix dist tag for RHEL-6 Beta
* Wed Jan 13 2010 Paul Howarth - 0.96-1
- Update to 0.96
- Drop 1.6.x compatibility patch, issues fixed upstream
* Thu Dec 31 2009 Paul Howarth - 0.95.2-10
- Add patch for moin-1.9.0 compatibility; require moin ≥ 1.9.0
(unless we have python < 2.4)
- Add compat symlinks to static content from
%%{python_sitelib}/MoinMoin/web/static/htdocs for moin ≥ 1.9.0
- BR: symlinks
- Dist tag for Rawhide no longer needs special-casing
* Thu Jul 9 2009 Paul Howarth - 0.95.2-9
- Define RPM macros in global scope
- Use %%{__install} -p to maintain timestamps
* Mon Nov 17 2008 Paul Howarth - 0.95.2-8
- Add patch from Chris Lawther to fix up CSS for within
* Tue Jun 24 2008 Paul Howarth - 0.95.2-7
- Add symlinks to conflict and renamed icons from modern theme, which are
missing from mentalwealth
* Mon Feb 4 2008 Paul Howarth - 0.95.2-6
- Patch to work with moin 1.6.x
- New upstream URL http://moinmo.in/ThemeMarket/MentalWealth
* Tue Nov 6 2007 Paul Howarth - 0.95.2-5
- Fix dist tag for Fedora 7 onwards
- Clarify license as GPL version 2 or later
* Mon Dec 11 2006 Paul Howarth - 0.95.2-4
- Rebuild for python 2.5 on Rawhide
* Tue Dec 5 2006 Paul Howarth - 0.95.2-3
- Fix python-abi dep for python 2.3
- Fix mock build where python is not in the initial buildroot
* Mon Sep 18 2006 Paul Howarth - 0.95.2-2
- Fix dist tag for development builds
- Don't ghost .pyo files
* Tue Jun 13 2006 Paul Howarth - 0.95.2-1
- Rename package/theme to "mentalwealth" (upstream change)
- Define %%{__id_u} in a more portable way
- Only add python(abi) dependency for python 2.3
- New %%description
- Subthemes are now orange, purple, and red rather than orange, lilac, and pink
* Wed Mar 29 2006 Paul Howarth - 0.91-3
- Fix broken "img" link in subpackages
* Mon Feb 27 2006 Paul Howarth - 0.91-2
- Make subpackages for the color variations (orange, lilac, pink) supplied
* Fri Feb 24 2006 Paul Howarth - 0.91-1
- Initial package build