Repository: pypa/setuptools

Issue:
[BUG] Install fails with `use_2to3 is invalid` error
### setuptools version

67.7.0

### Python version

3.8

### OS

Ubuntu 22.04.2 LTS

### Additional environment information

Use of `pip` 23.1 is required for the reproducer given, since it relies on `--no-binary` attempting to build a wheel.
Additionally, `wheel` should not be installed for the reproducer to work.

The changes in https://github.com/pypa/setuptools/pull/3849 seem related.

### Description

Installation of `coverage` version 4.5.4 fails with `setuptools` version 67.7.0, but works with 67.6.1.

As a work-around, I can use the previous version of `setuptools`:

```console
$ cat constraints.txt
setuptools==67.6.1
$ PIP_CONSTRAINT=./constraints.txt pip install coverage==4.5.4 --no-binary :all: --no-cache
Collecting coverage==4.5.4
  Downloading coverage-4.5.4.tar.gz (385 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 385.2/385.2 kB 1.5 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: coverage
  Building wheel for coverage (pyproject.toml) ... done
  Created wheel for coverage: filename=coverage-4.5.4-cp38-cp38-linux_x86_64.whl size=208278 sha256=73953647437bb81efefbaae00f779c00e8051e83d2ec0dba760e465e1793cc91
  Stored in directory: /tmp/pip-ephem-wheel-cache-pnyp3zi8/wheels/e7/0e/3f/4d16d7576f1070cf1a0028b1664aff2cc8e84c9c0e2b8f3207
Successfully built coverage
Installing collected packages: coverage
Successfully installed coverage-4.5.4
```

### Expected behavior

```console
$ pip install coverage==4.5.4 --no-binary :all: --no-cache
Collecting coverage==4.5.4
  Downloading coverage-4.5.4.tar.gz (385 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 385.2/385.2 kB 1.5 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: coverage
  Building wheel for coverage (pyproject.toml) ... done
  Created wheel for coverage: filename=coverage-4.5.4-cp38-cp38-linux_x86_64.whl size=208278 sha256=73953647437bb81efefbaae00f779c00e8051e83d2ec0dba760e465e1793cc91
  Stored in directory: /tmp/pip-ephem-wheel-cache-pnyp3zi8/wheels/e7/0e/3f/4d16d7576f1070cf1a0028b1664aff2cc8e84c9c0e2b8f3207
Successfully built coverage
Installing collected packages: coverage
Successfully installed coverage-4.5.4
```

### How to Reproduce

`pip install coverage==4.5.4 --no-binary :all: --no-cache`


### Output

```console
$ pip install coverage==4.5.4 --no-binary :all: --no-cache
Collecting coverage==4.5.4
  Downloading coverage-4.5.4.tar.gz (385 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 385.2/385.2 kB 1.6 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      /tmp/pip-build-env-6bs8y2ax/overlay/lib/python3.8/site-packages/setuptools/config/setupcfg.py:293: _DeprecatedConfig: Deprecated config in `setup.cfg`
      !!
      
              ********************************************************************************
              The license_file parameter is deprecated, use license_files instead.
      
              By 2023-Oct-30, you need to update your project and remove deprecated calls
              or your builds will no longer be supported.
      
              See https://setuptools.pypa.io/en/latest/https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
              ********************************************************************************
      
      !!
        parsed = self.parsers.get(option_name, lambda x: x)(value)
      /tmp/pip-build-env-6bs8y2ax/overlay/lib/python3.8/site-packages/setuptools/dist.py:954: DistDeprecationWarning: use_2to3 is ignored.
        ep.load()(self, ep.name, value)
      error in coverage setup command: use_2to3 is invalid.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
```



Discussion:

Resolving patch:
diff --git a/setuptools/dist.py b/setuptools/dist.py
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -334,6 +334,7 @@ def invalid_unless_false(dist, attr, value):
     if not value:
         DistDeprecationWarning.emit(f"{attr} is ignored.")
         # TODO: should there be a `due_date` here?
+        return
     raise DistutilsSetupError(f"{attr} is invalid.")
 
 


Test patch: