Adjust pip adjustment function + remove unused dependencies.

This commit is contained in:
Joshua Harlow 2012-12-06 17:57:03 -08:00
parent 7fa6e7b4a9
commit f587925899
9 changed files with 48 additions and 60 deletions

View File

@ -426,34 +426,26 @@ class PythonInstallComponent(PkgInstallComponent):
p_bar.update(i + 1) p_bar.update(i + 1)
def _clean_pip_requires(self): def _clean_pip_requires(self):
# Fixup these files if they exist (sometimes they have 'junk' in them) # Fixup these files if they exist, sometimes they have 'junk' in them
req_fns = [] # that anvil will install instead of pip or setup.py and we don't want
for fn in self.requires_files: # the setup.py file to attempt to install said dependencies since it
if not sh.isfile(fn): # typically picks locations that either are not what we desire or if
continue # said file contains editables, it may even pick external source directories
req_fns.append(fn) # which is what anvil is setting up as well...
req_fns = [f for f in self.requires_files if sh.isfile(f)]
if req_fns: if req_fns:
utils.log_iterable(req_fns, logger=LOG, utils.log_iterable(req_fns, logger=LOG,
header="Adjusting %s pip 'requires' files" % (len(req_fns))) header="Adjusting %s pip 'requires' files" % (len(req_fns)))
for fn in req_fns: for fn in req_fns:
new_lines = [] old_lines = sh.load_file(fn).splitlines()
for line in sh.load_file(fn).splitlines(): new_lines = self._filter_pip_requires(fn, old_lines)
s_line = line.strip()
if len(s_line) == 0:
continue
elif s_line.startswith("#"):
new_lines.append(s_line)
elif not self._filter_pip_requires_line(fn, s_line):
new_lines.append(("# %s" % (s_line)))
else:
new_lines.append(s_line)
contents = "# Cleaned on %s\n\n%s\n" % (utils.iso8601(), "\n".join(new_lines)) contents = "# Cleaned on %s\n\n%s\n" % (utils.iso8601(), "\n".join(new_lines))
sh.write_file_and_backup(fn, contents) sh.write_file_and_backup(fn, contents)
return len(req_fns) return len(req_fns)
def _filter_pip_requires_line(self, fn, line): def _filter_pip_requires(self, fn, lines):
# Return none to filter or the line itself to leave alone... # The default does no filtering except to ensure that said lines are valid...
return line return lines
def pre_install(self): def pre_install(self):
self._verify_pip_requires() self._verify_pip_requires()

View File

@ -69,10 +69,18 @@ class GlanceInstaller(comp.PythonInstallComponent):
def config_files(self): def config_files(self):
return list(CONFIGS) return list(CONFIGS)
def _filter_pip_requires_line(self, fn, line): def _filter_pip_requires(self, fn, lines):
new_lines = []
for line in lines:
# Anvil handles installing these if needed
# and not setup.py
if utils.has_any(line.lower(), 'swift', 'keystoneclient'): if utils.has_any(line.lower(), 'swift', 'keystoneclient'):
return None continue
return line elif line.strip().startswith("-e"):
continue
else:
new_lines.append(line)
return new_lines
def pre_install(self): def pre_install(self):
comp.PythonInstallComponent.pre_install(self) comp.PythonInstallComponent.pre_install(self)

View File

@ -18,10 +18,8 @@ from anvil import components as comp
class GlanceClientInstaller(comp.PythonInstallComponent): class GlanceClientInstaller(comp.PythonInstallComponent):
def _filter_pip_requires_line(self, fn, line): def _filter_pip_requires(self, fn, lines):
if line.lower().find('keystoneclient') != -1: return [l for l in lines if l.lower().find('keystoneclient') == -1]
return None
return line
class GlanceClientTester(comp.PythonTestingComponent): class GlanceClientTester(comp.PythonTestingComponent):

View File

@ -66,13 +66,11 @@ class HorizonInstaller(comp.PythonInstallComponent):
self.distro.get_command_config('apache', 'name'), self.distro.get_command_config('apache', 'name'),
'horizon_error.log') 'horizon_error.log')
def _filter_pip_requires_line(self, fn, line): def _filter_pip_requires(self, fn, lines):
# Knock off all nova, quantum, swift, keystone, cinder # Knock off all nova, quantum, swift, keystone, cinder
# clients since anvil will be making sure those are installed # clients since anvil will be making sure those are installed
# instead of asking pip to do it... # instead of asking setup.py to do it...
if re.search(r'([n|q|s|k|g|c]\w+client)', line, re.I): return [l for l in lines if not re.search(r'([n|q|s|k|g|c]\w+client)', l, re.I)]
return None
return line
def verify(self): def verify(self):
comp.PythonInstallComponent.verify(self) comp.PythonInstallComponent.verify(self)

View File

@ -70,10 +70,10 @@ class KeystoneInstaller(comp.PythonInstallComponent):
comp.PythonInstallComponent.__init__(self, *args, **kargs) comp.PythonInstallComponent.__init__(self, *args, **kargs)
self.bin_dir = sh.joinpths(self.get_option('app_dir'), 'bin') self.bin_dir = sh.joinpths(self.get_option('app_dir'), 'bin')
def _filter_pip_requires_line(self, fn, line): def _filter_pip_requires(self, fn, lines):
if utils.has_any(line.lower(), 'keystoneclient', 'ldap', 'http://tarballs.openstack.org', 'memcached'): return [l for l in lines
return None if not utils.has_any(l.lower(), 'keystoneclient',
return line 'ldap', 'http://tarballs.openstack.org', 'memcached')]
def post_install(self): def post_install(self):
comp.PythonInstallComponent.post_install(self) comp.PythonInstallComponent.post_install(self)

View File

@ -114,11 +114,10 @@ class NovaInstaller(comp.PythonInstallComponent):
def config_files(self): def config_files(self):
return list(CONFIGS) return list(CONFIGS)
def _filter_pip_requires_line(self, fn, line): def _filter_pip_requires(self, fn, lines):
# We handle these ourselves in anvil return [l for l in lines
if utils.has_any(line.lower(), 'quantumclient', 'cinder', 'glance', 'ldap', 'keystoneclient'): if not utils.has_any(l.lower(), 'quantumclient',
return None 'cinder', 'glance', 'ldap', 'keystoneclient')]
return line
@property @property
def env_exports(self): def env_exports(self):

View File

@ -15,17 +15,14 @@
# under the License. # under the License.
from anvil import components as comp from anvil import components as comp
from anvil import utils
class OpenStackClientInstaller(comp.PythonInstallComponent): class OpenStackClientInstaller(comp.PythonInstallComponent):
def _filter_pip_requires_line(self, fn, line): def _filter_pip_requires(self, fn, lines):
if line.lower().find('keystoneclient') != -1: return [l for l in lines
return None if not utils.has_any(l.lower(),
if line.lower().find('novaclient') != -1: 'keystoneclient', 'novaclient', 'glanceclient')]
return None
if line.lower().find('glanceclient') != -1:
return None
return line
class OpenStackClientTester(comp.PythonTestingComponent): class OpenStackClientTester(comp.PythonTestingComponent):

View File

@ -15,10 +15,10 @@
# under the License. # under the License.
from anvil import components as comp from anvil import components as comp
from anvil import utils
class SwiftClientInstaller(comp.PythonInstallComponent): class SwiftClientInstaller(comp.PythonInstallComponent):
def _filter_pip_requires_line(self, fn, line): def _filter_pip_requires(self, fn, lines):
if line.lower().find('keystoneclient') != -1: return [l for l in lines
return None if not utils.has_any(l.lower(), 'keystoneclient')]
return line

View File

@ -408,9 +408,6 @@ components:
- name: suds - name: suds
package: package:
name: python-suds name: python-suds
- name: paramiko
package:
name: python-paramiko
- name: feedparser - name: feedparser
package: package:
name: python-feedparser name: python-feedparser
@ -418,9 +415,8 @@ components:
package: package:
name: MySQL-python name: MySQL-python
pips: pips:
- name: Cheetah # Seems for testing only??
version: "2.4.4" - name: fixtures
- name: fixtures # Seems for testing only
subsystems: subsystems:
compute: compute:
packages: packages: