Blob Blame History Raw
%bcond_without docs

Name:           mkdocs
Version:        1.2.3
Release:        1%{?dist}
Summary:        Python tool to create HTML documentation from markdown sources

# The entire source code is BSD except mkdocs/utils/ghp_import.py
# which is Tumbolia
License:        BSD and Tumbolia
URL:            http://www.mkdocs.org/
Source0:        https://github.com/%{name}/%{name}/archive/%{version}/%{name}-%{version}.tar.gz

BuildArch:      noarch

BuildRequires:  python3-devel

# For docs
%if %{with docs}
BuildRequires:  python3dist(mdx-gh-links)
BuildRequires:  python3dist(mkdocs-redirects)
%endif

BuildRequires:  fontawesome-fonts
BuildRequires:  fontawesome-fonts-web
BuildRequires:  lato-fonts
BuildRequires:  bootswatch-fonts
BuildRequires:  google-roboto-slab-fonts

Recommends:     mkdocs-bootstrap
Recommends:     mkdocs-bootswatch
# the last version of mkdocs-basic-theme before being retired
Obsoletes:      mkdocs-basic-theme <= 1.0.1

# runtime deps not auto generated
Requires:       python3dist(mdx-gh-links) >= 0.2

Requires:       fontawesome-fonts
Requires:       fontawesome-fonts-web
Requires:       lato-fonts
Requires:       bootswatch-fonts
Requires:       google-roboto-slab-fonts


%description
MkDocs is a fast and simple way to create a website from source files written 
in Markdown, and configured with a YAML configuration file, the documentation 
can be hosted anywhere, even in free hosting services like Read the Docs and 
GitHub Pages.


%if %{with docs}
%package docs
Summary:        Documentantion for %{name}
Requires:       %{name} == %{version}-%{release}

%description docs
Documentation for %{name}.
%endif


%prep
%autosetup -p1

rm -rf %{name}.egg.info

find . -name '*.py' \
    -exec sed -i '1{\@^#!/usr/bin/env python@d}' {} \;


%generate_buildrequires
%pyproject_buildrequires -t


%build
%pyproject_wheel

%if %{with docs}
LC_ALL=C.UTF-8 LANG=C.UTF-8 PYTHONPATH=$PWD %{__python3} -m mkdocs build
%endif


%install
%pyproject_install
%pyproject_save_files mkdocs

# replace bundled fonts to symlink to ones under %%{_datadir}/fonts

# fonts not available under %%{_datadir}/fonts
fonts_not_replaced="lato-bold.eot lato-bold.woff lato-bold.woff2
lato-regular.eot lato-regular.woff2 lato-italic.eot lato-italic.woff
lato-italic.woff2 lato-bolditalic.eot lato-bolditalic.woff2 roboto-slab.eot
roboto-slab-v7-regular.woff2 roboto-slab-v7-bold.woff roboto-slab-v7-regular.eot
roboto-slab-v7-bold.eot roboto-slab-v7-regular.woff roboto-slab-v7-bold.woff2"

for to_replace in $(find %{buildroot}/%{python3_sitelib}/%{name}/themes/*/fonts -type f); do
    font=$(basename $to_replace)
    if [ $font = roboto-slab-v7-regular.ttf ]; then
        font=RobotoSlab-Regular.ttf
    fi
    if [ $font = roboto-slab-v7-bold.ttf ]; then
        font=RobotoSlab-Bold.ttf
    fi
    target="$(find %{_datadir}/fonts -iname $font)"
    if [ -f "$target" ]; then
        realdir=$(dirname $to_replace |sed 's:%{buildroot}::')
        ln -vsf $(realpath --canonicalize-missing --relative-to=$realdir $target) \
          $to_replace
    else
        if echo $fonts_not_replaced|grep -q $font; then
            echo "Skip $to_replace"
        else
            echo target of $to_replace does not exist
            exit 1
        fi
    fi
done


%check
%tox


%files -f %{pyproject_files}
%doc README.md
%license LICENSE
%{_bindir}/*

%if %{with docs}
%files docs
%doc site/*
%endif


%changelog
* Thu Oct 14 2021 Sandro Mani <manisandro@gmail.com> - 1.2.3-1
- Update to 1.2.3

* Thu Sep 30 2021 Sandro Mani <manisandro@gmail.com> - 1.2.2-2
- Enable docs

* Tue Aug 24 2021 Sandro Mani <manisandro@gmail.com> - 1.2.2-1
- Update to 1.2.2

* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.2-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Mon Jun 07 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1.1.2-6
- Fix Python 3.10 build (fix rhbz#1913266): Backport upstream commits 72f506dc
  and 775d506, and apply a temporary patch to
  mkdocs/tests/utils/ghp_import_tests.py (which is removed upstream after the
  current release)

* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 1.1.2-5
- Rebuilt for Python 3.10

* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Fri Aug  7 2020 Robin Lee <cheeselee@fedoraproject.org> - 1.1.2-3
- Bundle jquery since jquery1 and jquery2 are retired
- Drop explicit nltk requirement

* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Fri Jun 12 2020 Qiyu Yan <yanqiyu01@gmail.com> - 1.1.2-1
- Update to 1.1.2 upstream release

* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 1.1-5
- Rebuilt for Python 3.9

* Tue Mar 24 2020 Robin Lee <cheeselee@fedoraproject.org> - 1.1-4
- Drop explicit lunr requirement
- License specified to BSD and Tumbolia

* Mon Mar 23 2020 Robin Lee <cheeselee@fedoraproject.org> - 1.1-3
- Add symlinks to the Roboto fonts.

* Sun Mar  8 2020 Robin Lee <cheeselee@fedoraproject.org> - 1.1-2
- Requires python3dist(lunr) python3dist(nltk)
- Obsoletes mkdocs-basic-theme

* Sun Mar  8 2020 Robin Lee <cheeselee@fedoraproject.org> - 1.1-1
- Update to 1.1
- Don't include the external manpage
- Build docs subpackage with current source, so no bootstrap is required
- Don't BR full paths
- Recommends instead of Requires external themes

* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.16.3-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.16.3-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.16.3-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Mon Jul 09 2018 Miro Hrončok <mhroncok@redhat.com> - 0.16.3-7
- Rebuilt for Python 3.7

* Mon Jul 09 2018 Miro Hrončok <mhroncok@redhat.com> - 0.16.3-6
- Bootstrap for Python 3.7
- Add patch for Python 3.7 compatibility

* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.16.3-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Fri Oct 13 2017 williamjmorenor@gmail.com - 0.16.3-4
- Force BuildRequeriments to specific files to avoid
  broken symlinks in the user system, this should catch
  missing files to specific themes

* Fri Oct 06 2017 williamjmorenor@gmail.com - 0.16.3-3
- Build docs with self to check for broken symlinks
  See: https://bugzilla.redhat.com/show_bug.cgi?id=1497654

* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.16.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Tue Jun 06 2017 William Moreno <williamjmorenor@gmail.com> - 0.16.3-1
- Update to 0.16.3 upstream release

* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.16.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Fri Jan 20 2017 William Moreno <williamjmorenor@gmail.com> - 0.16.1-2
- Bootstrapping 0.16.1 in F25

* Thu Jan 12 2017 William Moreno <williamjmorenor@gmail.com> - 0.16.1-1
- Update to v0.16.1

* Tue Dec 20 2016 Miro Hrončok <mhroncok@redhat.com> - 0.15.3-7
- Build the docs with self (was disabled for bootstrapping)

* Tue Dec 20 2016 Miro Hrončok <mhroncok@redhat.com> - 0.15.3-6
- Change so it will use the available version of jquery1

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 0.15.3-5
- Rebuild for Python 3.6

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.15.3-4
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Fri Jun 03 2016 William Moreno <williamjmorenor@gmail.com> - 0.15.3-3
- Unbundle jquery libs

* Fri Apr 08 2016 William Moreno <williamjmorenor@gmail.com> - 0.15.3-2
- Updates requires
- List avaiables themes as enhances

* Fri Apr 08 2016 William Moreno <williamjmorenor@gmail.com> - 0.15.3-1
- Update to v0.15.3

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.14.0-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Sun Nov 15 2015 William Moreno <williamjmorenor@gmail.com> - 0.14.0-8
- fedoraproject.org/wiki/FAD_Python_3_Porting_2015
- disable test 

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.14.0-7
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Fri Jul 31 2015 Fedora <williamjmorenor@gmail.com> 
- 0.14.0-6
- Update Python macros

* Mon Jul 27 2015 William Moreno Reyes <williamjmorenor at gmail.com> 
- 0.14.0-5
- Initial import of #1230963
- Fix BuildRequires