mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Build manpages as part of sdist (#53728)
* Build fixups This is in pursuit of making snapshots easier. * Allow overriding the python command used for generating man pages * Build the changelog prior to creating the sdist * Add the uninstalled ansible library to PYTHONPATH for changelog generation * Warn that python setup.py sdist may be incomplete; use make sdist or make snapshot instead. * Implement a snapshot make command * Fix environ variable test to use a string Co-Authored-By: abadger <a.badger@gmail.com>
This commit is contained in:
parent
baf255e4c1
commit
5ba7063f4f
2 changed files with 20 additions and 3 deletions
14
Makefile
14
Makefile
|
@ -31,9 +31,10 @@ ASCII2MAN = rst2man.py $< $@
|
||||||
else
|
else
|
||||||
ASCII2MAN = @echo "ERROR: rst2man from docutils command is not installed but is required to build $(MANPAGES)" && exit 1
|
ASCII2MAN = @echo "ERROR: rst2man from docutils command is not installed but is required to build $(MANPAGES)" && exit 1
|
||||||
endif
|
endif
|
||||||
GENERATE_CLI = docs/bin/generate_man.py
|
|
||||||
|
|
||||||
PYTHON=python
|
PYTHON=python
|
||||||
|
GENERATE_CLI = $(PYTHON) docs/bin/generate_man.py
|
||||||
|
|
||||||
SITELIB = $(shell $(PYTHON) -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
|
SITELIB = $(shell $(PYTHON) -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
|
||||||
|
|
||||||
# fetch version from project release.py as single source-of-truth
|
# fetch version from project release.py as single source-of-truth
|
||||||
|
@ -238,7 +239,14 @@ sdist_check:
|
||||||
|
|
||||||
.PHONY: sdist
|
.PHONY: sdist
|
||||||
sdist: sdist_check clean docs
|
sdist: sdist_check clean docs
|
||||||
$(PYTHON) setup.py sdist
|
_ANSIBLE_SDIST_FROM_MAKEFILE=1 $(PYTHON) setup.py sdist
|
||||||
|
|
||||||
|
# Official releases generate the changelog as the last commit before the release.
|
||||||
|
# Snapshots shouldn't result in new checkins so the changelog is generated as
|
||||||
|
# part of creating the tarball.
|
||||||
|
.PHONY: snapshot
|
||||||
|
sdist: sdist_check clean docs changelog
|
||||||
|
_ANSIBLE_SDIST_FROM_MAKEFILE=1 $(PYTHON) setup.py sdist
|
||||||
|
|
||||||
.PHONY: sdist_upload
|
.PHONY: sdist_upload
|
||||||
sdist_upload: clean docs
|
sdist_upload: clean docs
|
||||||
|
@ -246,7 +254,7 @@ sdist_upload: clean docs
|
||||||
|
|
||||||
.PHONY: changelog
|
.PHONY: changelog
|
||||||
changelog:
|
changelog:
|
||||||
packaging/release/changelogs/changelog.py release -vv && packaging/release/changelogs/changelog.py generate -vv
|
PYTHONPATH=./lib packaging/release/changelogs/changelog.py release -vv && PYTHONPATH=./lib packaging/release/changelogs/changelog.py generate -vv
|
||||||
|
|
||||||
.PHONY: rpmcommon
|
.PHONY: rpmcommon
|
||||||
rpmcommon: sdist
|
rpmcommon: sdist
|
||||||
|
|
9
setup.py
9
setup.py
|
@ -136,6 +136,15 @@ class SDistCommand(SDist):
|
||||||
|
|
||||||
SDist.run(self)
|
SDist.run(self)
|
||||||
|
|
||||||
|
# Print warnings at the end because no one will see warnings before all the normal status
|
||||||
|
# output
|
||||||
|
if os.environ.get('_ANSIBLE_SDIST_FROM_MAKEFILE', False) != '1':
|
||||||
|
warnings.warn('When setup.py sdist is run from outside of the Makefile,'
|
||||||
|
' the generated tarball may be incomplete. Use `make snapshot`'
|
||||||
|
' to create a tarball from an arbitrary checkout or use'
|
||||||
|
' `cd packaging/release && make release version=[..]` for official builds.',
|
||||||
|
RuntimeWarning)
|
||||||
|
|
||||||
|
|
||||||
def read_file(file_name):
|
def read_file(file_name):
|
||||||
"""Read file and return its contents."""
|
"""Read file and return its contents."""
|
||||||
|
|
Loading…
Reference in a new issue