Skip to content

Commit

Permalink
btrfs-progs: libbtrfsutil: reuse existing README.md for long description
Browse files Browse the repository at this point in the history
This mostly reverts the commit 8f1f2e7 ("libbtrfsutil: update
btrfsutil long description").

There is no need to introduce such a drama to create a temporary
pypi-README.md, just reuse the existing one in libbtrfsutil/README.md.

This does not only make the code simpler, but pass CI.

Issue: kdave#310
Fixes: 8f1f2e7 ("libbtrfsutil: update btrfsutil long description")
Signed-off-by: Qu Wenruo <[email protected]>
  • Loading branch information
adam900710 committed Sep 20, 2024
1 parent 8f1f2e7 commit 7e1cac4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 32 deletions.
1 change: 0 additions & 1 deletion libbtrfsutil/python/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ __pycache__
/build
/constants.c
/dist
/pypi-README.md
32 changes: 1 addition & 31 deletions libbtrfsutil/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,6 @@ 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')
Expand All @@ -102,19 +85,6 @@ 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 @@ -142,7 +112,7 @@ def run(self):
#version=get_version(),
version='6.11',
description='Library for managing Btrfs filesystems',
long_description=read_readme(),
long_description=open('../README.md').read(),
long_description_content_type='text/markdown',
url='https://github.com/kdave/btrfs-progs',
license='LGPLv2+',
Expand Down

0 comments on commit 7e1cac4

Please sign in to comment.