Check CI environment for project to announce

In the event that we're releasing a non-Python project or the
project otherwise lacks a usable setup.py, first attempt to infer
the project name from the $ZUUL_PROJECT environment variable if set
before falling back on assuming the project name is the same as the
name of the current working directory. This is particularly
important when running under CI systems like Zuul, which will name
the current working directory after the job rather than after the
project itself.

Change-Id: I19b51846b581c5d033b08466ca09f23b23bd5e49
This commit is contained in:
Jeremy Stanley 2017-08-05 14:38:41 +00:00
parent d8432fe081
commit cd98fe341b
1 changed files with 9 additions and 2 deletions

View File

@ -163,8 +163,9 @@ echo "$DIFF_START to $VERSION on $SERIES"
relnotes_file="$RELNOTESDIR/$SHORTNAME-$VERSION"
# If we don't have a setup.py use the current directory name as the library
# name so the email template makes sense.
# If we don't have a setup.py, use a CI system environment variable or the
# current directory name as the library name so the email template makes
# sense.
if [ -e setup.py ] ; then
# Some projects have setup_requires dependencies on packages that are
# not pre-installed, so run a setuptools command in a way to get them
@ -174,7 +175,13 @@ if [ -e setup.py ] ; then
python setup.py --name
library_name=$(python setup.py --name)
description="$(python setup.py --description)"
elif [ -n "$ZUUL_PROJECT" ] ; then
# We may be running in the context of a Zuul CI system, in which case
# we can infer the project name from the repo name it supplies.
library_name="$(basename ${ZUUL_PROJECT})"
else
# As a last resort, guess that the project name may be the same as that
# of the local working directory at the point this script is invoked.
library_name="$(basename $(pwd))"
fi