Adjust pip adjustment function + remove unused dependencies.
This commit is contained in:
parent
7fa6e7b4a9
commit
f587925899
@ -426,34 +426,26 @@ class PythonInstallComponent(PkgInstallComponent):
|
||||
p_bar.update(i + 1)
|
||||
|
||||
def _clean_pip_requires(self):
|
||||
# Fixup these files if they exist (sometimes they have 'junk' in them)
|
||||
req_fns = []
|
||||
for fn in self.requires_files:
|
||||
if not sh.isfile(fn):
|
||||
continue
|
||||
req_fns.append(fn)
|
||||
# Fixup these files if they exist, sometimes they have 'junk' in them
|
||||
# that anvil will install instead of pip or setup.py and we don't want
|
||||
# the setup.py file to attempt to install said dependencies since it
|
||||
# typically picks locations that either are not what we desire or if
|
||||
# said file contains editables, it may even pick external source directories
|
||||
# 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:
|
||||
utils.log_iterable(req_fns, logger=LOG,
|
||||
header="Adjusting %s pip 'requires' files" % (len(req_fns)))
|
||||
for fn in req_fns:
|
||||
new_lines = []
|
||||
for line in sh.load_file(fn).splitlines():
|
||||
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)
|
||||
old_lines = sh.load_file(fn).splitlines()
|
||||
new_lines = self._filter_pip_requires(fn, old_lines)
|
||||
contents = "# Cleaned on %s\n\n%s\n" % (utils.iso8601(), "\n".join(new_lines))
|
||||
sh.write_file_and_backup(fn, contents)
|
||||
return len(req_fns)
|
||||
|
||||
def _filter_pip_requires_line(self, fn, line):
|
||||
# Return none to filter or the line itself to leave alone...
|
||||
return line
|
||||
def _filter_pip_requires(self, fn, lines):
|
||||
# The default does no filtering except to ensure that said lines are valid...
|
||||
return lines
|
||||
|
||||
def pre_install(self):
|
||||
self._verify_pip_requires()
|
||||
|
@ -69,10 +69,18 @@ class GlanceInstaller(comp.PythonInstallComponent):
|
||||
def config_files(self):
|
||||
return list(CONFIGS)
|
||||
|
||||
def _filter_pip_requires_line(self, fn, line):
|
||||
if utils.has_any(line.lower(), 'swift', 'keystoneclient'):
|
||||
return None
|
||||
return 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'):
|
||||
continue
|
||||
elif line.strip().startswith("-e"):
|
||||
continue
|
||||
else:
|
||||
new_lines.append(line)
|
||||
return new_lines
|
||||
|
||||
def pre_install(self):
|
||||
comp.PythonInstallComponent.pre_install(self)
|
||||
|
@ -18,10 +18,8 @@ from anvil import components as comp
|
||||
|
||||
|
||||
class GlanceClientInstaller(comp.PythonInstallComponent):
|
||||
def _filter_pip_requires_line(self, fn, line):
|
||||
if line.lower().find('keystoneclient') != -1:
|
||||
return None
|
||||
return line
|
||||
def _filter_pip_requires(self, fn, lines):
|
||||
return [l for l in lines if l.lower().find('keystoneclient') == -1]
|
||||
|
||||
|
||||
class GlanceClientTester(comp.PythonTestingComponent):
|
||||
|
@ -66,13 +66,11 @@ class HorizonInstaller(comp.PythonInstallComponent):
|
||||
self.distro.get_command_config('apache', 'name'),
|
||||
'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
|
||||
# clients since anvil will be making sure those are installed
|
||||
# instead of asking pip to do it...
|
||||
if re.search(r'([n|q|s|k|g|c]\w+client)', line, re.I):
|
||||
return None
|
||||
return line
|
||||
# instead of asking setup.py to do it...
|
||||
return [l for l in lines if not re.search(r'([n|q|s|k|g|c]\w+client)', l, re.I)]
|
||||
|
||||
def verify(self):
|
||||
comp.PythonInstallComponent.verify(self)
|
||||
|
@ -70,10 +70,10 @@ class KeystoneInstaller(comp.PythonInstallComponent):
|
||||
comp.PythonInstallComponent.__init__(self, *args, **kargs)
|
||||
self.bin_dir = sh.joinpths(self.get_option('app_dir'), 'bin')
|
||||
|
||||
def _filter_pip_requires_line(self, fn, line):
|
||||
if utils.has_any(line.lower(), 'keystoneclient', 'ldap', 'http://tarballs.openstack.org', 'memcached'):
|
||||
return None
|
||||
return line
|
||||
def _filter_pip_requires(self, fn, lines):
|
||||
return [l for l in lines
|
||||
if not utils.has_any(l.lower(), 'keystoneclient',
|
||||
'ldap', 'http://tarballs.openstack.org', 'memcached')]
|
||||
|
||||
def post_install(self):
|
||||
comp.PythonInstallComponent.post_install(self)
|
||||
|
@ -114,11 +114,10 @@ class NovaInstaller(comp.PythonInstallComponent):
|
||||
def config_files(self):
|
||||
return list(CONFIGS)
|
||||
|
||||
def _filter_pip_requires_line(self, fn, line):
|
||||
# We handle these ourselves in anvil
|
||||
if utils.has_any(line.lower(), 'quantumclient', 'cinder', 'glance', 'ldap', 'keystoneclient'):
|
||||
return None
|
||||
return line
|
||||
def _filter_pip_requires(self, fn, lines):
|
||||
return [l for l in lines
|
||||
if not utils.has_any(l.lower(), 'quantumclient',
|
||||
'cinder', 'glance', 'ldap', 'keystoneclient')]
|
||||
|
||||
@property
|
||||
def env_exports(self):
|
||||
|
@ -15,17 +15,14 @@
|
||||
# under the License.
|
||||
|
||||
from anvil import components as comp
|
||||
from anvil import utils
|
||||
|
||||
|
||||
class OpenStackClientInstaller(comp.PythonInstallComponent):
|
||||
def _filter_pip_requires_line(self, fn, line):
|
||||
if line.lower().find('keystoneclient') != -1:
|
||||
return None
|
||||
if line.lower().find('novaclient') != -1:
|
||||
return None
|
||||
if line.lower().find('glanceclient') != -1:
|
||||
return None
|
||||
return line
|
||||
def _filter_pip_requires(self, fn, lines):
|
||||
return [l for l in lines
|
||||
if not utils.has_any(l.lower(),
|
||||
'keystoneclient', 'novaclient', 'glanceclient')]
|
||||
|
||||
|
||||
class OpenStackClientTester(comp.PythonTestingComponent):
|
||||
|
@ -15,10 +15,10 @@
|
||||
# under the License.
|
||||
|
||||
from anvil import components as comp
|
||||
from anvil import utils
|
||||
|
||||
|
||||
class SwiftClientInstaller(comp.PythonInstallComponent):
|
||||
def _filter_pip_requires_line(self, fn, line):
|
||||
if line.lower().find('keystoneclient') != -1:
|
||||
return None
|
||||
return line
|
||||
def _filter_pip_requires(self, fn, lines):
|
||||
return [l for l in lines
|
||||
if not utils.has_any(l.lower(), 'keystoneclient')]
|
||||
|
@ -408,9 +408,6 @@ components:
|
||||
- name: suds
|
||||
package:
|
||||
name: python-suds
|
||||
- name: paramiko
|
||||
package:
|
||||
name: python-paramiko
|
||||
- name: feedparser
|
||||
package:
|
||||
name: python-feedparser
|
||||
@ -418,9 +415,8 @@ components:
|
||||
package:
|
||||
name: MySQL-python
|
||||
pips:
|
||||
- name: Cheetah
|
||||
version: "2.4.4"
|
||||
- name: fixtures # Seems for testing only
|
||||
# Seems for testing only??
|
||||
- name: fixtures
|
||||
subsystems:
|
||||
compute:
|
||||
packages:
|
||||
|
Loading…
x
Reference in New Issue
Block a user