Skip to content

Commit

Permalink
libbtrfsutil: update btrfsutil long description
Browse files Browse the repository at this point in the history
Provide at least basic description of the library for pypi.org main
page. It's for libbtrfsutil that mentions the C and python usage.

[ ci skip ]

Issue: kdave#310
Signed-off-by: David Sterba <[email protected]>
  • Loading branch information
kdave committed Sep 18, 2024
1 parent 79ce9b6 commit 8f1f2e7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions libbtrfsutil/python/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ __pycache__
/build
/constants.c
/dist
/pypi-README.md
33 changes: 33 additions & 0 deletions libbtrfsutil/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,26 @@ def gen_constants():
""")


def read_readme():
# FIXME: hackish, needs to be run twice to work
if not os.path.exists('pypi-README.md'):
copy_readme()
raise Exception("Copied ../README.md to pypi-README.md, run again")
with open('pypi-README.md', 'r') as f:
desc = f.read()
return desc


def copy_readme():
with open('../README.md', 'r') as f:
desc = f.read()
with open('pypi-README.md', 'w') as f:
f.write(desc)


class my_build_ext(build_ext):
def run(self):
open(os.path.join(os.path.dirname(__file__), "pypi-README.md"), 'r')
# Running dist outside of git
if not os.path.exists('../btrfsutil.h'):
# But no generated constants.c found
Expand All @@ -84,6 +102,19 @@ def run(self):
except OSError:
pass
raise e
if not os.path.exists('../README.md'):
# But no generated constants.c found
if not os.path.exists('pypi-README.md'):
raise Exception("The temporary description file pypi-README.md not found, please fix manually")
elif out_of_date(['../README.md'], 'pypi-README.md'):
try:
copy_readme()
except Exception as e:
try:
os.remove('pypi-README.md')
except OSError:
pass
raise e
super().run()


Expand Down Expand Up @@ -111,6 +142,8 @@ def run(self):
#version=get_version(),
version='6.11',
description='Library for managing Btrfs filesystems',
long_description=read_readme(),
long_description_content_type='text/markdown',
url='https://github.com/kdave/btrfs-progs',
license='LGPLv2+',
cmdclass={'build_ext': my_build_ext},
Expand Down

0 comments on commit 8f1f2e7

Please sign in to comment.