Skip to content

1.2.14: SetuptoolsDeprecationWarning due to the use of sys.exit(0) #18

@dvzrv

Description

@dvzrv

Hi! 👋

I package this project for Arch Linux.

During update to 1.2.14 I noticed that setuptools now raises the following warning:

/usr/lib/python3.13/site-packages/setuptools/build_meta.py:522: SetuptoolsDeprecationWarning: Running `setup.py` directly as CLI tool is deprecated.
!!

        ********************************************************************************
        Please avoid using `sys.exit(0)` or similar statements that don't fit in the paradigm of a configuration file.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!
  super().run_setup(setup_script=setup_script)

This appears to be triggered by the sys.exit(0) call in setup.py:

alsa-python/setup.py

Lines 74 to 75 in 20b2b39

if sys.argv[1] != 'build':
sys.exit(0)

(Setuptools now offers one of the various PEP517 build backends and calling setup.py directly as a script is deprecated).

Looking at the file I noticed that there are still conditionals that accommodate Python2:

alsa-python/setup.py

Lines 77 to 80 in 20b2b39

if sys.version_info < (3, 0):
dir = 'build/lib.%s-%s-%s/pyalsa' % (uname[0].lower(), uname[4], sys.version[:3])
else:
dir = 'build/lib.%s-%s-cpython-%s%s/pyalsa' % (uname[0].lower(), uname[4], sys.version_info.major, sys.version_info.minor)

Those should be removed, as the script itself is marked as Python3 (and well of course because Python2 is long discontinued 😅).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions