Automagic versioning
Use pbr for versioning when developing but use PKG-INFO file in production. This lets you build swauth package that don't require pbr to be installed at all. You would need pbr on machine building package but not on machines that install the package. Stolen from Swift: https://github.com/openstack/swift/blob/master/swift/__init__.py Change-Id: Ic3a8fe1d9fe8d7d1f84b63142049970295fbcaab
This commit is contained in:
parent
82efffb846
commit
375b430fff
@ -65,9 +65,10 @@ copyright = u'2010-2011, OpenStack, LLC'
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '.'.join(str(v) for v in swauth.version_info[:2])
|
||||
from swauth import __version__
|
||||
version = __version__.rsplit('.', 1)[0]
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = swauth.version
|
||||
release = swauth.__version__
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
@ -14,10 +14,21 @@
|
||||
# limitations under the License.
|
||||
|
||||
import gettext
|
||||
import pkg_resources
|
||||
|
||||
|
||||
#: Version information (major, minor, revision[, 'dev']).
|
||||
version_info = (1, 0, 9, 'dev')
|
||||
#: Version string 'major.minor.revision'.
|
||||
version = __version__ = ".".join(map(str, version_info))
|
||||
try:
|
||||
# First, try to get our version out of PKG-INFO. If we're installed,
|
||||
# this'll let us find our version without pulling in pbr. After all, if
|
||||
# we're installed on a system, we're not in a Git-managed source tree, so
|
||||
# pbr doesn't really buy us anything.
|
||||
__version__ = pkg_resources.get_provider(
|
||||
pkg_resources.Requirement.parse('swauth')).version
|
||||
except pkg_resources.DistributionNotFound:
|
||||
# No PKG-INFO? We're probably running from a checkout, then. Let pbr do
|
||||
# its thing to figure out a version number.
|
||||
import pbr.version
|
||||
__version__ = pbr.version.VersionInfo(
|
||||
'swauth').version_string()
|
||||
|
||||
gettext.install('swauth')
|
||||
|
Loading…
x
Reference in New Issue
Block a user