diff --git a/CHANGELOG.md b/CHANGELOG.md index d83bb5a..c8695ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 \ No newline at end of file diff --git a/pillow_mbm/__main__.py b/pillow_mbm/__main__.py index 5d656ca..0851897 100644 --- a/pillow_mbm/__main__.py +++ b/pillow_mbm/__main__.py @@ -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 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..94eacd0 --- /dev/null +++ b/pyproject.toml @@ -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] \ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..a46d3c0 --- /dev/null +++ b/setup.cfg @@ -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.* \ No newline at end of file