Skip to content
This repository was archived by the owner on Jun 22, 2024. It is now read-only.

Commit

Permalink
fix long_description on Windows (see: giampaolo#2168)
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Nov 11, 2022
1 parent 8543b11 commit c0aadb1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ name: build
jobs:
# Linux + macOS + Windows Python 3
py3:
name: ${{ matrix.os }}-py3
name: py3-${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
# psutil tests do not like running from a virtualenv with python>=3.7 so
# not using cibuildwheel for those. run them "manually" with this job.
windows-py3-test:
name: windows-py3-test-${{ matrix.python }}-${{ matrix.architecture }}
name: py3-windows-test-${{ matrix.python }}-${{ matrix.architecture }}
needs: py3
runs-on: windows-2019
timeout-minutes: 20
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:

# Linux + macOS + Python 2
linux-macos-py2:
name: ${{ matrix.os }}-py2
name: py2-${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ git-tag-release: ## Git-tag a new release.
sdist: ## Create tar.gz source distribution.
${MAKE} generate-manifest
$(PYTHON) setup.py sdist
$(PYTHON) -m twine check dist/*.tar.gz
$(PYTHON) -m twine check --strict dist/*.tar.gz

# --- others

Expand All @@ -276,7 +276,7 @@ pre-release: ## Check if we're ready to produce a new release.
${MAKE} download-wheels-appveyor
${MAKE} print-hashes
${MAKE} print-wheels
$(PYTHON) -m twine check dist/*
$(PYTHON) -m twine check --strict dist/*
$(PYTHON) -c \
"from psutil import __version__ as ver; \
doc = open('docs/index.rst').read(); \
Expand All @@ -286,7 +286,7 @@ pre-release: ## Check if we're ready to produce a new release.
assert 'XXXX' not in history, 'XXXX in HISTORY.rst';"

release: ## Create a release (down/uploads tar.gz, wheels, git tag release).
$(PYTHON) -m twine check dist/*
$(PYTHON) -m twine check --strict dist/*
$(PYTHON) -m twine upload dist/* # upload tar.gz and Windows wheels on PyPI
${MAKE} git-tag-release

Expand Down
6 changes: 1 addition & 5 deletions scripts/internal/convert_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@ def main():
data = f.read()
data = re.sub(r".. raw:: html\n+\s+<div align[\s\S]*?/div>", summary, data)
data = re.sub(r"Sponsors\n========[\s\S]*?Example usages", funding, data)
if len(sys.argv) > 2:
with open(sys.argv[2], "wb") as f:
f.write(data.encode("utf8"))
else:
print(data)
print(data)


if __name__ == '__main__':
Expand Down
12 changes: 5 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,16 @@ def get_version():
py_limited_api = {}


def get_description():
def get_long_description():
script = os.path.join(HERE, "scripts", "internal", "convert_readme.py")
readme = os.path.join(HERE, 'README.rst')
p = subprocess.Popen([sys.executable, script, readme],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
universal_newlines=True)
stdout, stderr = p.communicate()
if p.returncode != 0:
raise RuntimeError(stderr)
data = stdout.decode('utf8')
if WINDOWS:
data = data.replace('\r\n', '\n')
return data
return stdout


@contextlib.contextmanager
Expand Down Expand Up @@ -388,7 +386,7 @@ def main():
version=VERSION,
cmdclass=cmdclass,
description=__doc__ .replace('\n', ' ').strip() if __doc__ else '',
long_description=get_description(),
long_description=get_long_description(),
long_description_content_type='text/x-rst',
keywords=[
'ps', 'top', 'kill', 'free', 'lsof', 'netstat', 'nice', 'tty',
Expand Down

0 comments on commit c0aadb1

Please sign in to comment.