From 09f32654af6a8ee0dcdfa336826af9600c6380b5 Mon Sep 17 00:00:00 2001 From: Ofek Lev Date: Tue, 5 Dec 2023 13:14:00 -0500 Subject: [PATCH] Upgrade Ruff (#1085) --- backend/src/hatchling/builders/constants.py | 42 ++++++------ backend/tests/downstream/integrate.py | 68 +++++++++---------- release/macos/build_pkg.py | 48 ++++++------- ruff_defaults.toml | 8 +++ scripts/release_github.py | 12 ++-- scripts/update_ruff.py | 2 +- src/hatch/env/internal/fmt.py | 36 ++++++---- src/hatch/python/resolve.py | 6 +- src/hatch/utils/platform.py | 10 ++- src/hatch/utils/shells.py | 38 ++++++----- tests/backend/builders/test_app.py | 24 ++++--- tests/cli/fmt/test_fmt.py | 26 ++++--- tests/cli/python/test_install.py | 12 ++-- ...standard_default_build_script_artifacts.py | 32 ++++----- ...default_build_script_extra_dependencies.py | 32 ++++----- .../sdist/standard_default_support_legacy.py | 22 +++--- ...tandard_default_vcs_git_exclusion_files.py | 24 +++---- ...d_default_vcs_mercurial_exclusion_files.py | 24 +++---- .../sdist/standard_include_config_file.py | 16 ++--- .../wheel/standard_default_build_script.py | 22 +++--- ...standard_default_build_script_artifacts.py | 24 +++---- ..._build_script_artifacts_with_src_layout.py | 26 ++++--- ...ult_build_script_configured_build_hooks.py | 24 +++---- ...default_build_script_extra_dependencies.py | 24 +++---- ...dard_default_build_script_force_include.py | 26 ++++--- ...ild_script_force_include_no_duplication.py | 24 +++---- .../wheel/standard_default_extra_metadata.py | 26 ++++--- .../standard_default_license_multiple.py | 22 +++--- .../wheel/standard_default_license_single.py | 22 +++--- .../standard_default_namespace_package.py | 22 +++--- .../standard_default_python_constraint.py | 22 +++--- .../wheel/standard_default_shared_data.py | 26 ++++--- .../wheel/standard_default_single_module.py | 24 +++---- .../wheel/standard_default_symlink.py | 24 +++---- .../wheel/standard_editable_exact.py | 32 ++++----- ...ndard_editable_exact_extra_dependencies.py | 32 ++++----- .../standard_editable_exact_force_include.py | 32 ++++----- .../templates/wheel/standard_editable_pth.py | 24 +++---- ...tandard_editable_pth_extra_dependencies.py | 24 +++---- .../standard_editable_pth_force_include.py | 24 +++---- .../templates/wheel/standard_entry_points.py | 30 ++++---- .../wheel/standard_no_strict_naming.py | 22 +++--- ...tandard_only_packages_artifact_override.py | 22 +++--- .../helpers/templates/wheel/standard_tests.py | 22 +++--- 44 files changed, 526 insertions(+), 578 deletions(-) diff --git a/backend/src/hatchling/builders/constants.py b/backend/src/hatchling/builders/constants.py index 4d170523a..a695b91c7 100644 --- a/backend/src/hatchling/builders/constants.py +++ b/backend/src/hatchling/builders/constants.py @@ -1,27 +1,25 @@ DEFAULT_BUILD_DIRECTORY = 'dist' -EXCLUDED_DIRECTORIES = frozenset( - ( - # Python bytecode - '__pycache__', - # Git - '.git', - # Mercurial - '.hg', - # Hatch - '.hatch', - # tox - '.tox', - # nox - '.nox', - # Ruff - '.ruff_cache', - # pytest - '.pytest_cache', - # Mypy - '.mypy_cache', - ) -) +EXCLUDED_DIRECTORIES = frozenset(( + # Python bytecode + '__pycache__', + # Git + '.git', + # Mercurial + '.hg', + # Hatch + '.hatch', + # tox + '.tox', + # nox + '.nox', + # Ruff + '.ruff_cache', + # pytest + '.pytest_cache', + # Mypy + '.mypy_cache', +)) class BuildEnvVars: diff --git a/backend/tests/downstream/integrate.py b/backend/tests/downstream/integrate.py index 7d8803e5f..c502913e3 100644 --- a/backend/tests/downstream/integrate.py +++ b/backend/tests/downstream/integrate.py @@ -133,20 +133,18 @@ def main(): print('<<<<< Building backend >>>>>') subprocess.check_call([sys.executable, '-m', 'build', '--wheel', '-o', links_dir, backend_path]) - subprocess.check_call( - [ - sys.executable, - '-m', - 'pip', - 'download', - '-q', - '--disable-pip-version-check', - '--no-python-version-warning', - '-d', - links_dir, - os.path.join(links_dir, os.listdir(links_dir)[0]), - ] - ) + subprocess.check_call([ + sys.executable, + '-m', + 'pip', + 'download', + '-q', + '--disable-pip-version-check', + '--no-python-version-warning', + '-d', + links_dir, + os.path.join(links_dir, os.listdir(links_dir)[0]), + ]) constraints = [] constraints_file = os.path.join(build_dir, 'constraints.txt') @@ -227,31 +225,27 @@ def main(): env_vars['PIP_CONSTRAINT'] = constraints_file with EnvVars(env_vars, ignore=('__PYVENV_LAUNCHER__', 'PYTHONHOME')): print('--> Installing project') - subprocess.check_call( - [ - shutil.which('pip'), - 'install', - '-q', - '--disable-pip-version-check', - '--no-python-version-warning', - '--find-links', - links_dir, - '--no-deps', - repo_dir, - ] - ) + subprocess.check_call([ + shutil.which('pip'), + 'install', + '-q', + '--disable-pip-version-check', + '--no-python-version-warning', + '--find-links', + links_dir, + '--no-deps', + repo_dir, + ]) print('--> Installing dependencies') - subprocess.check_call( - [ - shutil.which('pip'), - 'install', - '-q', - '--disable-pip-version-check', - '--no-python-version-warning', - repo_dir, - ] - ) + subprocess.check_call([ + shutil.which('pip'), + 'install', + '-q', + '--disable-pip-version-check', + '--no-python-version-warning', + repo_dir, + ]) print('--> Testing package') for statement in test_data['statements']: diff --git a/release/macos/build_pkg.py b/release/macos/build_pkg.py index 836ab40d6..81e83dbd2 100644 --- a/release/macos/build_pkg.py +++ b/release/macos/build_pkg.py @@ -81,38 +81,34 @@ def main(): components_dir = temp_dir / 'components' components_dir.mkdir() - run_command( - [ - 'pkgbuild', - '--root', - str(root_dir), - '--identifier', - IDENTIFIER, - '--version', - version, - '--install-location', - '/', - str(components_dir / COMPONENT_PACKAGE_NAME), - ] - ) + run_command([ + 'pkgbuild', + '--root', + str(root_dir), + '--identifier', + IDENTIFIER, + '--version', + version, + '--install-location', + '/', + str(components_dir / COMPONENT_PACKAGE_NAME), + ]) # This is where we build the final artifact build_dir = temp_dir / 'build' build_dir.mkdir() product_archive = build_dir / f'{binary_name}-{version}.pkg' - run_command( - [ - 'productbuild', - '--distribution', - str(ASSETS_DIR / 'distribution.xml'), - '--resources', - str(resources_dir), - '--package-path', - str(components_dir), - str(product_archive), - ] - ) + run_command([ + 'productbuild', + '--distribution', + str(ASSETS_DIR / 'distribution.xml'), + '--resources', + str(resources_dir), + '--package-path', + str(components_dir), + str(product_archive), + ]) # Copy the final artifact to the target directory directory.mkdir(parents=True, exist_ok=True) diff --git a/ruff_defaults.toml b/ruff_defaults.toml index 65eca34dd..63289c922 100644 --- a/ruff_defaults.toml +++ b/ruff_defaults.toml @@ -189,6 +189,7 @@ select = [ "FURB145", "FURB148", "FURB152", + "FURB163", "FURB168", "FURB169", "FURB171", @@ -269,6 +270,7 @@ select = [ "PLE0604", "PLE0605", "PLE0704", + "PLE1132", "PLE1142", "PLE1205", "PLE1206", @@ -285,6 +287,8 @@ select = [ "PLE2515", "PLR0124", "PLR0133", + "PLR0202", + "PLR0203", "PLR0206", "PLR0402", "PLR1701", @@ -293,6 +297,8 @@ select = [ "PLR1711", "PLR1714", "PLR1722", + "PLR1733", + "PLR1736", "PLR2004", "PLR5501", "PLR6201", @@ -427,6 +433,7 @@ select = [ "S112", "S113", "S201", + "S202", "S301", "S302", "S303", @@ -463,6 +470,7 @@ select = [ "S607", "S608", "S609", + "S611", "S612", "S701", "S702", diff --git a/scripts/release_github.py b/scripts/release_github.py index 28abf3b6d..081ea438e 100644 --- a/scripts/release_github.py +++ b/scripts/release_github.py @@ -12,13 +12,11 @@ def main(): version, notes = get_latest_release(args.project) - params = urlencode( - { - 'title': f'{args.project.capitalize()} v{version}', - 'tag': f'{args.project}-v{version}', - 'body': notes, - } - ) + params = urlencode({ + 'title': f'{args.project.capitalize()} v{version}', + 'tag': f'{args.project}-v{version}', + 'body': notes, + }) url = f'https://github.com/pypa/hatch/releases/new?{params}' webbrowser.open_new_tab(url) diff --git a/scripts/update_ruff.py b/scripts/update_ruff.py index 8e64d8bf9..6b658cc9b 100644 --- a/scripts/update_ruff.py +++ b/scripts/update_ruff.py @@ -16,7 +16,7 @@ # Allow boolean positional values in function calls, like `dict.get(... True)` 'FBT003', # Ignore complexity - 'C901', 'PLR0904', 'PLR0911', 'PLR0912', 'PLR0913', 'PLR0915', 'PLR0916', + 'C901', 'PLR0904', 'PLR0911', 'PLR0912', 'PLR0913', 'PLR0915', 'PLR0916', 'PLR0917', # These are dependent on projects themselves 'AIR\\d+', 'CPY\\d+', 'D\\d+', 'DJ\\d+', 'NPY\\d+', 'PD\\d+', # Many projects either don't have type annotations or it would take much effort to satisfy this diff --git a/src/hatch/env/internal/fmt.py b/src/hatch/env/internal/fmt.py index 4c3a403aa..ea1411dca 100644 --- a/src/hatch/env/internal/fmt.py +++ b/src/hatch/env/internal/fmt.py @@ -100,20 +100,18 @@ def construct_config_file(self, *, preview: bool | None) -> str: lines.append(']') # Default config - lines.extend( - ( - '', - '[lint.flake8-tidy-imports]', - 'ban-relative-imports = "all"', - '', - '[lint.isort]', - f'known-first-party = ["{self.metadata.name.replace("-", "_")}"]', - '', - '[lint.flake8-pytest-style]', - 'fixture-parentheses = false', - 'mark-parentheses = false', - ) - ) + lines.extend(( + '', + '[lint.flake8-tidy-imports]', + 'ban-relative-imports = "all"', + '', + '[lint.isort]', + f'known-first-party = ["{self.metadata.name.replace("-", "_")}"]', + '', + '[lint.flake8-pytest-style]', + 'fixture-parentheses = false', + 'mark-parentheses = false', + )) # Ensure the file ends with a newline to satisfy other linters lines.append('') @@ -188,7 +186,7 @@ def get_config(self, section: str) -> dict[str, Any]: return self.user_config.get(section, {}) -RUFF_MINIMUM_VERSION: str = '0.1.6' +RUFF_MINIMUM_VERSION: str = '0.1.7' STABLE_RULES: tuple[str, ...] = ( 'A001', 'A002', @@ -732,6 +730,7 @@ def get_config(self, section: str) -> dict[str, Any]: 'FURB145', 'FURB148', 'FURB152', + 'FURB163', 'FURB168', 'FURB169', 'FURB171', @@ -746,8 +745,13 @@ def get_config(self, section: str) -> dict[str, Any]: 'PLC2401', 'PLC2403', 'PLE0704', + 'PLE1132', + 'PLR0202', + 'PLR0203', 'PLR1704', 'PLR1706', + 'PLR1733', + 'PLR1736', 'PLR6201', 'PLR6301', 'PLW0108', @@ -761,8 +765,10 @@ def get_config(self, section: str) -> dict[str, Any]: 'RUF018', 'RUF019', 'S201', + 'S202', 'S505', 'S507', + 'S611', 'S702', 'TRIO100', 'TRIO105', diff --git a/src/hatch/python/resolve.py b/src/hatch/python/resolve.py index dc8f1d530..44772ee40 100644 --- a/src/hatch/python/resolve.py +++ b/src/hatch/python/resolve.py @@ -43,12 +43,12 @@ def unpack(self, archive: Path, directory: Path) -> None: import tarfile with tarfile.open(archive, 'r:gz') as tf: - tf.extractall(directory) + tf.extractall(directory) # noqa: S202 elif self.source.endswith('.tar.bz2'): import tarfile with tarfile.open(archive, 'r:bz2') as tf: - tf.extractall(directory) + tf.extractall(directory) # noqa: S202 elif self.source.endswith('.tar.zst'): import tarfile @@ -57,7 +57,7 @@ def unpack(self, archive: Path, directory: Path) -> None: with open(archive, 'rb') as ifh: dctx = zstandard.ZstdDecompressor() with dctx.stream_reader(ifh) as reader, tarfile.open(mode='r|', fileobj=reader) as tf: - tf.extractall(directory) + tf.extractall(directory) # noqa: S202 else: message = f'Unknown archive type: {archive}' raise ValueError(message) diff --git a/src/hatch/utils/platform.py b/src/hatch/utils/platform.py index 3f294f072..a4e2f522e 100644 --- a/src/hatch/utils/platform.py +++ b/src/hatch/utils/platform.py @@ -155,9 +155,13 @@ def populate_default_popen_kwargs(self, kwargs: dict[str, Any], *, shell: bool) unprotected_paths = [] for path in default_paths: normalized_path = os.path.normpath(path) - if not normalized_path.startswith( - ('/System', '/usr', '/bin', '/sbin', '/var') - ) or normalized_path.startswith('/usr/local'): + if not normalized_path.startswith(( + '/System', + '/usr', + '/bin', + '/sbin', + '/var', + )) or normalized_path.startswith('/usr/local'): unprotected_paths.append(path) search_path = os.pathsep.join(unprotected_paths) diff --git a/src/hatch/utils/shells.py b/src/hatch/utils/shells.py index cd88a27bf..ae37dcde4 100644 --- a/src/hatch/utils/shells.py +++ b/src/hatch/utils/shells.py @@ -19,17 +19,15 @@ def enter_cmd(self, path: str, args: Iterable[str], exe_dir: Path) -> None: # n self.environment.platform.exit_with_command([path or 'cmd', '/k', str(exe_dir / 'activate.bat')]) def enter_powershell(self, path: str, args: Iterable[str], exe_dir: Path) -> None: # noqa: ARG002 - self.environment.platform.exit_with_command( - [ - path or 'powershell', - '-executionpolicy', - 'bypass', - '-NoExit', - '-NoLogo', - '-File', - str(exe_dir / 'activate.ps1'), - ] - ) + self.environment.platform.exit_with_command([ + path or 'powershell', + '-executionpolicy', + 'bypass', + '-NoExit', + '-NoLogo', + '-File', + str(exe_dir / 'activate.ps1'), + ]) def enter_pwsh(self, path: str, args: Iterable[str], exe_dir: Path) -> None: self.enter_powershell(path or 'pwsh', args, exe_dir) @@ -37,9 +35,12 @@ def enter_pwsh(self, path: str, args: Iterable[str], exe_dir: Path) -> None: def enter_xonsh(self, path: str, args: Iterable[str], exe_dir: Path) -> None: if self.environment.platform.windows: with self.environment: - self.environment.platform.exit_with_command( - [path or 'xonsh', *(args or ['-i']), '-D', f'VIRTUAL_ENV={exe_dir.parent.name}'] - ) + self.environment.platform.exit_with_command([ + path or 'xonsh', + *(args or ['-i']), + '-D', + f'VIRTUAL_ENV={exe_dir.parent.name}', + ]) else: self.spawn_linux_shell( path or 'xonsh', @@ -50,9 +51,12 @@ def enter_xonsh(self, path: str, args: Iterable[str], exe_dir: Path) -> None: def enter_bash(self, path: str, args: Iterable[str], exe_dir: Path) -> None: if self.environment.platform.windows: - self.environment.platform.exit_with_command( - [path or 'bash', '--init-file', exe_dir / 'activate', *(args or ['-i'])] - ) + self.environment.platform.exit_with_command([ + path or 'bash', + '--init-file', + exe_dir / 'activate', + *(args or ['-i']), + ]) else: self.spawn_linux_shell(path or 'bash', args or ['-i'], script=exe_dir / 'activate') diff --git a/tests/backend/builders/test_app.py b/tests/backend/builders/test_app.py index 4d53b8e92..4969dfce9 100644 --- a/tests/backend/builders/test_app.py +++ b/tests/backend/builders/test_app.py @@ -352,9 +352,11 @@ def test_scripts(self, hatch, temp_dir, mocker): subprocess_run.assert_called_once_with( ['cargo', 'install', 'pyapp', '--force', '--root', mocker.ANY], cwd=mocker.ANY, - env=ExpectedEnvVars( - {'PYAPP_PROJECT_NAME': 'my-app', 'PYAPP_PROJECT_VERSION': '0.1.0', 'PYAPP_EXEC_SPEC': 'bar.baz:cli'} - ), + env=ExpectedEnvVars({ + 'PYAPP_PROJECT_NAME': 'my-app', + 'PYAPP_PROJECT_VERSION': '0.1.0', + 'PYAPP_EXEC_SPEC': 'bar.baz:cli', + }), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, ) @@ -396,9 +398,11 @@ def test_scripts_build_target(self, hatch, temp_dir, mocker): subprocess_run.assert_called_once_with( ['cargo', 'install', 'pyapp', '--force', '--root', mocker.ANY], cwd=mocker.ANY, - env=ExpectedEnvVars( - {'PYAPP_PROJECT_NAME': 'my-app', 'PYAPP_PROJECT_VERSION': '0.1.0', 'PYAPP_EXEC_SPEC': 'bar.baz:cli'} - ), + env=ExpectedEnvVars({ + 'PYAPP_PROJECT_NAME': 'my-app', + 'PYAPP_PROJECT_VERSION': '0.1.0', + 'PYAPP_EXEC_SPEC': 'bar.baz:cli', + }), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, ) @@ -508,9 +512,11 @@ def test_python_version(self, hatch, temp_dir, mocker): subprocess_run.assert_called_once_with( ['cargo', 'install', 'pyapp', '--force', '--root', mocker.ANY], cwd=mocker.ANY, - env=ExpectedEnvVars( - {'PYAPP_PROJECT_NAME': 'my-app', 'PYAPP_PROJECT_VERSION': '0.1.0', 'PYAPP_PYTHON_VERSION': '4.0'} - ), + env=ExpectedEnvVars({ + 'PYAPP_PROJECT_NAME': 'my-app', + 'PYAPP_PROJECT_VERSION': '0.1.0', + 'PYAPP_PYTHON_VERSION': '4.0', + }), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, ) diff --git a/tests/cli/fmt/test_fmt.py b/tests/cli/fmt/test_fmt.py index a1c4c90d4..acd7e28b6 100644 --- a/tests/cli/fmt/test_fmt.py +++ b/tests/cli/fmt/test_fmt.py @@ -25,20 +25,18 @@ def construct_ruff_defaults_file(rules: tuple[str, ...]) -> str: lines.append(']') # Default config - lines.extend( - ( - '', - '[lint.flake8-tidy-imports]', - 'ban-relative-imports = "all"', - '', - '[lint.isort]', - 'known-first-party = ["my_app"]', - '', - '[lint.flake8-pytest-style]', - 'fixture-parentheses = false', - 'mark-parentheses = false', - ) - ) + lines.extend(( + '', + '[lint.flake8-tidy-imports]', + 'ban-relative-imports = "all"', + '', + '[lint.isort]', + 'known-first-party = ["my_app"]', + '', + '[lint.flake8-pytest-style]', + 'fixture-parentheses = false', + 'mark-parentheses = false', + )) # Ensure the file ends with a newline to satisfy other linters lines.append('') diff --git a/tests/cli/python/test_install.py b/tests/cli/python/test_install.py index 98a0d15f0..388289387 100644 --- a/tests/cli/python/test_install.py +++ b/tests/cli/python/test_install.py @@ -274,13 +274,11 @@ def test_all(hatch, temp_dir_data, path_append, default_shells, mocker, compatib for dist in mocked_dists: expected_lines.extend((f'Installing {dist.path.name}', f'Installed {dist.path.name} @ {dist.path}')) - expected_lines.extend( - ( - '', - 'The following directories have been added to your PATH (pending a shell restart):', - '', - ) - ) + expected_lines.extend(( + '', + 'The following directories have been added to your PATH (pending a shell restart):', + '', + )) expected_lines.extend(str(dist.python_path.parent) for dist in mocked_dists) expected_lines.append('') diff --git a/tests/helpers/templates/sdist/standard_default_build_script_artifacts.py b/tests/helpers/templates/sdist/standard_default_build_script_artifacts.py index 6ab50ad04..29d2a4b25 100644 --- a/tests/helpers/templates/sdist/standard_default_build_script_artifacts.py +++ b/tests/helpers/templates/sdist/standard_default_build_script_artifacts.py @@ -10,20 +10,19 @@ def get_files(**kwargs): relative_root = kwargs.get('relative_root', '') files = [File(Path(relative_root, f.path), f.contents) for f in get_template_files(**kwargs)] - files.extend( - ( - File(Path(relative_root, kwargs['package_name'], 'lib.so'), ''), - File( - Path(relative_root, '.gitignore'), - """\ + files.extend(( + File(Path(relative_root, kwargs['package_name'], 'lib.so'), ''), + File( + Path(relative_root, '.gitignore'), + """\ *.pyc *.so *.h """, - ), - File( - Path(relative_root, DEFAULT_BUILD_SCRIPT), - """\ + ), + File( + Path(relative_root, DEFAULT_BUILD_SCRIPT), + """\ import pathlib from hatchling.builders.hooks.plugin.interface import BuildHookInterface @@ -33,17 +32,16 @@ def initialize(self, version, build_data): pathlib.Path('my_app', 'lib.so').touch() pathlib.Path('my_app', 'lib.h').touch() """, - ), - File( - Path(relative_root, 'PKG-INFO'), - f"""\ + ), + File( + Path(relative_root, 'PKG-INFO'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt """, - ), - ) - ) + ), + )) return files diff --git a/tests/helpers/templates/sdist/standard_default_build_script_extra_dependencies.py b/tests/helpers/templates/sdist/standard_default_build_script_extra_dependencies.py index 265ab604b..eb6c0b14b 100644 --- a/tests/helpers/templates/sdist/standard_default_build_script_extra_dependencies.py +++ b/tests/helpers/templates/sdist/standard_default_build_script_extra_dependencies.py @@ -10,20 +10,19 @@ def get_files(**kwargs): relative_root = kwargs.get('relative_root', '') files = [File(Path(relative_root, f.path), f.contents) for f in get_template_files(**kwargs)] - files.extend( - ( - File(Path(relative_root, kwargs['package_name'], 'lib.so'), ''), - File( - Path(relative_root, '.gitignore'), - """\ + files.extend(( + File(Path(relative_root, kwargs['package_name'], 'lib.so'), ''), + File( + Path(relative_root, '.gitignore'), + """\ *.pyc *.so *.h """, - ), - File( - Path(relative_root, DEFAULT_BUILD_SCRIPT), - """\ + ), + File( + Path(relative_root, DEFAULT_BUILD_SCRIPT), + """\ import pathlib from hatchling.builders.hooks.plugin.interface import BuildHookInterface @@ -34,18 +33,17 @@ def initialize(self, version, build_data): pathlib.Path('my_app', 'lib.h').touch() build_data['dependencies'].append('binary') """, - ), - File( - Path(relative_root, 'PKG-INFO'), - f"""\ + ), + File( + Path(relative_root, 'PKG-INFO'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt Requires-Dist: binary """, - ), - ) - ) + ), + )) return files diff --git a/tests/helpers/templates/sdist/standard_default_support_legacy.py b/tests/helpers/templates/sdist/standard_default_support_legacy.py index 1f5c8d92d..132571196 100644 --- a/tests/helpers/templates/sdist/standard_default_support_legacy.py +++ b/tests/helpers/templates/sdist/standard_default_support_legacy.py @@ -9,20 +9,19 @@ def get_files(**kwargs): relative_root = kwargs.get('relative_root', '') files = [File(Path(relative_root, f.path), f.contents) for f in get_template_files(**kwargs)] - files.extend( - ( - File( - Path(relative_root, 'PKG-INFO'), - f"""\ + files.extend(( + File( + Path(relative_root, 'PKG-INFO'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt """, - ), - File( - Path(relative_root, 'setup.py'), - f"""\ + ), + File( + Path(relative_root, 'setup.py'), + f"""\ # -*- coding: utf-8 -*- from setuptools import setup @@ -35,8 +34,7 @@ def get_files(**kwargs): ], ) """, - ), - ) - ) + ), + )) return files diff --git a/tests/helpers/templates/sdist/standard_default_vcs_git_exclusion_files.py b/tests/helpers/templates/sdist/standard_default_vcs_git_exclusion_files.py index fd68cf971..09a8cebb1 100644 --- a/tests/helpers/templates/sdist/standard_default_vcs_git_exclusion_files.py +++ b/tests/helpers/templates/sdist/standard_default_vcs_git_exclusion_files.py @@ -9,27 +9,25 @@ def get_files(**kwargs): relative_root = kwargs.get('relative_root', '') files = [File(Path(relative_root, f.path), f.contents) for f in get_template_files(**kwargs)] - files.extend( - ( - File(Path(relative_root, kwargs['package_name'], 'lib.so'), ''), - File( - Path(relative_root, '.gitignore'), - """\ + files.extend(( + File(Path(relative_root, kwargs['package_name'], 'lib.so'), ''), + File( + Path(relative_root, '.gitignore'), + """\ *.pyc *.so *.h """, - ), - File( - Path(relative_root, 'PKG-INFO'), - f"""\ + ), + File( + Path(relative_root, 'PKG-INFO'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt """, - ), - ) - ) + ), + )) return files diff --git a/tests/helpers/templates/sdist/standard_default_vcs_mercurial_exclusion_files.py b/tests/helpers/templates/sdist/standard_default_vcs_mercurial_exclusion_files.py index 6cfb11afb..f8cc3d596 100644 --- a/tests/helpers/templates/sdist/standard_default_vcs_mercurial_exclusion_files.py +++ b/tests/helpers/templates/sdist/standard_default_vcs_mercurial_exclusion_files.py @@ -9,12 +9,11 @@ def get_files(**kwargs): relative_root = kwargs.get('relative_root', '') files = [File(Path(relative_root, f.path), f.contents) for f in get_template_files(**kwargs)] - files.extend( - ( - File(Path(relative_root, kwargs['package_name'], 'lib.so'), ''), - File( - Path(relative_root, '.hgignore'), - """\ + files.extend(( + File(Path(relative_root, kwargs['package_name'], 'lib.so'), ''), + File( + Path(relative_root, '.hgignore'), + """\ syntax: glob *.pyc @@ -25,17 +24,16 @@ def get_files(**kwargs): *.so *.h """, - ), - File( - Path(relative_root, 'PKG-INFO'), - f"""\ + ), + File( + Path(relative_root, 'PKG-INFO'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt """, - ), - ) - ) + ), + )) return files diff --git a/tests/helpers/templates/sdist/standard_include_config_file.py b/tests/helpers/templates/sdist/standard_include_config_file.py index 03940d5dc..8c59a5181 100644 --- a/tests/helpers/templates/sdist/standard_include_config_file.py +++ b/tests/helpers/templates/sdist/standard_include_config_file.py @@ -14,12 +14,11 @@ def get_files(**kwargs): if part in {'my_app', 'pyproject.toml', 'README.md', 'LICENSE.txt'}: files.append(File(Path(relative_root, f.path), f.contents)) - files.extend( - ( - File(Path(relative_root, 'hatch.toml'), ''), - File( - Path(relative_root, 'PKG-INFO'), - f"""\ + files.extend(( + File(Path(relative_root, 'hatch.toml'), ''), + File( + Path(relative_root, 'PKG-INFO'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 @@ -48,8 +47,7 @@ def get_files(**kwargs): `my-app` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license. """, - ), - ) - ) + ), + )) return files diff --git a/tests/helpers/templates/wheel/standard_default_build_script.py b/tests/helpers/templates/wheel/standard_default_build_script.py index a027bb06a..69d3ceca0 100644 --- a/tests/helpers/templates/wheel/standard_default_build_script.py +++ b/tests/helpers/templates/wheel/standard_default_build_script.py @@ -20,29 +20,27 @@ def get_files(**kwargs): files.append(f) - files.extend( - ( - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + files.extend(( + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: true Tag: {kwargs.get('tag', '')} """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt Requires-Python: >3 """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files) diff --git a/tests/helpers/templates/wheel/standard_default_build_script_artifacts.py b/tests/helpers/templates/wheel/standard_default_build_script_artifacts.py index e1acf0efb..19d0e58fb 100644 --- a/tests/helpers/templates/wheel/standard_default_build_script_artifacts.py +++ b/tests/helpers/templates/wheel/standard_default_build_script_artifacts.py @@ -20,30 +20,28 @@ def get_files(**kwargs): files.append(f) - files.extend( - ( - File(Path(kwargs['package_name'], 'lib.so'), ''), - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + files.extend(( + File(Path(kwargs['package_name'], 'lib.so'), ''), + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: false Tag: {kwargs.get('tag', '')} """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt Requires-Python: >3 """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files) diff --git a/tests/helpers/templates/wheel/standard_default_build_script_artifacts_with_src_layout.py b/tests/helpers/templates/wheel/standard_default_build_script_artifacts_with_src_layout.py index 1c048ee0a..ac1cc84d8 100644 --- a/tests/helpers/templates/wheel/standard_default_build_script_artifacts_with_src_layout.py +++ b/tests/helpers/templates/wheel/standard_default_build_script_artifacts_with_src_layout.py @@ -20,31 +20,29 @@ def get_files(**kwargs): files.append(File(Path(*f.path.parts[1:]), f.contents)) - files.extend( - ( - File(Path(kwargs['package_name'], 'lib.so'), ''), - File(Path('zlib.pyd'), ''), - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + files.extend(( + File(Path(kwargs['package_name'], 'lib.so'), ''), + File(Path('zlib.pyd'), ''), + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: false Tag: {kwargs.get('tag', '')} """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt Requires-Python: >3 """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files) diff --git a/tests/helpers/templates/wheel/standard_default_build_script_configured_build_hooks.py b/tests/helpers/templates/wheel/standard_default_build_script_configured_build_hooks.py index 323a28d61..31e34ed6d 100644 --- a/tests/helpers/templates/wheel/standard_default_build_script_configured_build_hooks.py +++ b/tests/helpers/templates/wheel/standard_default_build_script_configured_build_hooks.py @@ -20,30 +20,28 @@ def get_files(**kwargs): files.append(f) - files.extend( - ( - File(Path(kwargs['package_name'], 'lib.so'), 'custom'), - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + files.extend(( + File(Path(kwargs['package_name'], 'lib.so'), 'custom'), + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: false Tag: {kwargs.get('tag', '')} """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt Requires-Python: >3 """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files) diff --git a/tests/helpers/templates/wheel/standard_default_build_script_extra_dependencies.py b/tests/helpers/templates/wheel/standard_default_build_script_extra_dependencies.py index ebfd23a1f..13d2c95b9 100644 --- a/tests/helpers/templates/wheel/standard_default_build_script_extra_dependencies.py +++ b/tests/helpers/templates/wheel/standard_default_build_script_extra_dependencies.py @@ -20,21 +20,20 @@ def get_files(**kwargs): files.append(f) - files.extend( - ( - File(Path(kwargs['package_name'], 'lib.so'), ''), - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + files.extend(( + File(Path(kwargs['package_name'], 'lib.so'), ''), + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: false Tag: {kwargs.get('tag', '')} """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 @@ -42,9 +41,8 @@ def get_files(**kwargs): Requires-Python: >3 Requires-Dist: binary """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files) diff --git a/tests/helpers/templates/wheel/standard_default_build_script_force_include.py b/tests/helpers/templates/wheel/standard_default_build_script_force_include.py index 6df7d069b..d32daf6be 100644 --- a/tests/helpers/templates/wheel/standard_default_build_script_force_include.py +++ b/tests/helpers/templates/wheel/standard_default_build_script_force_include.py @@ -20,31 +20,29 @@ def get_files(**kwargs): files.append(f) - files.extend( - ( - File(Path(kwargs['package_name'], 'lib.so'), ''), - File(Path(kwargs['package_name'], 'lib.h'), ''), - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + files.extend(( + File(Path(kwargs['package_name'], 'lib.so'), ''), + File(Path(kwargs['package_name'], 'lib.h'), ''), + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: false Tag: {kwargs.get('tag', '')} """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt Requires-Python: >3 """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files) diff --git a/tests/helpers/templates/wheel/standard_default_build_script_force_include_no_duplication.py b/tests/helpers/templates/wheel/standard_default_build_script_force_include_no_duplication.py index d348ef4bd..2ec64023d 100644 --- a/tests/helpers/templates/wheel/standard_default_build_script_force_include_no_duplication.py +++ b/tests/helpers/templates/wheel/standard_default_build_script_force_include_no_duplication.py @@ -20,30 +20,28 @@ def get_files(**kwargs): files.append(f) - files.extend( - ( - File(Path(kwargs['package_name'], 'z.py'), 'print("hello world")'), - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + files.extend(( + File(Path(kwargs['package_name'], 'z.py'), 'print("hello world")'), + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: false Tag: {kwargs.get('tag', '')} """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt Requires-Python: >3 """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files) diff --git a/tests/helpers/templates/wheel/standard_default_extra_metadata.py b/tests/helpers/templates/wheel/standard_default_extra_metadata.py index e62ec8c54..614d09ff6 100644 --- a/tests/helpers/templates/wheel/standard_default_extra_metadata.py +++ b/tests/helpers/templates/wheel/standard_default_extra_metadata.py @@ -20,31 +20,29 @@ def get_files(**kwargs): files.append(f) - files.extend( - ( - File(Path(metadata_directory, 'extra_metadata', 'foo.txt'), ''), - File(Path(metadata_directory, 'extra_metadata', 'nested', 'bar.txt'), ''), - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + files.extend(( + File(Path(metadata_directory, 'extra_metadata', 'foo.txt'), ''), + File(Path(metadata_directory, 'extra_metadata', 'nested', 'bar.txt'), ''), + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: true Tag: py3-none-any """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt Requires-Python: >3 """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files) diff --git a/tests/helpers/templates/wheel/standard_default_license_multiple.py b/tests/helpers/templates/wheel/standard_default_license_multiple.py index 3a4ef32a6..7a330a70c 100644 --- a/tests/helpers/templates/wheel/standard_default_license_multiple.py +++ b/tests/helpers/templates/wheel/standard_default_license_multiple.py @@ -22,30 +22,28 @@ def get_files(**kwargs): files.append(File(Path(*f.path.parts[1:]), f.contents)) - files.extend( - ( - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + files.extend(( + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: true Tag: py2-none-any Tag: py3-none-any """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSES/Apache-2.0.txt License-File: LICENSES/MIT.txt """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files) diff --git a/tests/helpers/templates/wheel/standard_default_license_single.py b/tests/helpers/templates/wheel/standard_default_license_single.py index e9c3348b4..066d8e286 100644 --- a/tests/helpers/templates/wheel/standard_default_license_single.py +++ b/tests/helpers/templates/wheel/standard_default_license_single.py @@ -20,29 +20,27 @@ def get_files(**kwargs): files.append(File(Path(*f.path.parts[1:]), f.contents)) - files.extend( - ( - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + files.extend(( + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: true Tag: py2-none-any Tag: py3-none-any """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files) diff --git a/tests/helpers/templates/wheel/standard_default_namespace_package.py b/tests/helpers/templates/wheel/standard_default_namespace_package.py index ab16857e6..331fe4011 100644 --- a/tests/helpers/templates/wheel/standard_default_namespace_package.py +++ b/tests/helpers/templates/wheel/standard_default_namespace_package.py @@ -22,29 +22,27 @@ def get_files(**kwargs): f.path = Path(namespace_package, f.path) files.append(f) - files.extend( - ( - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + files.extend(( + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: true Tag: py2-none-any Tag: py3-none-any """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files) diff --git a/tests/helpers/templates/wheel/standard_default_python_constraint.py b/tests/helpers/templates/wheel/standard_default_python_constraint.py index 849cd82a8..611f40ba8 100644 --- a/tests/helpers/templates/wheel/standard_default_python_constraint.py +++ b/tests/helpers/templates/wheel/standard_default_python_constraint.py @@ -20,29 +20,27 @@ def get_files(**kwargs): files.append(f) - files.extend( - ( - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + files.extend(( + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: true Tag: py3-none-any """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt Requires-Python: >3 """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files) diff --git a/tests/helpers/templates/wheel/standard_default_shared_data.py b/tests/helpers/templates/wheel/standard_default_shared_data.py index 55ce97658..3132c32ad 100644 --- a/tests/helpers/templates/wheel/standard_default_shared_data.py +++ b/tests/helpers/templates/wheel/standard_default_shared_data.py @@ -21,31 +21,29 @@ def get_files(**kwargs): files.append(f) - files.extend( - ( - File(Path(shared_data_directory, 'data', 'foo.txt'), ''), - File(Path(shared_data_directory, 'data', 'nested', 'bar.txt'), ''), - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + files.extend(( + File(Path(shared_data_directory, 'data', 'foo.txt'), ''), + File(Path(shared_data_directory, 'data', 'nested', 'bar.txt'), ''), + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: true Tag: py3-none-any """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt Requires-Python: >3 """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files) diff --git a/tests/helpers/templates/wheel/standard_default_single_module.py b/tests/helpers/templates/wheel/standard_default_single_module.py index 50902352b..00da83449 100644 --- a/tests/helpers/templates/wheel/standard_default_single_module.py +++ b/tests/helpers/templates/wheel/standard_default_single_module.py @@ -16,30 +16,28 @@ def get_files(**kwargs): if str(f.path) == 'LICENSE.txt' ] - files.extend( - ( - File(Path('my_app.py'), ''), - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + files.extend(( + File(Path('my_app.py'), ''), + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: true Tag: py2-none-any Tag: py3-none-any """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files) diff --git a/tests/helpers/templates/wheel/standard_default_symlink.py b/tests/helpers/templates/wheel/standard_default_symlink.py index 51203c98c..c328eafe8 100644 --- a/tests/helpers/templates/wheel/standard_default_symlink.py +++ b/tests/helpers/templates/wheel/standard_default_symlink.py @@ -20,30 +20,28 @@ def get_files(**kwargs): files.append(f) - files.extend( - ( - File(Path(kwargs['package_name'], 'lib.so'), 'data'), - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + files.extend(( + File(Path(kwargs['package_name'], 'lib.so'), 'data'), + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: false Tag: {kwargs.get('tag', '')} """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt Requires-Python: >3 """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files) diff --git a/tests/helpers/templates/wheel/standard_editable_exact.py b/tests/helpers/templates/wheel/standard_editable_exact.py index 1598c6325..25d574091 100644 --- a/tests/helpers/templates/wheel/standard_editable_exact.py +++ b/tests/helpers/templates/wheel/standard_editable_exact.py @@ -19,38 +19,36 @@ def get_files(**kwargs): pth_file_name = f"_{kwargs['package_name']}.pth" loader_file_name = f"_editable_impl_{kwargs['package_name']}.py" - files.extend( - ( - File(Path(pth_file_name), f"import _editable_impl_{kwargs['package_name']}"), - File( - Path(loader_file_name), - f"""\ + files.extend(( + File(Path(pth_file_name), f"import _editable_impl_{kwargs['package_name']}"), + File( + Path(loader_file_name), + f"""\ from editables.redirector import RedirectingFinder as F F.install() F.map_module({kwargs['package_name']!r}, {package_root!r})""", - ), - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + ), + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: true Tag: py2-none-any Tag: py3-none-any """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt Requires-Dist: editables~=0.3 """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files, generated_files={pth_file_name, loader_file_name}) diff --git a/tests/helpers/templates/wheel/standard_editable_exact_extra_dependencies.py b/tests/helpers/templates/wheel/standard_editable_exact_extra_dependencies.py index d49a37fa2..5d25e809a 100644 --- a/tests/helpers/templates/wheel/standard_editable_exact_extra_dependencies.py +++ b/tests/helpers/templates/wheel/standard_editable_exact_extra_dependencies.py @@ -19,29 +19,28 @@ def get_files(**kwargs): pth_file_name = f"_{kwargs['package_name']}.pth" loader_file_name = f"_editable_impl_{kwargs['package_name']}.py" - files.extend( - ( - File(Path(pth_file_name), f"import _editable_impl_{kwargs['package_name']}"), - File( - Path(loader_file_name), - f"""\ + files.extend(( + File(Path(pth_file_name), f"import _editable_impl_{kwargs['package_name']}"), + File( + Path(loader_file_name), + f"""\ from editables.redirector import RedirectingFinder as F F.install() F.map_module({kwargs['package_name']!r}, {package_root!r})""", - ), - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + ), + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: true Tag: py2-none-any Tag: py3-none-any """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 @@ -49,9 +48,8 @@ def get_files(**kwargs): Requires-Dist: binary Requires-Dist: editables~=0.3 """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files, generated_files={pth_file_name, loader_file_name}) diff --git a/tests/helpers/templates/wheel/standard_editable_exact_force_include.py b/tests/helpers/templates/wheel/standard_editable_exact_force_include.py index 5b4e15538..50e9dc684 100644 --- a/tests/helpers/templates/wheel/standard_editable_exact_force_include.py +++ b/tests/helpers/templates/wheel/standard_editable_exact_force_include.py @@ -20,38 +20,36 @@ def get_files(**kwargs): pth_file_name = f"_{kwargs['package_name']}.pth" loader_file_name = f"_editable_impl_{kwargs['package_name']}.py" - files.extend( - ( - File(Path(pth_file_name), f"import _editable_impl_{kwargs['package_name']}"), - File( - Path(loader_file_name), - f"""\ + files.extend(( + File(Path(pth_file_name), f"import _editable_impl_{kwargs['package_name']}"), + File( + Path(loader_file_name), + f"""\ from editables.redirector import RedirectingFinder as F F.install() F.map_module({kwargs['package_name']!r}, {package_root!r})""", - ), - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + ), + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: true Tag: py2-none-any Tag: py3-none-any """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt Requires-Dist: editables~=0.3 """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files, generated_files={pth_file_name, loader_file_name}) diff --git a/tests/helpers/templates/wheel/standard_editable_pth.py b/tests/helpers/templates/wheel/standard_editable_pth.py index 5aaf6a8f6..bb6eb04ce 100644 --- a/tests/helpers/templates/wheel/standard_editable_pth.py +++ b/tests/helpers/templates/wheel/standard_editable_pth.py @@ -18,30 +18,28 @@ def get_files(**kwargs): ] pth_file_name = f"_{kwargs['package_name']}.pth" - files.extend( - ( - File(Path(pth_file_name), '\n'.join(package_paths)), - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + files.extend(( + File(Path(pth_file_name), '\n'.join(package_paths)), + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: true Tag: py2-none-any Tag: py3-none-any """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files, generated_files={pth_file_name}) diff --git a/tests/helpers/templates/wheel/standard_editable_pth_extra_dependencies.py b/tests/helpers/templates/wheel/standard_editable_pth_extra_dependencies.py index 62f51b6c3..8319e36a8 100644 --- a/tests/helpers/templates/wheel/standard_editable_pth_extra_dependencies.py +++ b/tests/helpers/templates/wheel/standard_editable_pth_extra_dependencies.py @@ -18,31 +18,29 @@ def get_files(**kwargs): ] pth_file_name = f"_{kwargs['package_name']}.pth" - files.extend( - ( - File(Path(pth_file_name), '\n'.join(package_paths)), - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + files.extend(( + File(Path(pth_file_name), '\n'.join(package_paths)), + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: true Tag: py2-none-any Tag: py3-none-any """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt Requires-Dist: binary """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files, generated_files={pth_file_name}) diff --git a/tests/helpers/templates/wheel/standard_editable_pth_force_include.py b/tests/helpers/templates/wheel/standard_editable_pth_force_include.py index d158f858c..9c46c46e1 100644 --- a/tests/helpers/templates/wheel/standard_editable_pth_force_include.py +++ b/tests/helpers/templates/wheel/standard_editable_pth_force_include.py @@ -19,30 +19,28 @@ def get_files(**kwargs): files.append(File(Path('zfoo.py'), f.contents)) pth_file_name = f"_{kwargs['package_name']}.pth" - files.extend( - ( - File(Path(pth_file_name), '\n'.join(package_paths)), - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + files.extend(( + File(Path(pth_file_name), '\n'.join(package_paths)), + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: true Tag: py2-none-any Tag: py3-none-any """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files, generated_files={pth_file_name}) diff --git a/tests/helpers/templates/wheel/standard_entry_points.py b/tests/helpers/templates/wheel/standard_entry_points.py index e26197316..4c97d9e8d 100644 --- a/tests/helpers/templates/wheel/standard_entry_points.py +++ b/tests/helpers/templates/wheel/standard_entry_points.py @@ -20,37 +20,35 @@ def get_files(**kwargs): files.append(f) - files.extend( - ( - File( - Path(metadata_directory, 'entry_points.txt'), - """\ + files.extend(( + File( + Path(metadata_directory, 'entry_points.txt'), + """\ [console_scripts] bar = pkg:foo foo = pkg:bar """, - ), - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + ), + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: true Tag: py2-none-any Tag: py3-none-any """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files) diff --git a/tests/helpers/templates/wheel/standard_no_strict_naming.py b/tests/helpers/templates/wheel/standard_no_strict_naming.py index 8b71c1301..d02eefed8 100644 --- a/tests/helpers/templates/wheel/standard_no_strict_naming.py +++ b/tests/helpers/templates/wheel/standard_no_strict_naming.py @@ -20,29 +20,27 @@ def get_files(**kwargs): files.append(f) - files.extend( - ( - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + files.extend(( + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: true Tag: py2-none-any Tag: py3-none-any """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files) diff --git a/tests/helpers/templates/wheel/standard_only_packages_artifact_override.py b/tests/helpers/templates/wheel/standard_only_packages_artifact_override.py index 5633d2d3b..25c1721c5 100644 --- a/tests/helpers/templates/wheel/standard_only_packages_artifact_override.py +++ b/tests/helpers/templates/wheel/standard_only_packages_artifact_override.py @@ -23,29 +23,27 @@ def get_files(**kwargs): files.append(f) - files.extend( - ( - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + files.extend(( + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: true Tag: py2-none-any Tag: py3-none-any """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files) diff --git a/tests/helpers/templates/wheel/standard_tests.py b/tests/helpers/templates/wheel/standard_tests.py index ceb630ee6..7ff087fd9 100644 --- a/tests/helpers/templates/wheel/standard_tests.py +++ b/tests/helpers/templates/wheel/standard_tests.py @@ -20,29 +20,27 @@ def get_files(**kwargs): files.append(f) - files.extend( - ( - File( - Path(metadata_directory, 'WHEEL'), - f"""\ + files.extend(( + File( + Path(metadata_directory, 'WHEEL'), + f"""\ Wheel-Version: 1.0 Generator: hatchling {__version__} Root-Is-Purelib: true Tag: py2-none-any Tag: py3-none-any """, - ), - File( - Path(metadata_directory, 'METADATA'), - f"""\ + ), + File( + Path(metadata_directory, 'METADATA'), + f"""\ Metadata-Version: {DEFAULT_METADATA_VERSION} Name: {kwargs['project_name']} Version: 0.0.1 License-File: LICENSE.txt """, - ), - ) - ) + ), + )) record_file = File(Path(metadata_directory, 'RECORD'), '') update_record_file_contents(record_file, files)