Skip to content

Commit

Permalink
Re-add deprecated CLI options
Browse files Browse the repository at this point in the history
Related to #1232.
  • Loading branch information
liZe committed Apr 28, 2021
1 parent becd494 commit b476f2f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions weasyprint/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import logging
import platform
import sys
import warnings

import pydyf

Expand Down Expand Up @@ -147,6 +148,12 @@ def main(argv=None, stdout=None, stdin=None):
help='Show debugging messages.')
parser.add_argument('-q', '--quiet', action='store_true',
help='Hide logging messages.')
parser.add_argument('-o', '--optimize-images', action='store_true',
help='Deprecated, use "-O images" instead.')
parser.add_argument('-f', '--format', choices=('pdf',),
help='Deprecated.')
parser.add_argument('-r', '--resolution', type=float,
help='Deprecated.')
parser.add_argument(
'input', help='URL or filename of the HTML input, or - for stdin')
parser.add_argument(
Expand Down Expand Up @@ -177,6 +184,15 @@ def main(argv=None, stdout=None, stdin=None):
else:
optimize_size.add(arg)

if args.optimize_images:
optimize_size.add('images')

if any((args.optimize_images, args.format, args.resolution)):
warnings.warn(
'--optimize-images, --format and --resolution options are '
'deprecated and will be removed in future versions.',
FutureWarning)

kwargs = {
'stylesheets': args.stylesheet,
'presentational_hints': args.presentational_hints,
Expand Down

0 comments on commit b476f2f

Please sign in to comment.