update oslo libraries

Change-Id: I7eb0adfbb6bc86157c3e3b969c00099dd8cfe315
Related-Bug: #1227495
This commit is contained in:
fujioka yuuichi
2013-10-28 08:43:58 +09:00
parent 4b7a633623
commit f9be914ee4
3 changed files with 19 additions and 45 deletions

View File

@@ -24,7 +24,7 @@ import traceback
def import_class(import_str): def import_class(import_str):
"""Returns a class from a string including module and class""" """Returns a class from a string including module and class."""
mod_str, _sep, class_str = import_str.rpartition('.') mod_str, _sep, class_str = import_str.rpartition('.')
try: try:
__import__(mod_str) __import__(mod_str)
@@ -41,8 +41,9 @@ def import_object(import_str, *args, **kwargs):
def import_object_ns(name_space, import_str, *args, **kwargs): def import_object_ns(name_space, import_str, *args, **kwargs):
""" """Tries to import object from default namespace.
Import a class and return an instance of it, first by trying
Imports a class and return an instance of it, first by trying
to find the class in a default namespace, then failing back to to find the class in a default namespace, then failing back to
a full path if not found in the default namespace. a full path if not found in the default namespace.
""" """

View File

@@ -24,7 +24,9 @@ import six
if six.PY3: if six.PY3:
# python3 # python3
import urllib.error
import urllib.parse import urllib.parse
import urllib.request
urlencode = urllib.parse.urlencode urlencode = urllib.parse.urlencode
urljoin = urllib.parse.urljoin urljoin = urllib.parse.urljoin
@@ -34,9 +36,14 @@ if six.PY3:
urlparse = urllib.parse.urlparse urlparse = urllib.parse.urlparse
urlsplit = urllib.parse.urlsplit urlsplit = urllib.parse.urlsplit
urlunsplit = urllib.parse.urlunsplit urlunsplit = urllib.parse.urlunsplit
urlopen = urllib.request.urlopen
URLError = urllib.error.URLError
pathname2url = urllib.request.pathname2url
else: else:
# python2 # python2
import urllib import urllib
import urllib2
import urlparse import urlparse
urlencode = urllib.urlencode urlencode = urllib.urlencode
@@ -49,3 +56,7 @@ else:
urlparse = parse.urlparse urlparse = parse.urlparse
urlsplit = parse.urlsplit urlsplit = parse.urlsplit
urlunsplit = parse.urlunsplit urlunsplit = parse.urlunsplit
urlopen = urllib2.urlopen
URLError = urllib2.URLError
pathname2url = urllib.pathname2url

View File

@@ -114,15 +114,12 @@ class InstallVenv(object):
print('Installing dependencies with pip (this can take a while)...') print('Installing dependencies with pip (this can take a while)...')
# First things first, make sure our venv has the latest pip and # First things first, make sure our venv has the latest pip and
# setuptools. # setuptools and pbr
self.pip_install('pip>=1.3') self.pip_install('pip>=1.4')
self.pip_install('setuptools') self.pip_install('setuptools')
self.pip_install('pbr')
self.pip_install('-r', self.requirements) self.pip_install('-r', self.requirements, '-r', self.test_requirements)
self.pip_install('-r', self.test_requirements)
def post_process(self):
self.get_distro().post_process()
def parse_args(self, argv): def parse_args(self, argv):
"""Parses command-line arguments.""" """Parses command-line arguments."""
@@ -156,14 +153,6 @@ class Distro(InstallVenv):
' requires virtualenv, please install it using your' ' requires virtualenv, please install it using your'
' favorite package management tool' % self.project) ' favorite package management tool' % self.project)
def post_process(self):
"""Any distribution-specific post-processing gets done here.
In particular, this is useful for applying patches to code inside
the venv.
"""
pass
class Fedora(Distro): class Fedora(Distro):
"""This covers all Fedora-based distributions. """This covers all Fedora-based distributions.
@@ -175,10 +164,6 @@ class Fedora(Distro):
return self.run_command_with_code(['rpm', '-q', pkg], return self.run_command_with_code(['rpm', '-q', pkg],
check_exit_code=False)[1] == 0 check_exit_code=False)[1] == 0
def apply_patch(self, originalfile, patchfile):
self.run_command(['patch', '-N', originalfile, patchfile],
check_exit_code=False)
def install_virtualenv(self): def install_virtualenv(self):
if self.check_cmd('virtualenv'): if self.check_cmd('virtualenv'):
return return
@@ -187,26 +172,3 @@ class Fedora(Distro):
self.die("Please install 'python-virtualenv'.") self.die("Please install 'python-virtualenv'.")
super(Fedora, self).install_virtualenv() super(Fedora, self).install_virtualenv()
def post_process(self):
"""Workaround for a bug in eventlet.
This currently affects RHEL6.1, but the fix can safely be
applied to all RHEL and Fedora distributions.
This can be removed when the fix is applied upstream.
Nova: https://bugs.launchpad.net/nova/+bug/884915
Upstream: https://bitbucket.org/eventlet/eventlet/issue/89
RHEL: https://bugzilla.redhat.com/958868
"""
# Install "patch" program if it's not there
if not self.check_pkg('patch'):
self.die("Please install 'patch'.")
# Apply the eventlet patch
self.apply_patch(os.path.join(self.venv, 'lib', self.py_version,
'site-packages',
'eventlet/green/subprocess.py'),
'contrib/redhat-eventlet.patch')