Package: scour
Version: 0.38.2-2
Severity: wishlist
Tags: patch

Dear Maintainer,

At present, scour requires an input and an output filename. This is
occasionally a nuisance, especially in automated processing: it requires the
output file to be renamed over the input as a separate step.

Attached is a patch to add an --in-place / -I switch. I'm not sure the switch
names are the most appropriate, however.


-- System Information:
Debian Release: 12.12
  APT prefers oldstable-updates
  APT policy: (500, 'oldstable-updates'), (500, 'oldstable-security'), (500, 
'oldstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.1.0-41-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages scour depends on:
ii  python3        3.11.2-1+b1
ii  python3-scour  0.38.2-2

scour recommends no packages.

Versions of packages scour suggests:
ii  gir1.2-rsvg-2.0   2.54.7+dfsg-1~deb12u1
ii  python3-gi-cairo  3.42.2-3+b1

-- no debconf information
diff --git a/scour/scour.py b/scour/scour.py
index 7b5803f..9d19906 100644
--- a/scour/scour.py
+++ b/scour/scour.py
@@ -3933,10 +3933,6 @@ _options_parser.add_option("-i",
 _options_parser.add_option("-o",
                            action="store", dest="outfilename", 
metavar="OUTPUT.SVG",
                            help="alternative way to specify output filename")
-_options_parser.add_option("--in-place", "-I",
-                           action="store_true", dest="in_place", default=False,
-                           help="replace the input file")
-
 
 _option_group_optimization = optparse.OptionGroup(_options_parser, 
"Optimization")
 _option_group_optimization.add_option("--set-precision",
@@ -4068,11 +4064,6 @@ def parse_args(args=None, ignore_additional_args=False):
         _options_parser.error("Value for --nindent should be positive (or 
zero), see --help")
     if options.infilename and options.outfilename and options.infilename == 
options.outfilename:
         _options_parser.error("Input filename is the same as output filename")
-    if options.outfilename and options.in_place:
-        _options_parser.error("output filenames and --in-place are mutually 
exclusive")
-    if not options.infilename and options.in_place:
-        _options_parser.error("--in_place requires an input filename")
-
 
     return options
 
@@ -4116,10 +4107,6 @@ def getInOut(options):
         if sys.stdin.isatty():
             _options_parser.error("No input file specified, see --help for 
detailed usage information")
 
-    if options.in_place:
-        # at this point, infilename is not None, and outfilename is None
-        options.outfilename = f'{options.infilename}.{os.getpid()}.temp'
-
     if options.outfilename:
         outfile = maybe_gziped_file(options.outfilename, "wb")
     else:
@@ -4180,9 +4167,6 @@ def start(options, input, output):
     newsize = len(out_string)
     sizediff = (newsize / oldsize) * 100.
 
-    if options.in_place:
-        os.rename(options.outfilename, options.infilename)
-
     if not options.quiet:
         print('Scour processed file "{}" in {} ms: {}/{} bytes new/orig -> 
{:.1f}%'.format(
             input.name,

Reply via email to