[Python-modules-commits] r33494 - in packages/sphinx/trunk/debian (2 files)
mitya57 at users.alioth.debian.org
mitya57 at users.alioth.debian.org
Mon Jul 27 21:21:27 UTC 2015
Date: Monday, July 27, 2015 @ 21:21:26
Author: mitya57
Revision: 33494
dh_sphinxdoc: Add support for symlinking files specific to the RTD
theme (closes: #781849).
Modified:
packages/sphinx/trunk/debian/changelog
packages/sphinx/trunk/debian/dh-sphinxdoc/dh_sphinxdoc
Modified: packages/sphinx/trunk/debian/changelog
===================================================================
--- packages/sphinx/trunk/debian/changelog 2015-07-27 21:20:29 UTC (rev 33493)
+++ packages/sphinx/trunk/debian/changelog 2015-07-27 21:21:26 UTC (rev 33494)
@@ -7,6 +7,8 @@
the documentation builds reproducible (source_date_epoch.diff).
* dh_sphinxdoc: Symlink css3-mediaqueries.js, thanks to Jakub Wilk
for the patch (closes: #793045).
+ * dh_sphinxdoc: Add support for symlinking files specific to the RTD
+ theme (closes: #781849).
-- Dmitry Shachnev <mitya57 at debian.org> Sat, 18 Jul 2015 12:22:01 +0300
Modified: packages/sphinx/trunk/debian/dh-sphinxdoc/dh_sphinxdoc
===================================================================
--- packages/sphinx/trunk/debian/dh-sphinxdoc/dh_sphinxdoc 2015-07-27 21:20:29 UTC (rev 33493)
+++ packages/sphinx/trunk/debian/dh-sphinxdoc/dh_sphinxdoc 2015-07-27 21:21:26 UTC (rev 33494)
@@ -316,15 +316,55 @@
}
}
}
+
+sub process_rtd($)
+{
+ my ($path) = @_;
+ my $theme_is_rtd = 0;
+ if (-d "$path/_static/js" and -f "$path/_static/js/theme.js")
+ {
+ if (open(F, '<', "$path/_static/js/theme.js"))
+ {
+ while (my $line = <F>) {
+ if (index($line, "window.SphinxRtdTheme") != -1)
+ {
+ $theme_is_rtd = 1;
+ last;
+ }
+ }
+ close(F);
+ }
+ }
+
+ my @deps;
+ my $target_dir = "/usr/share/sphinx_rtd_theme/static";
+ if ($theme_is_rtd and -d $target_dir)
+ {
+ find({
+ wanted => sub {
+ return if -d;
+ my $filename = $_;
+ substr($filename, 0, 1 + length $target_dir) = "";
+ return unless -f "$path/_static/$filename";
+ ln_sf($_, "$path/_static/$filename");
+ },
+ no_chdir => 1
+ }, $target_dir);
+ push @deps, "sphinx-rtd-theme-common";
+ }
+ return @deps;
+}
sub fix_sphinx_doc($$)
{
my ($package, $path) = @_;
return 0 if not looks_like_sphinx_doc($path);
my @js = sanity_check($path);
+ my @rtd_deps = process_rtd($path);
my @deps = fix_symlinks($path, @js);
drop_cruft($path);
map { addsubstvar($package, "sphinxdoc:Depends", $_) } @deps;
+ map { addsubstvar($package, "sphinxdoc:Depends", $_) } @rtd_deps;
return 1;
}
More information about the Python-modules-commits
mailing list