libbtrfsutil: update python setup.py for distribution
Fixes so 'python3 -m build' works and package can be uploaded to pypi (https://pypi.org/project/btrfsutil/). - setup.py is still used for local build (make) - for pypi it must be done by 'python3 -m build' that is build in a temporary directory - btrfsutilpy.h must be also distributed - version is set manually (the git VERSION file is not accessible) - the project page metadata is empty, the README.md should be added Issue: #310 Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
0cac9acfc6
commit
87c3fb557e
|
@ -70,7 +70,12 @@ void add_module_constants(PyObject *m)
|
||||||
|
|
||||||
class my_build_ext(build_ext):
|
class my_build_ext(build_ext):
|
||||||
def run(self):
|
def run(self):
|
||||||
if out_of_date(['../btrfsutil.h'], 'constants.c'):
|
# Running dist outside of git
|
||||||
|
if not os.path.exists('../btrfsutil.h'):
|
||||||
|
# But no generated constants.c found
|
||||||
|
if not os.path.exists('constants.c'):
|
||||||
|
raise Exception("No generated constants.c found, please fix")
|
||||||
|
elif out_of_date(['../btrfsutil.h'], 'constants.c'):
|
||||||
try:
|
try:
|
||||||
gen_constants()
|
gen_constants()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -92,6 +97,9 @@ module = Extension(
|
||||||
'qgroup.c',
|
'qgroup.c',
|
||||||
'subvolume.c',
|
'subvolume.c',
|
||||||
],
|
],
|
||||||
|
headers=[
|
||||||
|
'btrfsutilpy.h'
|
||||||
|
],
|
||||||
include_dirs=['..'],
|
include_dirs=['..'],
|
||||||
library_dirs=['../..'],
|
library_dirs=['../..'],
|
||||||
libraries=['btrfsutil'],
|
libraries=['btrfsutil'],
|
||||||
|
@ -99,7 +107,9 @@ module = Extension(
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='btrfsutil',
|
name='btrfsutil',
|
||||||
version=get_version(),
|
# FIXME: version file is not present when building outside of git
|
||||||
|
#version=get_version(),
|
||||||
|
version='6.10',
|
||||||
description='Library for managing Btrfs filesystems',
|
description='Library for managing Btrfs filesystems',
|
||||||
url='https://github.com/kdave/btrfs-progs',
|
url='https://github.com/kdave/btrfs-progs',
|
||||||
license='LGPLv2+',
|
license='LGPLv2+',
|
||||||
|
|
Loading…
Reference in New Issue