diff --git a/docs/conf.py b/docs/conf.py index 3a280a56..07e4fc5d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -55,10 +55,12 @@ copyright = u'2015, Netflix Inc.' # |version| and |release|, also used in various other places throughout the # built documents. # -# The short X.Y version. -version = get_version() -# The full version, including alpha/beta/rc tags. -release = get_version() +base_dir = os.path.join(os.path.dirname(__file__), os.pardir) +about = {} +with open(os.path.join(base_dir, "lemur", "__about__.py")) as f: + exec(f.read(), about) + +version = release = about["__version__"] # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/doing-a-release.rst b/docs/doing-a-release.rst new file mode 100644 index 00000000..09848eb6 --- /dev/null +++ b/docs/doing-a-release.rst @@ -0,0 +1,53 @@ +Doing a release +=============== + +Doing a release of ``lemur`` requires a few steps. + +Bumping the version number +-------------------------- + +The next step in doing a release is bumping the version number in the +software. + +* Update the version number in ``lemur/__about__.py``. +* Set the release date in the :doc:`/changelog`. +* Do a commit indicating this. +* Send a pull request with this. +* Wait for it to be merged. + +Performing the release +---------------------- + +The commit that merged the version number bump is now the official release +commit for this release. You will need to have ``gpg`` installed and a ``gpg`` +key in order to do a release. Once this has happened: + +* Run ``invoke release {version}``. + +The release should now be available on PyPI and a tag should be available in +the repository. + +Verifying the release +--------------------- + +You should verify that ``pip install lemur`` works correctly: + +.. code-block:: pycon + + >>> import lemur + >>> lemur.__version__ + '...' + +Verify that this is the version you just released. + +Post-release tasks +------------------ + +* Update the version number to the next major (e.g. ``0.5.dev1``) in + ``lemur/__about__.py`` and +* Add new :doc:`/changelog` entry with next version and note that it is under + active development +* Send a pull request with these items +* Check for any outstanding code undergoing a deprecation cycle by looking in + ``lemur.utils`` for ``DeprecatedIn**`` definitions. If any exist open + a ticket to increment them for the next release. diff --git a/docs/faq.rst b/docs/faq.rst index 6ee9c4a9..a3129751 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -14,6 +14,11 @@ I am seeing Lemur's javascript load in my browser but not the CSS. :doc:`production/index` for example configurations. +After installing Lemur I am unable to login + Ensure that you are trying to login with the credentials you entered during `lemur init`. These are separate + from the postgres database credentials. + + Running 'lemur db upgrade' seems stuck. Most likely, the upgrade is stuck because an existing query on the database is holding onto a lock that the migration needs. diff --git a/docs/version.py b/docs/version.py deleted file mode 100644 index 9e02db92..00000000 --- a/docs/version.py +++ /dev/null @@ -1,45 +0,0 @@ -# Source: https://github.com/Changaco/version.py - -from os.path import dirname, isdir, join -import re -from subprocess import CalledProcessError, check_output - - -PREFIX = '' - -tag_re = re.compile(r'\btag: %s([0-9][^,]*)\b' % PREFIX) -version_re = re.compile('^Version: (.+)$', re.M) - - -def get_version(): - # Return the version if it has been injected into the file by git-archive - version = tag_re.search('$Format:%D$') - if version: - return version.group(1) - - d = dirname(__file__) - - if isdir(join(d, '.git')): - # Get the version using "git describe". - cmd = 'git describe --tags --match %s[0-9]* --dirty' % PREFIX - try: - version = check_output(cmd.split()).decode().strip()[len(PREFIX):] - except CalledProcessError: - raise RuntimeError('Unable to get version number from git tags') - - # PEP 440 compatibility - if '-' in version: - if version.endswith('-dirty'): - raise RuntimeError('The working tree is dirty') - version = '.post'.join(version.split('-')[:2]) - - else: - # Extract the version from the PKG-INFO file. - with open(join(d, 'PKG-INFO')) as f: - version = version_re.search(f.read()).group(1) - - return version - - -if __name__ == '__main__': - print(get_version()) diff --git a/lemur/__about__.py b/lemur/__about__.py new file mode 100644 index 00000000..f7d7a909 --- /dev/null +++ b/lemur/__about__.py @@ -0,0 +1,18 @@ +from __future__ import absolute_import, division, print_function + +__all__ = [ + "__title__", "__summary__", "__uri__", "__version__", "__author__", + "__email__", "__license__", "__copyright__", +] + +__title__ = "lemur" +__summary__ = ("Certificate management and orchestration service") +__uri__ = "https://github.com/Netflix/lemur" + +__version__ = "0.2" + +__author__ = "The Lemur developers" +__email__ = "security@netflix.com" + +__license__ = "Apache License, Version 2.0" +__copyright__ = "Copyright 2015 {0}".format(__author__) diff --git a/lemur/__init__.py b/lemur/__init__.py index 79b45241..5ceed3ea 100644 --- a/lemur/__init__.py +++ b/lemur/__init__.py @@ -8,6 +8,8 @@ """ +from __future__ import absolute_import, division, print_function + from lemur import factory from lemur.users.views import mod as users_bp @@ -22,6 +24,16 @@ from lemur.plugins.views import mod as plugins_bp from lemur.notifications.views import mod as notifications_bp from lemur.sources.views import mod as sources_bp +from lemur.__about__ import ( + __author__, __copyright__, __email__, __license__, __summary__, __title__, + __uri__, __version__ +) + + +__all__ = [ + "__title__", "__summary__", "__uri__", "__version__", "__author__", + "__email__", "__license__", "__copyright__", +] LEMUR_BLUEPRINTS = ( users_bp, diff --git a/setup.py b/setup.py index 9ed80255..68b94089 100644 --- a/setup.py +++ b/setup.py @@ -9,6 +9,7 @@ Is a TLS management and orchestration tool. """ from __future__ import absolute_import +import sys import json import os.path import datetime @@ -21,10 +22,17 @@ from setuptools.command.sdist import sdist from setuptools import setup, find_packages from subprocess import check_output -from version import get_version - ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__))) +# When executing the setup.py, we need to be able to import ourselves, this +# means that we need to add the src/ directory to the sys.path. +sys.path.insert(0, ROOT) + +about = {} +with open(os.path.join(ROOT, "lemur", "__about__.py")) as f: + exec(f.read(), about) + + install_requires = [ 'Flask==0.10.1', 'Flask-RESTful==0.3.3', @@ -125,13 +133,12 @@ class BuildStatic(Command): log.warn("Unable to build static content") setup( - name='lemur', - version=get_version(), - author='Kevin Glisson', - author_email='kglisson@netflix.com', - url='https://github.com/netflix/lemur', - download_url='https://github.com/Netflix/lemur/archive/{0}.tar.gz'.format(get_version()), - description='Certificate management and orchestration service', + name=about["__title__"], + version=about["__version__"], + author=about["__author__"], + author_email=about["__email__"], + url=about["__uri__"], + description=about["__summary__"], long_description=open(os.path.join(ROOT, 'README.rst')).read(), packages=find_packages(), include_package_data=True, @@ -164,6 +171,12 @@ setup( 'Intended Audience :: Developers', 'Intended Audience :: System Administrators', 'Operating System :: OS Independent', - 'Topic :: Software Development' + 'Topic :: Software Development', + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", + "Natural Language :: English", + "License :: OSI Approved :: Apache Software License" ] ) diff --git a/version.py b/version.py deleted file mode 100644 index 9e02db92..00000000 --- a/version.py +++ /dev/null @@ -1,45 +0,0 @@ -# Source: https://github.com/Changaco/version.py - -from os.path import dirname, isdir, join -import re -from subprocess import CalledProcessError, check_output - - -PREFIX = '' - -tag_re = re.compile(r'\btag: %s([0-9][^,]*)\b' % PREFIX) -version_re = re.compile('^Version: (.+)$', re.M) - - -def get_version(): - # Return the version if it has been injected into the file by git-archive - version = tag_re.search('$Format:%D$') - if version: - return version.group(1) - - d = dirname(__file__) - - if isdir(join(d, '.git')): - # Get the version using "git describe". - cmd = 'git describe --tags --match %s[0-9]* --dirty' % PREFIX - try: - version = check_output(cmd.split()).decode().strip()[len(PREFIX):] - except CalledProcessError: - raise RuntimeError('Unable to get version number from git tags') - - # PEP 440 compatibility - if '-' in version: - if version.endswith('-dirty'): - raise RuntimeError('The working tree is dirty') - version = '.post'.join(version.split('-')[:2]) - - else: - # Extract the version from the PKG-INFO file. - with open(join(d, 'PKG-INFO')) as f: - version = version_re.search(f.read()).group(1) - - return version - - -if __name__ == '__main__': - print(get_version())