No "sem-ver:" line processing if pkg_resources can determine the package version
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
PBR |
Confirmed
|
Medium
|
Unassigned |
Bug Description
I started using "Sem-Ver: feature" in commit messages of the pywbem project on GitHub with the goal to get the (pbr-created) project version to be properly incremented in its middle version number (i.e. last tag 0.12.0 results in 0.13.0.devXXX).
However, any "Sem-Ver: feature" seemed to be ignored, and the dev version still incremented only the right version number (i.e. last tag 0.12.0 results in 0.12.1.devXXX).
After digging in the code, I found the following in pbr.version:
def _get_version_
"""Obtain a version from pkg_resources or setup-time logic if missing.
This will try to get the version of the package from the pkg_resources
record associated with the package, and if there is no such record
falls back to the logic sdist would use.
"""
# Lazy import because pkg_resources is costly to import so defer until
# we absolutely need it.
import pkg_resources
try:
except pkg_resources.
# The most likely cause for this is running tests in a tree
# produced from a tarball where the package itself has not been
# installed into anything. Revert to setup-time logic.
from pbr import packaging
return SemanticVersion
This causes the pbr based version determination not even to be invoked when pkg_resources can determine the package version. In that case, no sem-ver processing takes place at all.
The desired result would be that "sem-ver:" lines are processed independently of whether pkg_resources can determine the package version.
Changed in pbr: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
Changing the code above so that it uses the code in the except: clause unconditionally produces the desired result.