debian/0000755000000000000000000000000012302376565007177 5ustar debian/python-scour.manpages0000644000000000000000000000002211564201407013347 0ustar debian/dh_scour.1 debian/python-scour.install0000644000000000000000000000024011564201407013224 0ustar *.py usr/lib/python2.6/dist-packages/ debian/dh_scour usr/bin debian/cmpsvg /usr/share/python-scour/ debian/scour.pm usr/share/perl5/Debian/Debhelper/Sequence/ debian/copyright0000644000000000000000000000513211564201407011122 0ustar Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=135 Name: scour Maintainer: Jeff Schiller Louis Simard Source: http://codedread.com/scour/ Copyright: 2009, 2010 Jeff Schiller 2010 Louis Simard License: Apache Files: ./svg_regex.py Copyright: 2006, Enthought, Inc. License: BSD All rights reserved. . 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. * Neither the name of Enthought, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. . 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. Files: ./debian/* Copyright: 2010 Martin Pitt 2010 Alessio Treglia License: Apache License: Apache Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at . http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. X-Comment: On Debian systems, the complete text of the license can be found in `/usr/share/common-licenses/Apache-2.0'. debian/scour.pm0000644000000000000000000000023311564201407010655 0ustar #!/usr/bin/perl # debhelper sequence file for dh_scour use warnings; use strict; use Debian::Debhelper::Dh_Lib; insert_after("dh_link", "dh_scour"); 1; debian/changelog0000644000000000000000000000732712302376565011062 0ustar scour (0.26-3build1) trusty; urgency=medium * Rebuild to drop files installed into /usr/share/pyshared. -- Matthias Klose Sun, 23 Feb 2014 13:53:57 +0000 scour (0.26-3) unstable; urgency=low * Add patch from upstream's trunk to fix: - Incorrect handling of comments when the file starts with a comment. - Failure when parsing a polygon starting with a negative coordinate. -- Alessio Treglia Sat, 31 Dec 2011 10:31:02 +0100 scour (0.26-2) unstable; urgency=low * debian/dh_scour: Set permissions/owner of optimized files to those of original file. (LP: #889837) * debian/cmpsvg: Fix crash on empty SVGs. (LP: #740879) -- Martin Pitt Mon, 14 Nov 2011 10:09:24 +0100 scour (0.26-1) unstable; urgency=low [ Alessio Treglia ] * New upstream version. * debian/control: Bump Standards-Version to 3.9.2 (no changes necessary). [ Martin Pitt ] * debian/dh_scour: Support *.svgz icons as well. Thanks to Felix Geyer for the patch. (LP: #781810) -- Martin Pitt Fri, 20 May 2011 08:49:57 +0200 scour (0.25+bzr207-2.1) unstable; urgency=low * Non-maintainer upload (just a rebuild to add Python 2.7 and dropPython 2.5 support) -- Piotr Ożarowski Sat, 16 Apr 2011 13:00:21 +0200 scour (0.25+bzr207-2) unstable; urgency=low * debian/control: Drop python-rsvg and python-cairo from Depends to Suggests, it's a too heavy build dependency, causing dependency loops. Point out rationale for the Suggests in the package description. (LP: #734471) * debian/cmpsvg: If rsvg or cairo modules aren't available, exit successfully with an error message. -- Martin Pitt Sun, 20 Mar 2011 12:23:34 +0100 scour (0.25+bzr207-1) unstable; urgency=low * New upstream bzr snapshot: - Add the option --no-renderer-workaround. - Fix gradient corruption. (LP: #702423) - Add option to only remove autogenerated id's. (LP: #492277) - Fix Windows line ending handling. (LP: #717826) - Fix occasional production of empty defs. (LP: #717254) - Remove more attributes with default values. (LP: #714731) - Fix wrong handling of file:// references. (LP: #708515) - Delete text attributes from groups with only non-text elements. (LP: #714727) - Remove unnecessary text-align properties from non-text elements. (LP: #714720) - Fix wrong optimization of 0-length Bézier curves. (LP: #714717) - Fix decimal number processing in rule_elliptical_arc(). (LP: #638764) - Fix transform matrix order. (LP: #722544) * Drop 01-bzr195.patch, upstream now. * debian/cmpsvg: Fix computation of difference to add up the absolute difference of each pixel. * debian/cmpsvg: Show percentages with three digits after comma. * debian/cmpsvg: Lower default treshold to 0.05%. -- Martin Pitt Tue, 15 Mar 2011 09:28:45 +0100 scour (0.25+bzr194-3) unstable; urgency=low * Add debian/cmpsvg: Simple python script for fuzzy-comparing two SVGs. Add python-rsvg and python-cairo dependencies for this. * debian/python-scour.install: Install cmpsvg. * debian/dh_scour: Call cmpsvg after scour, and only accept the optimized file if cmpsvg succeeds. This avoids shipping broken SVGs due to scour bugs. (LP: #702423) -- Martin Pitt Fri, 11 Mar 2011 17:51:09 +0100 scour (0.25+bzr194-2) unstable; urgency=low * debian/dh_scour: Use --disable-style-to-xml option by default (LP: #690994). -- Alessio Treglia Thu, 10 Feb 2011 20:07:28 +0100 scour (0.25+bzr194-1) unstable; urgency=low * Initial release (Closes: #605358). -- Alessio Treglia Mon, 29 Nov 2010 10:32:04 +0100 debian/compat0000644000000000000000000000000211564201407010364 0ustar 7 debian/patches/0000755000000000000000000000000011677552305010630 5ustar debian/patches/series0000644000000000000000000000004611677551507012050 0ustar 1001-points_start_with_negative.patch debian/patches/1001-points_start_with_negative.patch0000644000000000000000000000270011677552305017675 0ustar Description: Fix incorrect handling of comments when the file starts with a comment, fix failure when parsing a polygon starting with a negative coordinate. Origin: http://bazaar.launchpad.net/~scouring/scour/trunk/revision/216 --- scour.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- scour.orig/scour.py +++ scour/scour.py @@ -2125,10 +2125,13 @@ def parseListOfPoints(s): # we got negative coords else: for j in xrange(len(negcoords)): - # first number could be positive if j == 0: + # first number could be positive if negcoords[0] != '': nums.append(negcoords[0]) + # but it could also be negative + elif len(nums) == 0: + nums.append('-' + negcoords[j]) # otherwise all other strings will be negative else: # unless we accidentally split a number that was in scientific notation @@ -2554,9 +2557,9 @@ def removeComments(element) : # must process the document object separately, because its # documentElement's nodes have None as their parentNode for subelement in element.childNodes: - if isinstance(element, xml.dom.minidom.Comment): - numCommentBytes += len(element.data) - element.documentElement.removeChild(subelement) + if isinstance(subelement, xml.dom.minidom.Comment): + numCommentBytes += len(subelement.data) + element.removeChild(subelement) else: removeComments(subelement) elif isinstance(element, xml.dom.minidom.Comment): debian/cmpsvg0000755000000000000000000000362611677551315010435 0ustar #!/usr/bin/python # Author: Martin Pitt # (C) 2011 Canonical Ltd. # License: Apache (see debian/copyright) '''Fuzzy-comparison of two SVGs. If their rendered bitmaps differ by more than a given threshold (default: 0.05%), or have different dimensions, exit with 1, otherwise exit with 0.''' import sys try: import rsvg except ImportError: print >> sys.stderr, 'cmpsvg: python-rsvg not installed, cannot compare SVG images' sys.exit(0) try: import cairo except ImportError: print >> sys.stderr, 'cmpsvg: python-cairo not installed, cannot compare SVG images' sys.exit(0) DEFAULT_TRESHOLD=0.0005 if len(sys.argv) not in [3, 4]: sys.stderr.write('Usage: %s [diff threshold (default %0.4f)]\n' % ( sys.argv[0], DEFAULT_TRESHOLD)) sys.exit(2) if len(sys.argv) == 4: threshold = float(sys.argv[3]) else: threshold = DEFAULT_TRESHOLD def svg_bitmap(svgfile): '''Convert an SVG file into a raw bitmap Return a tuple (width, height, data). ''' svg = rsvg.Handle(file=svgfile) s = cairo.ImageSurface(cairo.FORMAT_ARGB32, svg.props.width, svg.props.height) svg.render_cairo(cairo.Context(s)) return (svg.props.width, svg.props.height, [ord(x) for x in s.get_data()]) (w1, h1, d1) = svg_bitmap(sys.argv[1]) (w2, h2, d2) = svg_bitmap(sys.argv[2]) if w1 != w2 or h1 != h2: sys.stderr.write('Images differ in size: %s (%ix%i), %s (%ix%i)\n' % (sys.argv[1], w1, h1, sys.argv[2], w2, h2)) sys.exit(1) diff = 0 for i in range(len(d1)): diff += abs(d1[i] - d2[i]) sumd1 = sum(d1) if sumd1 > 0: diff /= float(sumd1) else: # for empty pictures, any difference at all is a total failure, so don't # scale it down pass print ('difference: %.3f%%' % (diff*100)) if diff > threshold: sys.stderr.write('Images differ by more than %.3f%%\n' % (threshold*100)) sys.exit(1) debian/control0000644000000000000000000000313511564201441010571 0ustar Source: scour Section: python Priority: optional Maintainer: Alessio Treglia Uploaders: Martin Pitt Build-Depends: debhelper (>= 7.0.50~), python-all Build-Depends-Indep: perl Standards-Version: 3.9.2 X-Python-Version: >= 2.6 Homepage: http://codedread.com/scour/ Vcs-Git: git://git.debian.org/collab-maint/scour.git Vcs-Browser: http://git.debian.org/?p=collab-maint/scour.git Package: python-scour Architecture: all Depends: ${misc:Depends}, ${python:Depends} Suggests: python-rsvg, python-cairo Description: SVG scrubber and optimizer Scour is a Python module that aggressively cleans SVG files, removing a lot of unnecessary information that certain tools or authors embed into their documents. The goal of scour is to provide an identically rendered image (i.e. a scoured document should have no discernable visible differences from the original file) while minimizing the file size. . WARNING: Scour is intended to be run on files that have been edited in Vector Graphics editors such as Inkscape or Adobe Illustrator. Scour attempts to optimize the file, and as result, it will change the file's structure and (possibly) its semantics. If you have hand-edited your SVG files, you will probably not be happy with the output of Scour. . Never use scour to overwrite your original file! . This package also provides a dh_scour debhelper extension which optimizes all shipped SVGs during package build. If python-rsvg and python-cairo are available, it will also do a before/after comparison and discard the optimized image if they differ by more than 0.05%. debian/python-scour.links0000644000000000000000000000005211564201407012677 0ustar usr/share/pyshared/scour.py usr/bin/scour debian/rules0000755000000000000000000000037411564201407010252 0ustar #!/usr/bin/make -f %: dh $@ --with python2 override_dh_auto_clean: rm -f debian/dh_scour.1 dh_auto_clean override_dh_auto_build: dh_auto_build pod2man debian/dh_scour debian/dh_scour.1 get-orig-source: uscan --force-download --repack --rename debian/source/0000755000000000000000000000000011564201407010466 5ustar debian/source/format0000644000000000000000000000001411564201407011674 0ustar 3.0 (quilt) debian/gbp.conf0000644000000000000000000000006011564201407010601 0ustar [DEFAULT] pristine-tar = True sign-tags = True debian/dh_scour0000755000000000000000000000324511677551315010741 0ustar #!/usr/bin/perl -w =head1 NAME dh_scour - run scour optimizer on shipped SVG files =cut use strict; use File::Find; use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS B [I] [S I>] =head1 DESCRIPTION dh_scour is a debhelper program that will run the scour SVG image scrubber on all shipped SVG files. =head1 OPTIONS =over 4 =item B<--> I Pass "params" to L. By default, no extra arguments are passed. =back =cut init(); sub iter { return unless /\.svgz?$/; return if -l $_ or -d $_; # Skip directories and symlinks my $name = $_; # See if we were asked to exclude this file. foreach my $f (@{$dh{EXCLUDE}}) { return if ($File::Find::name =~ m/\Q$f\E/); } my $optname = $name; $optname =~ s/(svgz?)$/opt.$1/; my @scour_cmd = ('scour', '-i', $name, '-o', $optname, '--disable-style-to-xml', @ARGV); my @check_cmd = ('/usr/share/python-scour/cmpsvg', $name, $optname); verbose_print(escape_shell(@scour_cmd)); verbose_print(escape_shell(@check_cmd)); if (system (@scour_cmd) == 0 && system (@check_cmd) == 0) { # fix permisssions my @st = stat $name; chmod $st[2], $optname or error("cannot restore permissions on optimized SVG file: $!"); chown $st[4], $st[5], $optname or error("cannot restore user/group on optimized SVG file: $!"); rename $optname, $name or error("cannot rename optimized SVG file: $!"); } else { warning "scour was not able to process $name"; unlink $optname; } } foreach my $package (@{$dh{DOPACKAGES}}) { find(\&iter, tmpdir($package)) } =head1 SEE ALSO L =head1 AUTHOR Martin Pitt =cut debian/watch0000644000000000000000000000007511564201407010221 0ustar version=3 http://codedread.com/scour/ \ scour-([\d\.]+)\.zip