Skip to content

Commit 728cee5

Browse files
Martin Belangerigaw
authored andcommitted
PyPI: Only use major version for libnvme.so
When building a pip (PyPI) package, do not set the libnvme.so version to major.minor.patch (e.g. libnvme.so.3.0.0), but instead just set it to the major (e.g. libnvme.so.3). pip/wheel do not care about the full versioning, and since symbolic links cannot be installed via pip (i.e. libnvme.so.3 -> libnvme.so.3.0.0), it's better to just skip the major.minor.patch versioning for PyPI. To support this we're introducing a new config flag "pypi" to let meson know we're building for pip/PyPI. Signed-off-by: Martin Belanger <martin.belanger@dell.com>
1 parent 3f2ca96 commit 728cee5

File tree

4 files changed

+13
-19
lines changed

4 files changed

+13
-19
lines changed

libnvme/src/meson.build

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,6 @@ libnvme = library(
5555
install: true,
5656
)
5757

58-
# Explicitly create the symlinks in the same directory. When building the
59-
# PyPI package (pipx run build --sdist), the symbolic link don't get installed
60-
# unless we explicitly set them as below.
61-
# 1st: libnvme.so.X -> libnvme.so.X.Y.Z
62-
major_version = libnvme_so_version.split('.')[0]
63-
install_symlink(
64-
'libnvme.so.@0@'.format(major_version),
65-
pointing_to: 'libnvme.so.@0@'.format(libnvme_so_version),
66-
install_dir: get_option('libdir'),
67-
)
68-
69-
# 2nd: libnvme.so -> libnvme.so.X
70-
major_version = libnvme_so_version.split('.')[0]
71-
install_symlink(
72-
'libnvme.so',
73-
pointing_to: 'libnvme.so.@0@'.format(major_version),
74-
install_dir: get_option('libdir'),
75-
)
76-
7758
pkg = import('pkgconfig')
7859
pkg.generate(libnvme,
7960
filebase: 'libnvme',

meson.build

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ else
8888
libnvme_so_version = ver_digits + '.0'
8989
endif
9090

91+
# For PyPI builds, use only the major version (e.g., '3' instead of '3.0.0').
92+
# This avoids the need for symbolic links which pip/wheel doesn't preserve.
93+
if get_option('pypi')
94+
libnvme_so_version = libnvme_so_version.split('.')[0]
95+
endif
96+
9197
################################################################################
9298
prefixdir = get_option('prefix')
9399
datadir = join_paths(prefixdir, get_option('datadir'))

meson_options.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,9 @@ option(
130130
value: 'disabled',
131131
description : 'liburing support'
132132
)
133+
option(
134+
'pypi',
135+
type : 'boolean',
136+
value : false,
137+
description : 'building for PyPI (use short soversion, e.g. libnvme.so.3)'
138+
)

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ setup = [
3737
"-Dnvme=disabled",
3838
"-Dlibnvme=enabled",
3939
"-Dpython=enabled",
40+
"-Dpypi=true",
4041
"-Dtests=false",
4142
"-Dnvme-tests=false",
4243
"-Dexamples=false",

0 commit comments

Comments
 (0)