From 0d7d53c4aca4f2bd53cfa6a3d52193c1d9649e56 Mon Sep 17 00:00:00 2001 From: Gianluca Pernigotto Date: Tue, 22 Oct 2024 19:48:57 +0200 Subject: [PATCH] Switch to hatchling builder + fixes --- CHANGELOG | 11 ++++ MANIFEST.in | 7 --- README.md | 4 +- ffcuesplitter/{info.py => about.py} | 40 ++++++------ ffcuesplitter/cuesplitter.py | 2 +- ffcuesplitter/ffprobe.py | 3 +- ffcuesplitter/main.py | 21 +++---- ffcuesplitter/user_service.py | 16 ++--- pyproject.toml | 89 +++++++++++++++++++++++++++ setup.py | 94 ----------------------------- 10 files changed, 141 insertions(+), 146 deletions(-) delete mode 100644 MANIFEST.in rename ffcuesplitter/{info.py => about.py} (70%) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/CHANGELOG b/CHANGELOG index dbe8098..b044480 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,14 @@ ++--------------------------------+ +October 22 2024 Version 1.0.25 ++--------------------------------+ + +- Switched to hatchling as the default build backend which replaces setuptools. +- Fixed some lint warn/error (pylint + flake8). +- Changed info.py to about.py + code improvements. +- Removed setup.py file because it was obsolete. +- Removed MANIFEST.in file because it was obsolete. +- Minimum Python version fixed at v3.8 . + +--------------------------------+ January 07 2024 Version 1.0.23 +--------------------------------+ diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 5e38a51..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,7 +0,0 @@ -include README.md -include AUTHORS -include BUGS -include CHANGELOG -include LICENSE -include TODO -include tests/* diff --git a/README.md b/README.md index f1f0b22..2897f2e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # FFcuesplitter - FFmpeg-based audio splitter for CDDA images associated with .cue files . -[![Image](https://img.shields.io/static/v1?label=python&logo=python&message=3.7%20|%203.8%20|%203.9%20|%203.10%20|%203.11&color=blue)](https://www.python.org/downloads/) +[![Image](https://img.shields.io/static/v1?label=python&logo=python&message=3.8%20|%203.9%20|%203.10%20|%203.11%20|%203.12&color=blue)](https://www.python.org/downloads/) [![Python application](https://github.com/jeanslack/FFcuesplitter/actions/workflows/CI.yml/badge.svg)](https://github.com/jeanslack/FFcuesplitter/actions/workflows/CI.yml) FFcuesplitter is a multi-platform CUE sheet splitter entirely based on FFmpeg. @@ -28,7 +28,7 @@ or from the [command line](https://github.com/jeanslack/FFcuesplitter#using-comm ## Requires -- Python >=3.7 +- Python >=3.8 - [deflacue](https://pypi.org/project/deflacue/) - [chardet](https://pypi.org/project/chardet/) - [tqdm](https://pypi.org/project/tqdm/#description) diff --git a/ffcuesplitter/info.py b/ffcuesplitter/about.py similarity index 70% rename from ffcuesplitter/info.py rename to ffcuesplitter/about.py index eec8fb9..9bc25b1 100644 --- a/ffcuesplitter/info.py +++ b/ffcuesplitter/about.py @@ -4,7 +4,7 @@ Writer: jeanslack license: GPL3 Copyright: (C) 2024 Gianluca Pernigotto -Rev: Aug 12 2023 +Rev: Oct 22 2024 #################################################################### This file is part of FFcuesplitter. @@ -22,32 +22,30 @@ You should have received a copy of the GNU General Public License along with FFcuesplitter. If not, see . """ -__author__ = "Gianluca Pernigotto - Jeanslack" -__contact__ = '' -__maintainer__ = "Gianluca Pernigotto - Jeanslack" -__maintainer_contact__ = "jeanlucperni@gmail.com" -__copyleft__ = '2024' -__version__ = '1.0.23' -__release__ = 'January 09 2024' -__appname__ = "FFcuesplitter" -__packagename__ = "ffcuesplitter" -__license__ = "GPL3 (Gnu Public License)" -__projecturl__ = "https://github.com/jeanslack/FFcuesplitter" -__githuburl__ = "https://github.com/jeanslack/FFcuesplitter" -__description__ = ("FFmpeg based audio splitter for CDDA images associated " - "with .cue files.") -__descriptionfull__ = """FFcuesplitter is a multi-platform CUE sheet splitter +AUTHOR = "Gianluca Pernigotto - Jeanslack" +CONTACT = '' +MAINTAINER = "Gianluca Pernigotto - Jeanslack" +COPYLEFT = '2024' +VERSION = '1.0.25' +RELEASE = 'October 21 2024' +APPNAME = "FFcuesplitter" +PKGNAME = "ffcuesplitter" +LICENSE_NAME = "GPL3 (Gnu Public License)" +PROJECTURL = "https://github.com/jeanslack/FFcuesplitter" +GITHUBURL = "https://github.com/jeanslack/FFcuesplitter" +SHORT_DESCRIPT = ("FFmpeg based audio splitter for CDDA images associated " + "with .cue files.") +LONG_DESCRIPT = """FFcuesplitter is a multi-platform CUE sheet splitter entirely based on FFmpeg. Splits big audio tracks and automatically embeds tags using the information contained in the associated **"CUE"** sheet. It supports multiple CUE sheet encodings and many input formats (due to FFmpeg), including APE format, without need installing extra audio libs and packages. It has the ability to accept both files and directories as input while also working in recursive mode. Can be used both as a Python module or by command line.""" -__license__ = "GPL3 (Gnu Public License)" -__licensefull__ = f""" -Copyright - {__copyleft__} {__author__} -Author and Developer: {__author__} -Mail: {__contact__} +SHORT_LICENSE = f""" +Copyright - {COPYLEFT} {AUTHOR} +Author and Developer: {AUTHOR} +Mail: {CONTACT} FFcuesplitter is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/ffcuesplitter/cuesplitter.py b/ffcuesplitter/cuesplitter.py index 127c61e..55b60db 100644 --- a/ffcuesplitter/cuesplitter.py +++ b/ffcuesplitter/cuesplitter.py @@ -241,7 +241,7 @@ def deflacue_object_handler(self): raise FFCueSplitterError('No audio files found!') continue - filename = (f"{sanitize(track[1].title)}") # titles to sanitize + filename = f"{sanitize(track[1].title)}" # titles to sanitize data = {'FILE': str(track_file), **cd_info, **track[1].data} data['TITLE'] = filename diff --git a/ffcuesplitter/ffprobe.py b/ffcuesplitter/ffprobe.py index 7b70b81..d8e0f58 100644 --- a/ffcuesplitter/ffprobe.py +++ b/ffcuesplitter/ffprobe.py @@ -87,5 +87,4 @@ def ffprobe(filename, cmd='ffprobe', **kwargs): except (OSError, FileNotFoundError) as excepterr: raise FFProbeError(excepterr) from excepterr - else: - return json.loads(output) + return json.loads(output) diff --git a/ffcuesplitter/main.py b/ffcuesplitter/main.py index 946f14f..cfadfdc 100644 --- a/ffcuesplitter/main.py +++ b/ffcuesplitter/main.py @@ -27,11 +27,11 @@ along with FFcuesplitter. If not, see . """ import argparse -from ffcuesplitter.info import (__appname__, - __description__, - __version__, - __release__, - ) +from ffcuesplitter.about import (APPNAME, + SHORT_DESCRIPT, + VERSION, + RELEASE + ) from ffcuesplitter.str_utils import (msgdebug, msgend, msgcolor, @@ -51,15 +51,15 @@ def main(): Defines and evaluates positional arguments using the argparser module. """ - parser = argparse.ArgumentParser(prog=__appname__, - description=__description__, + parser = argparse.ArgumentParser(prog=APPNAME, + description=SHORT_DESCRIPT, # add_help=False, ) parser.add_argument('--version', help="Show the current version and exit.", action='version', - version=(f"ffcuesplitter v{__version__} " - f"- {__release__}"), + version=(f"ffcuesplitter v{VERSION} " + f"- {RELEASE}"), ) parser.add_argument('-i', '--input-fd', metavar='FILENAMES DIRNAMES', @@ -166,8 +166,7 @@ def main(): find = FileFinder(args.input_fd) # get all cue files if args.recursive is True: allfiles = find.find_files_recursively(suffix=('.cue', '.CUE')) - - elif args.recursive is False: + else: allfiles = find.find_files(suffix=('.cue', '.CUE')) filelist = set(allfiles['FOUND'] diff --git a/ffcuesplitter/user_service.py b/ffcuesplitter/user_service.py index d0be289..9250c90 100644 --- a/ffcuesplitter/user_service.py +++ b/ffcuesplitter/user_service.py @@ -249,10 +249,10 @@ def find_files_recursively(self, suffix: str = '') -> dict: if os.path.splitext(files)[1] in suffix: self.filtered.append(os.path.join(path, files)) - return dict(FOUND=self.filtered, - DISCARDED=self.rejected, - INEXISTENT=self.nonexistent - ) + return {"FOUND": self.filtered, + "DISCARDED": self.rejected, + "INEXISTENT": self.nonexistent + } # -------------------------------------------------------------# def find_files(self, suffix: str = '') -> dict: @@ -278,8 +278,8 @@ def find_files(self, suffix: str = '') -> dict: else: self.nonexistent.append(dirs) # all non-existing files/dirs - return dict(FOUND=self.filtered, - DISCARDED=self.rejected, - INEXISTENT=self.nonexistent - ) + return {"FOUND": self.filtered, + "DISCARDED": self.rejected, + "INEXISTENT": self.nonexistent + } # ------------------------------------------------------------------------ diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..8162bea --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,89 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "ffcuesplitter" +dynamic = ["version"] +readme = "README.md" +requires-python = ">=3.8" +authors = [ + {name = "Gianluca Pernigotto", email = "jeanlucperni@gmail.com"} +] +maintainers = [ + {name = "Gianluca Pernigotto", email = "jeanlucperni@gmail.com"} +] +description = "FFmpeg-based audio splitter for CDDA images associated with .cue files ." +license = {text = "GNU General Public License v3 (GPLv3)"} +keywords = [ + "ffcuesplitter", + "converter", + "audio splitter", + "ffmpeg"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Intended Audience :: End Users/Desktop", + "Intended Audience :: Developers", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Natural Language :: English", + "Operating System :: Microsoft :: Windows", + "Operating System :: MacOS :: MacOS X", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Multimedia :: Sound/Audio :: Conversion", + "Topic :: Utilities", +] +dependencies = [ + "chardet>=4.0.0", + "tqdm>=4.38.0", + "deflacue>=2.0.1" +] +build = [ + "build", + "hatchling", + "pip", + "six", + "wheel", + "setuptools", +] +[tool.hatch.version] +path = "ffcuesplitter/about.py" + +[tool.hatch.build.targets.sdist] +include = [ + "ffcuesplitter", + "tests", + "man", + "AUTHORS", + "BUGS", + "CHANGELOG", + "INSTALL", + "LICENSE", + "README.md", # already included as readme + "TODO", + "ffcuesplitter.py", + ".gitignore", # already included by default, needed for auto-excludes + ".flake8", + ".pylintrc", +] +exclude = [ +] +[tool.hatch.build.targets.wheel] +packages = ["ffcuesplitter"] + +[tool.hatch.build.targets.wheel.shared-data] +"man/ffcuesplitter.1.gz" = "share/man/man1/ffcuesplitter.1.gz" +[project.scripts] +ffcuesplitter = "ffcuesplitter.main:main" + +[project.urls] +Homepage = "https://github.com/jeanslack/FFcuesplitter" +Documentation = "https://github.com/jeanslack/FFcuesplitter#readme" +Wiki = "https://github.com/jeanslack/FFcuesplitter/wiki" +Tracker = "https://github.com/jeanslack/Videomass/issues" diff --git a/setup.py b/setup.py deleted file mode 100644 index b11e802..0000000 --- a/setup.py +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" -First release: Jan 20 2022 - -Name: setup.py -Porpose: building ffcuesplitter sources and package -USAGE: python3 setup.py sdist bdist_wheel -Platform: all -Writer: jeanslack -license: GPL3 -Copyright: (C) 2024 Gianluca Pernigotto -Rev: Jan 29 2023 -Code checker: flake8, pylint - -This file is part of FFcuesplitter. - - FFcuesplitter is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - FFcuesplitter is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with ffcuesplitter. If not, see . - -""" -from setuptools import setup, find_packages -from ffcuesplitter.info import (__version__, - __license__, - __githuburl__, - __author__, - __contact__, - __packagename__, - __description__, - # __descriptionfull__ - ) - -INST_REQ = ["chardet>=4.0.0", "tqdm>=4.38.0", "deflacue>=2.0.1"] -SETUP_REQ = ["setuptools>=47.1.1", - "wheel>=0.34.2", - "twine>=3.1.1" - ] - -CLASSIFIERS = ['Development Status :: 5 - Production/Stable', - 'Environment :: Console', - 'Intended Audience :: End Users/Desktop', - 'Intended Audience :: Developers', - ('License :: OSI Approved :: GNU General Public ' - 'License v3 (GPLv3)'), - 'Natural Language :: English', - 'Operating System :: Microsoft :: Windows', - 'Operating System :: MacOS :: MacOS X', - 'Operating System :: POSIX :: Linux', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'Topic :: Multimedia :: Sound/Audio :: Conversion', - 'Topic :: Utilities', - ] - -# get the package data -DATA_FILES = [('share/man/man1', ['man/ffcuesplitter.1.gz'])] - -with open('README.md', 'r', encoding='utf8') as readme: - long_descript = readme.read() - -setup(name=__packagename__, - version=__version__, - description=__description__, - long_description=long_descript, - long_description_content_type='text/markdown', - author=__author__, - author_email=__contact__, - url=__githuburl__, - license=__license__, - platforms=["All"], - packages=find_packages(), - data_files=DATA_FILES, - zip_safe=False, - python_requires=">=3.7", - install_requires=INST_REQ, - setup_requires=SETUP_REQ, - entry_points={ - "console_scripts": ['ffcuesplitter = ffcuesplitter.main:main']}, - classifiers=CLASSIFIERS, - )