Repository: tox-dev/tox

Issue:
Warning about `"--global-option": ["--formats=gztar"]` emitted when using setuptools 64.0.1
When using tox to build or install a setuptools-based package, if the tox-created virtualenv contains setuptools v64.0.1, then the following warning is emitted:

```
/Users/jwodder/work/pyproj/linesep/.tox/.package/lib/python3.9/site-packages/setuptools/build_meta.py:306: SetuptoolsDeprecationWarning:
            The arguments ['--formats=gztar'] were given via `--global-option`.
            Please use `--build-option` instead,
            `--global-option` is reserved to flags like `--verbose` or `--quiet`.
```

This appears to be due to [this line of code](https://github.com/tox-dev/tox/blob/d98f589197f033fa9846918f309bf66a645f905b/src/tox/helper/build_isolated.py#L41) in tox's source.

# To Reproduce

1. Clone, say, https://github.com/jwodder/linesep
2. Ensure virtualenv uses the latest version of setuptools by running `virtualenv --upgrade-embed-wheels`
3. Run `tox`

Discussion:
asottile: what versions of setuptools does the new argument require ?

Patch:
diff --git a/docs/changelog/2478.bugfix.rst b/docs/changelog/2478.bugfix.rst
new file mode 100644
index 00000000..f426a23c
--- /dev/null
+++ b/docs/changelog/2478.bugfix.rst
@@ -0,0 +1,1 @@
+Fixed ``SetuptoolsDeprecationWarning`` about using ``--global-option`` -- by :user:`adamchainz`
diff --git a/src/tox/helper/build_isolated.py b/src/tox/helper/build_isolated.py
index 4c57c573..fda88fda 100644
--- a/src/tox/helper/build_isolated.py
+++ b/src/tox/helper/build_isolated.py
@@ -38,5 +38,5 @@ _ensure_module_in_paths(backend, backend_paths)
 if backend_obj:
     backend = getattr(backend, backend_obj)
 
-basename = backend.build_sdist(dist_folder, {"--global-option": ["--formats=gztar"]})
+basename = backend.build_sdist(dist_folder, {"--build-option": ["--formats=gztar"]})
 print(basename)


Test patch:
diff --git a/tests/unit/package/builder/test_package_builder_isolated.py b/tests/unit/package/builder/test_package_builder_isolated.py
index 9501f40f..8a41f2df 100644
--- a/tests/unit/package/builder/test_package_builder_isolated.py
+++ b/tests/unit/package/builder/test_package_builder_isolated.py
@@ -25,6 +25,7 @@ def test_verbose_isolated_build(initproj, mock_venv, cmd):
         },
     )
     result = cmd("--sdistonly", "-v", "-v", "-v", "-e", "py")
+    assert "The arguments ['--formats=gztar'] were given via `--global-option`." not in result.err
     assert "running sdist" in result.out, result.out
     assert "running egg_info" in result.out, result.out
     assert "example123-0.5.tar.gz" in result.out, result.out