Commit de10e327 authored by Vincent Pelletier's avatar Vincent Pelletier

Populate server version an client user-agent.

Include both caucase name and its current version number.
Add versioneer for version number introspection, producing egg version and
caucase.__version__.
parent 9e582b82
...@@ -3,3 +3,4 @@ branch = true ...@@ -3,3 +3,4 @@ branch = true
concurrency = thread concurrency = thread
parallel = true parallel = true
source = caucase source = caucase
omit = caucase/_version.py
caucase/_version.py export-subst
[MASTER]
ignore=_version.py
[MESSAGES CONTROL] [MESSAGES CONTROL]
disable=C0103,C0330,R0903,R0913,R0914,R0912,R0915,R0902 disable=C0103,C0330,R0903,R0913,R0914,R0912,R0915,R0902
# C0103 "Invalid name "%s" (should match %s)" # C0103 "Invalid name "%s" (should match %s)"
......
include CHANGES.txt include CHANGES.txt
include COPYING include COPYING
include versioneer.py
include caucase/_version.py
...@@ -18,3 +18,7 @@ ...@@ -18,3 +18,7 @@
""" """
Caucase - Certificate Authority for Users, Certificate Authority for SErvices Caucase - Certificate Authority for Users, Certificate Authority for SErvices
""" """
from __future__ import absolute_import
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
This diff is collapsed.
...@@ -29,6 +29,7 @@ from cryptography import x509 ...@@ -29,6 +29,7 @@ from cryptography import x509
from cryptography.hazmat.backends import default_backend from cryptography.hazmat.backends import default_backend
import cryptography.exceptions import cryptography.exceptions
from . import utils from . import utils
from . import version
__all__ = ( __all__ = (
'CaucaseError', 'CaucaseError',
...@@ -153,6 +154,7 @@ class CaucaseClient(object): ...@@ -153,6 +154,7 @@ class CaucaseClient(object):
def _request(self, connection, method, url, body=None, headers=None): def _request(self, connection, method, url, body=None, headers=None):
path = self._path + url path = self._path + url
headers = headers or {} headers = headers or {}
headers.setdefault('User-Agent', 'caucase ' + version.__version__)
connection.request(method, path, body, headers) connection.request(method, path, body, headers)
response = connection.getresponse() response = connection.getresponse()
response_body = response.read() response_body = response.read()
......
...@@ -40,6 +40,7 @@ from cryptography.hazmat.primitives import serialization ...@@ -40,6 +40,7 @@ from cryptography.hazmat.primitives import serialization
import pem import pem
from . import exceptions from . import exceptions
from . import utils from . import utils
from . import version
from .wsgi import Application from .wsgi import Application
from .ca import CertificateAuthority, UserCertificateAuthority, Extension from .ca import CertificateAuthority, UserCertificateAuthority, Extension
from .storage import SQLite3Storage from .storage import SQLite3Storage
...@@ -96,6 +97,8 @@ class CaucaseWSGIRequestHandler(WSGIRequestHandler): ...@@ -96,6 +97,8 @@ class CaucaseWSGIRequestHandler(WSGIRequestHandler):
""" """
Make WSGIRequestHandler logging more apache-like. Make WSGIRequestHandler logging more apache-like.
""" """
server_version = 'caucased ' + version.__version__
def log_date_time_string(self): def log_date_time_string(self):
""" """
Apache-style date format. Apache-style date format.
......
# This file is part of caucase
# Copyright (C) 2018 Nexedi
# Vincent Pelletier <vincent@nexedi.com>
#
# caucase is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# caucase is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with caucase. If not, see <http://www.gnu.org/licenses/>.
"""
For ease of internal import.
"""
from __future__ import absolute_import
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
[versioneer]
VCS = git
style = pep440
versionfile_source = caucase/_version.py
versionfile_build = caucase/_version.py
tag_prefix =
parentdir_prefix = caucase-
...@@ -19,15 +19,17 @@ ...@@ -19,15 +19,17 @@
from setuptools import setup, find_packages from setuptools import setup, find_packages
import glob import glob
import os import os
import versioneer
long_description = open("README.rst").read() + "\n" long_description = open("README.rst").read() + "\n"
for f in sorted(glob.glob(os.path.join('caucase', 'README.*.rst'))): for f in sorted(glob.glob(os.path.join('caucase', 'README.*.rst'))):
long_description += '\n' + open(f).read() + '\n' long_description += '\n' + open(f).read() + '\n'
# long_description += open("CHANGES.txt").read() + "\n" long_description += open("CHANGES.txt").read() + "\n"
setup( setup(
name='caucase', name='caucase',
version='0.9.2', version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
author='Vincent Pelletier', author='Vincent Pelletier',
author_email='vincent@nexedi.com', author_email='vincent@nexedi.com',
description="Certificate Authority.", description="Certificate Authority.",
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment