summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openstack/common/cfg.py2
-rw-r--r--openstack/common/extensions.py4
-rw-r--r--openstack/common/loopingcall.py2
-rw-r--r--openstack/common/periodic_task.py2
-rw-r--r--openstack/common/rpc/impl_kombu.py2
-rw-r--r--openstack/common/service.py2
-rw-r--r--openstack/common/setup.py8
-rw-r--r--openstack/common/threadgroup.py4
-rw-r--r--openstack/common/utils.py2
-rw-r--r--openstack/common/wsgi.py2
-rw-r--r--pypi/README2
-rw-r--r--pypi/oslo/__init__.py3
-rw-r--r--pypi/setup.py43
-rw-r--r--tests/unit/test_cfg.py8
14 files changed, 72 insertions, 14 deletions
diff --git a/openstack/common/cfg.py b/openstack/common/cfg.py
index bbef49b..5adbb9a 100644
--- a/openstack/common/cfg.py
+++ b/openstack/common/cfg.py
@@ -1507,7 +1507,7 @@ class ConfigOpts(collections.Mapping):
if ('default' in info or 'override' in info):
continue
- if self._get(opt.name, group) is None:
+ if self._get(opt.dest, group) is None:
raise RequiredOptError(opt.name, group)
def _parse_cli_opts(self, args):
diff --git a/openstack/common/extensions.py b/openstack/common/extensions.py
index 742c4f2..906906d 100644
--- a/openstack/common/extensions.py
+++ b/openstack/common/extensions.py
@@ -17,12 +17,12 @@
# under the License.
import imp
+import logging
+from lxml import etree
import os
import routes
import webob.dec
import webob.exc
-import logging
-from lxml import etree
from openstack.common import exception
from openstack.common.gettextutils import _
diff --git a/openstack/common/loopingcall.py b/openstack/common/loopingcall.py
index ede3dae..36a533c 100644
--- a/openstack/common/loopingcall.py
+++ b/openstack/common/loopingcall.py
@@ -22,8 +22,8 @@ import sys
from eventlet import event
from eventlet import greenthread
-from openstack.common import log as logging
from openstack.common.gettextutils import _
+from openstack.common import log as logging
LOG = logging.getLogger(__name__)
diff --git a/openstack/common/periodic_task.py b/openstack/common/periodic_task.py
index 5cf2ade..edfee9b 100644
--- a/openstack/common/periodic_task.py
+++ b/openstack/common/periodic_task.py
@@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-from openstack.common import log as logging
from openstack.common.gettextutils import _
+from openstack.common import log as logging
LOG = logging.getLogger(__name__)
diff --git a/openstack/common/rpc/impl_kombu.py b/openstack/common/rpc/impl_kombu.py
index a44a000..eccb7ab 100644
--- a/openstack/common/rpc/impl_kombu.py
+++ b/openstack/common/rpc/impl_kombu.py
@@ -31,9 +31,9 @@ import kombu.messaging
from openstack.common import cfg
from openstack.common.gettextutils import _
+from openstack.common import network_utils
from openstack.common.rpc import amqp as rpc_amqp
from openstack.common.rpc import common as rpc_common
-from openstack.common import network_utils
kombu_opts = [
cfg.StrOpt('kombu_ssl_version',
diff --git a/openstack/common/service.py b/openstack/common/service.py
index 5630035..05060ca 100644
--- a/openstack/common/service.py
+++ b/openstack/common/service.py
@@ -32,9 +32,9 @@ import logging as std_logging
from openstack.common import cfg
from openstack.common import eventlet_backdoor
+from openstack.common.gettextutils import _
from openstack.common import log as logging
from openstack.common import threadgroup
-from openstack.common.gettextutils import _
try:
from openstack.common import rpc
diff --git a/openstack/common/setup.py b/openstack/common/setup.py
index 4e2a577..83eef07 100644
--- a/openstack/common/setup.py
+++ b/openstack/common/setup.py
@@ -136,15 +136,17 @@ def _get_git_next_version_suffix(branch_name):
_run_shell_command("git fetch origin +refs/meta/*:refs/remotes/meta/*")
milestone_cmd = "git show meta/openstack/release:%s" % branch_name
milestonever = _run_shell_command(milestone_cmd)
- if not milestonever:
- milestonever = ""
+ if milestonever:
+ first_half = "%s~%s" % (milestonever, datestamp)
+ else:
+ first_half = datestamp
+
post_version = _get_git_post_version()
# post version should look like:
# 0.1.1.4.gcc9e28a
# where the bit after the last . is the short sha, and the bit between
# the last and second to last is the revno count
(revno, sha) = post_version.split(".")[-2:]
- first_half = "%s~%s" % (milestonever, datestamp)
second_half = "%s%s.%s" % (revno_prefix, revno, sha)
return ".".join((first_half, second_half))
diff --git a/openstack/common/threadgroup.py b/openstack/common/threadgroup.py
index a9dfa5e..ebc066a 100644
--- a/openstack/common/threadgroup.py
+++ b/openstack/common/threadgroup.py
@@ -17,12 +17,12 @@ import os
import sys
from eventlet import event
-from eventlet import greenthread
from eventlet import greenpool
+from eventlet import greenthread
-from openstack.common import loopingcall
from openstack.common.gettextutils import _
from openstack.common import log as logging
+from openstack.common import loopingcall
LOG = logging.getLogger(__name__)
diff --git a/openstack/common/utils.py b/openstack/common/utils.py
index 74c571d..220b49e 100644
--- a/openstack/common/utils.py
+++ b/openstack/common/utils.py
@@ -23,8 +23,8 @@ import logging
import random
import shlex
-from eventlet import greenthread
from eventlet.green import subprocess
+from eventlet import greenthread
from openstack.common import exception
from openstack.common.gettextutils import _
diff --git a/openstack/common/wsgi.py b/openstack/common/wsgi.py
index 52133a8..614a22c 100644
--- a/openstack/common/wsgi.py
+++ b/openstack/common/wsgi.py
@@ -33,8 +33,8 @@ from xml.parsers import expat
from openstack.common import exception
from openstack.common.gettextutils import _
-from openstack.common import log as logging
from openstack.common import jsonutils
+from openstack.common import log as logging
from openstack.common import service
diff --git a/pypi/README b/pypi/README
new file mode 100644
index 0000000..174dc4d
--- /dev/null
+++ b/pypi/README
@@ -0,0 +1,2 @@
+This directory is just here to hold the setup.py used to register the
+Oslo name on PyPI, to avoid project name collisions.
diff --git a/pypi/oslo/__init__.py b/pypi/oslo/__init__.py
new file mode 100644
index 0000000..9d3b5b4
--- /dev/null
+++ b/pypi/oslo/__init__.py
@@ -0,0 +1,3 @@
+"""Declare namespace package"""
+
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/pypi/setup.py b/pypi/setup.py
new file mode 100644
index 0000000..0183bc0
--- /dev/null
+++ b/pypi/setup.py
@@ -0,0 +1,43 @@
+#!/usr/bin/python
+# -*- encoding: utf-8 -*-
+# Copyright (c) 2012 OpenStack, LLC.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import setuptools
+
+setuptools.setup(
+ name='oslo',
+ version='1',
+ description="Namespace for common components for Openstack",
+ long_description="Namespace for common components for Openstack",
+ classifiers=[
+ 'Development Status :: 4 - Beta',
+ 'License :: OSI Approved :: Apache Software License',
+ 'Operating System :: POSIX :: Linux',
+ 'Programming Language :: Python :: 2.6',
+ 'Programming Language :: Python :: 2.7',
+ 'Environment :: No Input/Output (Daemon)',
+ 'Environment :: OpenStack',
+ ],
+ keywords='openstack',
+ author='OpenStack',
+ author_email='openstack@lists.launchpad.net',
+ url='http://www.openstack.org/',
+ license='Apache Software License',
+ zip_safe=True,
+ packages=setuptools.find_packages(exclude=['ez_setup',
+ 'examples', 'tests']),
+ namespace_packages=['oslo'],
+)
diff --git a/tests/unit/test_cfg.py b/tests/unit/test_cfg.py
index e58f12c..b356fa5 100644
--- a/tests/unit/test_cfg.py
+++ b/tests/unit/test_cfg.py
@@ -1189,6 +1189,14 @@ class RequiredOptsTestCase(BaseTestCase):
self.assertTrue(hasattr(self.conf, 'foo'))
self.assertEquals(self.conf.foo, 'bar')
+ def test_required_cli_opt_with_dash(self):
+ self.conf.register_cli_opt(StrOpt('foo-bar', required=True))
+
+ self.conf(['--foo-bar', 'baz'])
+
+ self.assertTrue(hasattr(self.conf, 'foo_bar'))
+ self.assertEquals(self.conf.foo_bar, 'baz')
+
def test_missing_required_opt(self):
self.conf.register_opt(StrOpt('foo', required=True))
self.assertRaises(RequiredOptError, self.conf, [])