disabled
      %ˆ¾‘äÇò 8àÛï�Á<W?ŸÔƒh¹ÓÄÑ      %disabled
  7   'ˆl–äY>”êhŠe@=q�ÜªbÑ¿�þZm¦–nW€Ù$m¶Û ?ŸÕ„®²/ÔÅÒ ?÷     '#!/usr/bin/perl

# Copyright Â© 2011 Jakub Wilk <jwilk@debian.org>
#           Â© 2014-2020 Dmitry Shachnev <mitya57@debian.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
#   notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
#   notice, this list of conditions and the following disclaimer in the
#   documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

=head1 NAME

dh_sphinxdoc - helps with packaging Sphinx-generated documentation

=head1 SYNOPSIS

dh_sphinxdoc [S<I<debhelper options>>] [B<-X>I<item>] [I<directory>...]

=head1 DESCRIPTION

B<dh_sphinxdoc> is a debhelper program that prepares Sphinx-generated
documentation for inclusion in a Debian package. More specifically:

=over 4

=item *

It checks if all the files referenced by F<searchindex.js> exist.

=item *

It replaces known F<*.js> files with symlinks to F</usr/share/javascript/sphinxdoc/>
and generates B<${sphinxdoc:Depends}> substitution variable.

=item *

If the Sphinx RTD theme is used, it replaces known files from this theme with
symlinks to F</usr/share/sphinx_rtd_theme/>, and adds B<sphinx-rtd-theme-common>
to B<${sphinxdoc:Depends}>.

=item *

It provides a B<${sphinxdoc:Built-Using}> substitution variable, for tracking
files which could not be symlinked. Examples of such files are F<*.js> and F<*.css>
files that are generated from corresponding F<*.js_t> and F<*.css_t> templates,
and can vary depending on the used theme options (for instance, F<basic.css> file
is generated from F<basic.css_t> and is included in almost every Sphinx-generated
documentation). Currently, this variable will contain B<sphinx> and, if the default
theme is used, B<alabaster>, with their versions (other themes are not supported).

=item *

It removes the F<.doctrees> directory.

=item *

It removes the F<.buildinfo> file.

=item *

It removes the F<websupport.js> file.

=back

Note that B<dh_sphinxdoc> does not build the documentation, it only performs
the above operations when the documentation is already installed into the
package build path. To build the docs, please use L<sphinx-build(1)> command
or B<python3 -m sphinx> syntax.

You can pass B<--with sphinxdoc> to L<dh(1)> to make it automatically call
B<dh_sphinxdoc> after B<dh_installdocs>.

=head1 OPTIONS

=over 4

=item I<directory>

By default, B<dh_sphinxdoc> scans your package looking for directories looking
like they contain Sphinx-generated documentation. However, if you explicitly
provide one or more directories, only they will be processed. If documentation
is not found at I<directory>, an error is raised.

=item B<-X>I<item>, B<--exclude=>I<item>

Exclude files that contain I<item> anywhere in their filename from
being symlinked, removed or checked for existence.

=back

=head1 BUGS

Symlinking translations.js is not supported.

=cut

use strict;
use warnings;

use Digest::MD5;
use File::Find;
use Debian::Debhelper::Dh_Lib;
use JSON;
