All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] btrfs-progs: libbtrfsutil/python: fix all the warnings
@ 2024-09-21  2:26 Qu Wenruo
  2024-09-21  2:26 ` [PATCH 1/3] btrfs-progs: libbtrfsutil/python: use MANIFEST.in for headers Qu Wenruo
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Qu Wenruo @ 2024-09-21  2:26 UTC (permalink / raw)
  To: linux-btrfs

There are the following warnings when building the python binding the
proper way (directly calling "setup.py build" is no longer recommended):

 $ python -m build btrfs-progs/libbtrfsutil/python
 * Creating isolated environment: venv+pip...
 * Installing packages in isolated environment:
   - setuptools >= 40.8.0
 * Getting build dependencies for sdist...
 /tmp/build-env-2u6q_udl/lib/python3.12/site-packages/setuptools/_distutils/extension.py:139: UserWarning: Unknown Extension options: 'headers'
   warnings.warn(msg)
 * Building sdist...
 /tmp/build-env-2u6q_udl/lib/python3.12/site-packages/setuptools/_distutils/extension.py:139: UserWarning: Unknown Extension options: 'headers'
   warnings.warn(msg)
 writing manifest file 'btrfsutil.egg-info/SOURCES.txt'
 warning: sdist: standard file not found: should have one of README, README.rst, README.txt, README.md

This patch fixes them by:

- Use MANIFEST.in to properly include the "btrfsutilpy.h"
- Remove unnecessary build options for C files
- Reuse the existing README.md by a softlink
  So that even in a virtual environment the README.md will still be
  properly copied.

TODO: Migrate the "python setup.py build" system to "python -m build"
for building and tox for tests.

Qu Wenruo (3):
  btrfs-progs: libbtrfsutil/python: use MANIFEST.in for headers
  btrfs-progs: libbtrfsutil/python: remove unnecessary build options
  btrfs-progs: libbtrfsutil/python: reuse existing README.md for long
    description

 libbtrfsutil/python/MANIFEST.in | 1 +
 libbtrfsutil/python/README.md   | 1 +
 libbtrfsutil/python/setup.py    | 7 ++-----
 3 files changed, 4 insertions(+), 5 deletions(-)
 create mode 100644 libbtrfsutil/python/MANIFEST.in
 create mode 120000 libbtrfsutil/python/README.md

--
2.46.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] btrfs-progs: libbtrfsutil/python: use MANIFEST.in for headers
  2024-09-21  2:26 [PATCH 0/3] btrfs-progs: libbtrfsutil/python: fix all the warnings Qu Wenruo
@ 2024-09-21  2:26 ` Qu Wenruo
  2024-09-21  2:26 ` [PATCH 2/3] btrfs-progs: libbtrfsutil/python: remove unnecessary build options Qu Wenruo
  2024-09-21  2:26 ` [PATCH 3/3] btrfs-progs: libbtrfsutil/python: reuse existing README.md for long description Qu Wenruo
  2 siblings, 0 replies; 4+ messages in thread
From: Qu Wenruo @ 2024-09-21  2:26 UTC (permalink / raw)
  To: linux-btrfs

[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]
According to the docs of setuptools, MANIFEST.in is the file controlling
what files should be included.
So instead of the non-supported headers, use MANIFEST.in to include the
needed headers.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 libbtrfsutil/python/MANIFEST.in | 1 +
 libbtrfsutil/python/setup.py    | 3 ---
 2 files changed, 1 insertion(+), 3 deletions(-)
 create mode 100644 libbtrfsutil/python/MANIFEST.in

diff --git a/libbtrfsutil/python/MANIFEST.in b/libbtrfsutil/python/MANIFEST.in
new file mode 100644
index 000000000000..b613db8ea918
--- /dev/null
+++ b/libbtrfsutil/python/MANIFEST.in
@@ -0,0 +1 @@
+include btrfsutilpy.h
diff --git a/libbtrfsutil/python/setup.py b/libbtrfsutil/python/setup.py
index e0ffb7c52c5b..79c0b48dee7d 100755
--- a/libbtrfsutil/python/setup.py
+++ b/libbtrfsutil/python/setup.py
@@ -97,9 +97,6 @@ module = Extension(
         'qgroup.c',
         'subvolume.c',
     ],
-    headers=[
-        'btrfsutilpy.h'
-    ],
     include_dirs=['..'],
     library_dirs=['../..'],
     libraries=['btrfsutil'],
-- 
2.46.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] btrfs-progs: libbtrfsutil/python: remove unnecessary build options
  2024-09-21  2:26 [PATCH 0/3] btrfs-progs: libbtrfsutil/python: fix all the warnings Qu Wenruo
  2024-09-21  2:26 ` [PATCH 1/3] btrfs-progs: libbtrfsutil/python: use MANIFEST.in for headers Qu Wenruo
@ 2024-09-21  2:26 ` Qu Wenruo
  2024-09-21  2:26 ` [PATCH 3/3] btrfs-progs: libbtrfsutil/python: reuse existing README.md for long description Qu Wenruo
  2 siblings, 0 replies; 4+ messages in thread
From: Qu Wenruo @ 2024-09-21  2:26 UTC (permalink / raw)
  To: linux-btrfs

There is no special include and libarary path required for the build of
cpython binding.

Just remove the unnecessary build options.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 libbtrfsutil/python/setup.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libbtrfsutil/python/setup.py b/libbtrfsutil/python/setup.py
index 79c0b48dee7d..8b377b9fa1b6 100755
--- a/libbtrfsutil/python/setup.py
+++ b/libbtrfsutil/python/setup.py
@@ -97,8 +97,6 @@ module = Extension(
         'qgroup.c',
         'subvolume.c',
     ],
-    include_dirs=['..'],
-    library_dirs=['../..'],
     libraries=['btrfsutil'],
 )
 
-- 
2.46.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] btrfs-progs: libbtrfsutil/python: reuse existing README.md for long description
  2024-09-21  2:26 [PATCH 0/3] btrfs-progs: libbtrfsutil/python: fix all the warnings Qu Wenruo
  2024-09-21  2:26 ` [PATCH 1/3] btrfs-progs: libbtrfsutil/python: use MANIFEST.in for headers Qu Wenruo
  2024-09-21  2:26 ` [PATCH 2/3] btrfs-progs: libbtrfsutil/python: remove unnecessary build options Qu Wenruo
@ 2024-09-21  2:26 ` Qu Wenruo
  2 siblings, 0 replies; 4+ messages in thread
From: Qu Wenruo @ 2024-09-21  2:26 UTC (permalink / raw)
  To: linux-btrfs

Instead of copying the file during custom build commands, just use a
soft link to re-use the existing README.d from libbtrfsutil.

Issue: #310
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 libbtrfsutil/python/README.md | 1 +
 libbtrfsutil/python/setup.py  | 2 ++
 2 files changed, 3 insertions(+)
 create mode 120000 libbtrfsutil/python/README.md

diff --git a/libbtrfsutil/python/README.md b/libbtrfsutil/python/README.md
new file mode 120000
index 000000000000..32d46ee883b5
--- /dev/null
+++ b/libbtrfsutil/python/README.md
@@ -0,0 +1 @@
+../README.md
\ No newline at end of file
diff --git a/libbtrfsutil/python/setup.py b/libbtrfsutil/python/setup.py
index 8b377b9fa1b6..5e3bcf088699 100755
--- a/libbtrfsutil/python/setup.py
+++ b/libbtrfsutil/python/setup.py
@@ -106,6 +106,8 @@ setup(
     #version=get_version(),
     version='6.11',
     description='Library for managing Btrfs filesystems',
+    long_description=open('README.md').read(),
+    long_description_content_type='text/markdown',
     url='https://github.com/kdave/btrfs-progs',
     license='LGPLv2+',
     cmdclass={'build_ext': my_build_ext},
-- 
2.46.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-09-21  2:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-21  2:26 [PATCH 0/3] btrfs-progs: libbtrfsutil/python: fix all the warnings Qu Wenruo
2024-09-21  2:26 ` [PATCH 1/3] btrfs-progs: libbtrfsutil/python: use MANIFEST.in for headers Qu Wenruo
2024-09-21  2:26 ` [PATCH 2/3] btrfs-progs: libbtrfsutil/python: remove unnecessary build options Qu Wenruo
2024-09-21  2:26 ` [PATCH 3/3] btrfs-progs: libbtrfsutil/python: reuse existing README.md for long description Qu Wenruo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.