mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 09:50:37 +00:00
Added pip3_plugin
This commit is contained in:
parent
ad02412b96
commit
ba263e475d
4 changed files with 68 additions and 0 deletions
14
bootstrapvz/plugins/pip3_install/README.rst
Normal file
14
bootstrapvz/plugins/pip3_install/README.rst
Normal 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``.
|
11
bootstrapvz/plugins/pip3_install/__init__.py
Normal file
11
bootstrapvz/plugins/pip3_install/__init__.py
Normal 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)
|
18
bootstrapvz/plugins/pip3_install/manifest-schema.yml
Normal file
18
bootstrapvz/plugins/pip3_install/manifest-schema.yml
Normal 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
|
25
bootstrapvz/plugins/pip3_install/tasks.py
Normal file
25
bootstrapvz/plugins/pip3_install/tasks.py
Normal 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)
|
Loading…
Add table
Reference in a new issue