Skip to content

[BUG] New version 68.2.1 breaks python setup.py --version when using pyproject.toml #4047

@bitbier

Description

@bitbier

setuptools version

setuptools==68.2.1

Python version

Python 3.9.13

OS

Mac OS X

Additional environment information

No response

Description

When using pyproject.toml's [project] descriptors's version attribute, the newest version of setup tools breaks with the following exception:

$ python setup.py --version
Traceback (most recent call last):
  File "/workspace/setup.py", line 2, in <module>
    setup(
  File "/Users/jstarker/.pyenv/versions/setup-version-failed/lib/python3.9/site-packages/setuptools/__init__.py", line 103, in setup
    return distutils.core.setup(**attrs)
  File "/Users/jstarker/.pyenv/versions/setup-version-failed/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 172, in setup
    ok = dist.parse_command_line()
  File "/Users/jstarker/.pyenv/versions/setup-version-failed/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 467, in parse_command_line
    args = parser.getopt(args=self.script_args, object=self)
  File "/Users/jstarker/.pyenv/versions/setup-version-failed/lib/python3.9/site-packages/setuptools/_distutils/fancy_getopt.py", line 274, in getopt
    val = getattr(object, attr, 0) + 1
TypeError: can only concatenate str (not "int") to str

This works with 68.2.0.

Expected behavior

Expected to display the version of the test project

How to Reproduce

  1. Create two files:
# setup.py
from setuptools import setup
setup()
# pyproject.toml
[project]
name = "test"
version = "1.0.0"
  1. Install setuptools==68.2.1
  2. Run python setup.py --version

Output

$ python setup.py --version
Traceback (most recent call last):
  File "/workspace/setup.py", line 2, in <module>
    setup(
  File "/Users/jstarker/.pyenv/versions/setup-version-failed/lib/python3.9/site-packages/setuptools/__init__.py", line 103, in setup
    return distutils.core.setup(**attrs)
  File "/Users/jstarker/.pyenv/versions/setup-version-failed/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 172, in setup
    ok = dist.parse_command_line()
  File "/Users/jstarker/.pyenv/versions/setup-version-failed/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 467, in parse_command_line
    args = parser.getopt(args=self.script_args, object=self)
  File "/Users/jstarker/.pyenv/versions/setup-version-failed/lib/python3.9/site-packages/setuptools/_distutils/fancy_getopt.py", line 274, in getopt
    val = getattr(object, attr, 0) + 1
TypeError: can only concatenate str (not "int") to str

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions