Merge pull request #481 from corteva/add-pip3-plugin

Added pip3 plugin
This commit is contained in:
Anders Ingemann 2018-06-14 17:36:47 +02:00 committed by GitHub
commit 67720d9e4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 74 additions and 2 deletions

View file

@ -0,0 +1,14 @@
Pip3 install
------------
Install packages from the Python Package Index via pip for python3
Installs ``build-essential`` and ``python3-dev`` debian packages, so
Python extension modules can be built.
Settings
~~~~~~~~
- ``packages``: Python packages to install, a list of strings. The list
can contain anything that ``pip install`` would accept as an
argument, for example ``awscli==1.3.13``.

View file

@ -0,0 +1,11 @@
from . import tasks
def validate_manifest(data, validator, error):
from bootstrapvz.common.tools import rel_path
validator(data, rel_path(__file__, 'manifest-schema.yml'))
def resolve_tasks(taskset, manifest):
taskset.add(tasks.AddPip3Package)
taskset.add(tasks.Pip3InstallCommand)

View file

@ -0,0 +1,18 @@
---
$schema: http://json-schema.org/draft-04/schema#
title: Pip3 install plugin manifest
type: object
properties:
plugins:
type: object
properties:
pip_install:
type: object
properties:
packages:
type: array
items:
type: string
minItems: 1
uniqueItems: true
additionalProperties: false

View file

@ -0,0 +1,25 @@
from bootstrapvz.base import Task
from bootstrapvz.common import phases
class AddPip3Package(Task):
description = 'Adding `pip\' and Co. to the image packages'
phase = phases.preparation
@classmethod
def run(cls, info):
for package_name in ('build-essential', 'python3-dev', 'python3-pip'):
info.packages.add(package_name)
class Pip3InstallCommand(Task):
description = 'Install python packages from pypi with pip'
phase = phases.system_modification
@classmethod
def run(cls, info):
from bootstrapvz.common.tools import log_check_call
packages = info.manifest.plugins['pip3_install']['packages']
pip_install_command = ['chroot', info.root, 'pip3', 'install']
pip_install_command.extend(packages)
log_check_call(pip_install_command)

View file

@ -72,5 +72,6 @@ class EBSVolume(Volume):
self.snap_id = snapshot['SnapshotId']
waiter = self.conn.get_waiter('snapshot_completed')
waiter.wait(SnapshotIds=[self.snap_id],
Filters=[{'Name': 'status', 'Values': ['completed']}])
Filters=[{'Name': 'status', 'Values': ['completed']}],
WaiterConfig={'Delay': 15, 'MaxAttempts': 120})
return self.snap_id

View file

@ -89,9 +89,12 @@ class InstallEnhancedNetworking(Task):
@classmethod
def run(cls, info):
from bootstrapvz.common.releases import stretch
# It appears the latest version will always get a prefix of 18700.
# Once a new version is released, the url int prefix will change (no redirects)
# to something above the 2nd most recent release. You've been warned.
if info.manifest.release >= stretch:
version = '4.3.4'
drivers_url = 'https://downloadmirror.intel.com/18700/eng/ixgbevf-4.3.4.tar.gz'
drivers_url = 'https://downloadmirror.intel.com/27874/eng/ixgbevf-4.3.4.tar.gz'
else:
version = '3.2.2'
drivers_url = 'https://downloadmirror.intel.com/26561/eng/ixgbevf-3.2.2.tar.gz'