setup-py-upgrade icon indicating copy to clipboard operation
setup-py-upgrade copied to clipboard

Support package_data with empty key and multiple values

Open hugovk opened this issue 2 years ago • 3 comments

Given setup.py:

from setuptools import setup

setup(package_data={"": ["LICENSE", "NOTICE"]})

Run:

$ setup-py-upgrade .
./setup.py and ./setup.cfg written!

Produces setup.cfg:

[options.package_data]
 =
    LICENSE
    NOTICE

Expected:

[options.package_data]
* =
    LICENSE
    NOTICE

This is similar to https://github.com/asottile/setup-py-upgrade/issues/4 (fixed by PR https://github.com/asottile/setup-py-upgrade/pull/5), and the simple case still works; this setup.py:

from setuptools import setup

setup(package_data={"": ["LICENSE"]})

Correctly produces this setup.cfg:

[options.package_data]
* =
    LICENSE

hugovk avatar Sep 28 '21 13:09 hugovk

actually on second thought, I think package_data={'': ...} should be rejected outright

it doesn't appear to work, and even if it did it would pollute the top level with data files

asottile avatar Sep 28 '21 14:09 asottile

Ah yes, I'm using setuptools_scm anyway so looks like I don't need package_data at all.

hugovk avatar Sep 28 '21 15:09 hugovk

but it does look like the if statement should be moved -- cc @mxr

asottile avatar Sep 28 '21 15:09 asottile