mirror of
https://github.com/drewcassidy/Pillow-mbm.git
synced 2024-09-01 14:44:04 +00:00
Update to support Click version 8
This commit is contained in:
parent
8c6b3353d2
commit
04abe55969
@ -1,11 +1,16 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file
|
||||
|
||||
## Version 0.1.2 - 2021-04-13
|
||||
|
||||
## 0.1.2 - 2021-04-13
|
||||
### Added
|
||||
|
||||
- new `--verbose` command line option that prints the input and output path for each file
|
||||
|
||||
## 0.1.1 - 2021-04-12
|
||||
|
||||
## Version 0.1.1 - 2021-04-12
|
||||
|
||||
### Added
|
||||
|
||||
- First stable release
|
@ -47,7 +47,8 @@ def path_pairs(inputs, output, suffix, extension):
|
||||
if len(inputs) > 1:
|
||||
raise click.BadOptionUsage('output', 'Output is a single file, but multiple input files were provided.')
|
||||
if outpath.suffix not in decoded_extensions:
|
||||
raise click.BadOptionUsage('output', f'File has incorrect extension for decoded file. Valid extensions are:\n{decoded_extensions}')
|
||||
raise click.BadOptionUsage('output',
|
||||
f'File has incorrect extension for decoded file. Valid extensions are:\n{decoded_extensions}')
|
||||
|
||||
return [(inpath, outpath) for inpath in inpaths]
|
||||
else:
|
||||
@ -56,16 +57,19 @@ def path_pairs(inputs, output, suffix, extension):
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.option('-f/-F', '--flip/--no-flip', default=True, show_default=False, help="Vertically flip image after converting.")
|
||||
@click.option('-r', '--remove', is_flag=True, help="Remove input images after converting.")
|
||||
@click.option('-s', '--suffix', type=str, default='', help="Suffix to append to output file(s). Ignored if output is a single file.")
|
||||
@click.option('-x', '--extension',
|
||||
@click.option('-f/-F', '--flip/--no-flip', default=False, help="Vertically flip image after converting.")
|
||||
@click.option('-r/-k', '--remove/--keep', default=False, help="Remove input images after converting.")
|
||||
@click.option('-s', '--suffix', type=str, default='',
|
||||
help="Suffix to append to output file(s). Ignored if output is a single file.")
|
||||
@click.option('-x', '--extension', metavar='EXT',
|
||||
callback=validate_decoded_extension,
|
||||
type=str, default='.png', show_default=True,
|
||||
help="Extension to use for output. Ignored if output is a single file. Output filetype is deduced from this")
|
||||
help="Extension to use for output. "
|
||||
"Ignored if output is a single file. Output filetype is deduced from this")
|
||||
@click.option('-o', '--output',
|
||||
type=click.Path(writable=True), default=None,
|
||||
help="Output file or directory. If outputting to a file, input filenames must be only a single item. By default, files are decoded in place.")
|
||||
help="Output file or directory. If outputting to a file, input filenames must be only a single item. "
|
||||
"By default, files are decoded in place.")
|
||||
@click.option('-v', '--verbose', is_flag=True, help="print more information")
|
||||
@click.argument('filenames', nargs=-1, type=click.Path(exists=True, readable=True, dir_okay=False))
|
||||
@click.version_option(version=pillow_mbm.__version__)
|
||||
@ -74,7 +78,8 @@ def convert_mbm(flip, remove, suffix, extension, output, verbose, filenames):
|
||||
|
||||
pairs = path_pairs(filenames, output, suffix, extension)
|
||||
|
||||
with click.progressbar(pairs, show_eta=False, show_pos=True, item_show_func=lambda x: f'{x[0]}->{x[1]}' if x else '') as bar:
|
||||
with click.progressbar(pairs, show_eta=False, show_pos=True,
|
||||
item_show_func=lambda x: f'{x[0]}->{x[1]}' if x else '') as bar:
|
||||
if verbose:
|
||||
bar.is_hidden = True
|
||||
|
||||
|
9
pyproject.toml
Normal file
9
pyproject.toml
Normal file
@ -0,0 +1,9 @@
|
||||
[build-system]
|
||||
requires = [
|
||||
"setuptools >= 35.0.2",
|
||||
"setuptools_scm[toml] >= 3.4",
|
||||
"wheel"
|
||||
]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[tool.setuptools_scm]
|
43
setup.cfg
Normal file
43
setup.cfg
Normal file
@ -0,0 +1,43 @@
|
||||
[metadata]
|
||||
# until setuptools supports PEP621, this will have to do
|
||||
name = pillow-mbm
|
||||
description = Kerbal Space Program MBM file conversion plugin
|
||||
author = Andrew Cassidy
|
||||
license = AGPLv3
|
||||
license_file = LICENSE.md
|
||||
long_description = file: README.md
|
||||
long_description_content_type = text/markdown
|
||||
|
||||
keywords = pillow, PIL, MBM, Texture, KSP
|
||||
classifiers =
|
||||
Development Status :: 5 - Production/Stable
|
||||
Intended Audience :: Developers
|
||||
License :: OSI Approved :: GNU Affero General Public License v3
|
||||
Operating System :: OS Independent
|
||||
Programming Language :: Python :: 3 :: Only
|
||||
Programming Language :: Python :: 3
|
||||
Programming Language :: Python :: 3.7
|
||||
Programming Language :: Python :: 3.8
|
||||
Programming Language :: Python :: 3.9
|
||||
Topic :: Games/Entertainment :: Simulation
|
||||
Topic :: Multimedia :: Graphics
|
||||
Topic :: Multimedia :: Graphics :: Graphics Conversion
|
||||
|
||||
project_urls =
|
||||
Changelog = https://github.com/drewcassidy/Pillow-mbm/blob/main/CHANGELOG.md
|
||||
Source = https://github.com/drewcassidy/Pillow-mbm
|
||||
Forum Post = https://forum.kerbalspaceprogram.com/index.php?/topic/201606-quicktex-dds-texture-encoderdecoder/&do=findComment&comment=3953037
|
||||
|
||||
[options]
|
||||
install_requires =
|
||||
Click >= 7.0, < 9.0
|
||||
Pillow >= 8.0
|
||||
python_requires = >= 3.7
|
||||
packages = find:
|
||||
|
||||
[options.entry_points]
|
||||
console_scripts =
|
||||
convert-mbm = pillow_mbm.__main__:convert_mbm
|
||||
|
||||
[options.packages.find]
|
||||
exclude = tests.*
|
Loading…
Reference in New Issue
Block a user