diff mbox series

btrfs-progs: libbtrfsutil: use package_data member for header files

Message ID b46c1f567043f90aeda59a65dc3f826914e85f51.1726792949.git.wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: libbtrfsutil: use package_data member for header files | expand

Commit Message

Qu Wenruo Sept. 20, 2024, 12:42 a.m. UTC
[BUG]
Currently with python3.12, the python bindding will always result the
following warning:

    [PY]     libbtrfsutil
/usr/lib/python3.12/site-packages/setuptools/_distutils/extension.py:134: UserWarning: Unknown Extension options: 'headers'
  warnings.warn(msg)

[CAUSE]
In the setup.py which specifies the files to be included into the
package, we use setuptools::Extension to specify the file lists and
include paths.

But there is no handling of Extension::headers member, thus resulting
the above warning.

[FIX]
Not an expert in python, but other packages like cffi are all using
`package_data` to include the headers, so just follow them to use
`package_data` member for headers.

Fixes: 87c3fb557ef2 ("libbtrfsutil: update python setup.py for distribution")
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 libbtrfsutil/python/setup.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

David Sterba Sept. 20, 2024, 2:25 p.m. UTC | #1
On Fri, Sep 20, 2024 at 10:12:32AM +0930, Qu Wenruo wrote:
> [BUG]
> Currently with python3.12, the python bindding will always result the
> following warning:
> 
>     [PY]     libbtrfsutil
> /usr/lib/python3.12/site-packages/setuptools/_distutils/extension.py:134: UserWarning: Unknown Extension options: 'headers'
>   warnings.warn(msg)
> 
> [CAUSE]
> In the setup.py which specifies the files to be included into the
> package, we use setuptools::Extension to specify the file lists and
> include paths.
> 
> But there is no handling of Extension::headers member, thus resulting
> the above warning.
> 
> [FIX]
> Not an expert in python, but other packages like cffi are all using
> `package_data` to include the headers, so just follow them to use
> `package_data` member for headers.

Me neither, I haven't found a good documentation for the packaging so
it's more trial and error. Patch added to devel, thanks.
diff mbox series

Patch

diff --git a/libbtrfsutil/python/setup.py b/libbtrfsutil/python/setup.py
index 2b30174653da..0c64399d1c5e 100755
--- a/libbtrfsutil/python/setup.py
+++ b/libbtrfsutil/python/setup.py
@@ -128,9 +128,6 @@  module = Extension(
         'qgroup.c',
         'subvolume.c',
     ],
-    headers=[
-        'btrfsutilpy.h'
-    ],
     include_dirs=['..'],
     library_dirs=['../..'],
     libraries=['btrfsutil'],
@@ -144,6 +141,7 @@  setup(
     description='Library for managing Btrfs filesystems',
     long_description=read_readme(),
     long_description_content_type='text/markdown',
+	package_data = { "btrfstuil" : [ "btrfsutilpy.h" ] },
     url='https://github.com/kdave/btrfs-progs',
     license='LGPLv2+',
     cmdclass={'build_ext': my_build_ext},