Commit 5919726e authored by David Danier's avatar David Danier

First draft of pipenv version + changes local Taskfile to use pipenv

parent bf366831
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[packages]
pyyaml = ">=3.12"
termcolor = ">=1.1.0"
"jinja2" = ">=2.10"
markupsafe = ">=1.0"
[dev-packages]
"e1839a8" = {path = ".", editable = true}
[requires]
python_version = "3.6"
{
"_meta": {
"hash": {
"sha256": "dd079b765c77bcc6350fe94a4b5245866fa18998188a2f77737c04c43a7c57fc"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.6"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.python.org/simple",
"verify_ssl": true
}
]
},
"default": {
"jinja2": {
"hashes": [
"sha256:74c935a1b8bb9a3947c50a54766a969d4846290e1e788ea44c1392163723c3bd",
"sha256:f84be1bb0040caca4cea721fcbbbbd61f9be9464ca236387158b0feea01914a4"
],
"version": "==2.10"
},
"markupsafe": {
"hashes": [
"sha256:a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665"
],
"version": "==1.0"
},
"pyyaml": {
"hashes": [
"sha256:0c507b7f74b3d2dd4d1322ec8a94794927305ab4cebbe89cc47fe5e81541e6e8",
"sha256:16b20e970597e051997d90dc2cddc713a2876c47e3d92d59ee198700c5427736",
"sha256:3262c96a1ca437e7e4763e2843746588a965426550f3797a79fca9c6199c431f",
"sha256:326420cbb492172dec84b0f65c80942de6cedb5233c413dd824483989c000608",
"sha256:4474f8ea030b5127225b8894d626bb66c01cda098d47a2b0d3429b6700af9fd8",
"sha256:592766c6303207a20efc445587778322d7f73b161bd994f227adaa341ba212ab",
"sha256:5ac82e411044fb129bae5cfbeb3ba626acb2af31a8d17d175004b70862a741a7",
"sha256:5f84523c076ad14ff5e6c037fe1c89a7f73a3e04cf0377cb4d017014976433f3",
"sha256:827dc04b8fa7d07c44de11fabbc888e627fa8293b695e0f99cb544fdfa1bf0d1",
"sha256:b4c423ab23291d3945ac61346feeb9a0dc4184999ede5e7c43e1ffb975130ae6",
"sha256:bc6bced57f826ca7cb5125a10b23fd0f2fff3b7c4701d64c439a300ce665fff8",
"sha256:c01b880ec30b5a6e6aa67b09a2fe3fb30473008c85cd6a67359a1b15ed6d83a4",
"sha256:ca233c64c6e40eaa6c66ef97058cdc80e8d0157a443655baa1b2966e812807ca",
"sha256:e863072cdf4c72eebf179342c94e6989c67185842d9997960b3e69290b2fa269"
],
"version": "==3.12"
},
"termcolor": {
"hashes": [
"sha256:1d6d69ce66211143803fbc56652b41d73b4a400a2891d7bf7a1cdf4c02de613b"
],
"version": "==1.1.0"
}
},
"develop": {
"e1839a8": {
"editable": true,
"path": "."
},
"jinja2": {
"hashes": [
"sha256:74c935a1b8bb9a3947c50a54766a969d4846290e1e788ea44c1392163723c3bd",
"sha256:f84be1bb0040caca4cea721fcbbbbd61f9be9464ca236387158b0feea01914a4"
],
"version": "==2.10"
},
"markupsafe": {
"hashes": [
"sha256:a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665"
],
"version": "==1.0"
},
"pyyaml": {
"hashes": [
"sha256:0c507b7f74b3d2dd4d1322ec8a94794927305ab4cebbe89cc47fe5e81541e6e8",
"sha256:16b20e970597e051997d90dc2cddc713a2876c47e3d92d59ee198700c5427736",
"sha256:3262c96a1ca437e7e4763e2843746588a965426550f3797a79fca9c6199c431f",
"sha256:326420cbb492172dec84b0f65c80942de6cedb5233c413dd824483989c000608",
"sha256:4474f8ea030b5127225b8894d626bb66c01cda098d47a2b0d3429b6700af9fd8",
"sha256:592766c6303207a20efc445587778322d7f73b161bd994f227adaa341ba212ab",
"sha256:5ac82e411044fb129bae5cfbeb3ba626acb2af31a8d17d175004b70862a741a7",
"sha256:5f84523c076ad14ff5e6c037fe1c89a7f73a3e04cf0377cb4d017014976433f3",
"sha256:827dc04b8fa7d07c44de11fabbc888e627fa8293b695e0f99cb544fdfa1bf0d1",
"sha256:b4c423ab23291d3945ac61346feeb9a0dc4184999ede5e7c43e1ffb975130ae6",
"sha256:bc6bced57f826ca7cb5125a10b23fd0f2fff3b7c4701d64c439a300ce665fff8",
"sha256:c01b880ec30b5a6e6aa67b09a2fe3fb30473008c85cd6a67359a1b15ed6d83a4",
"sha256:ca233c64c6e40eaa6c66ef97058cdc80e8d0157a443655baa1b2966e812807ca",
"sha256:e863072cdf4c72eebf179342c94e6989c67185842d9997960b3e69290b2fa269"
],
"version": "==3.12"
},
"termcolor": {
"hashes": [
"sha256:1d6d69ce66211143803fbc56652b41d73b4a400a2891d7bf7a1cdf4c02de613b"
],
"version": "==1.1.0"
}
}
}
......@@ -7,6 +7,7 @@ MODULES = {
'test': 'b5.modules.test.TestModule',
'legacy': 'b5.modules.legacy.LegacyModule',
'virtualenv': 'b5.modules.virtualenv.VirtualenvModule',
'pipenv': 'b5.modules.pipenv.PipenvModule',
'npm': 'b5.modules.npm.NpmModule',
'composer': 'b5.modules.composer.ComposerModule',
'docker': 'b5.modules.docker.DockerModule',
......
import shlex
import os
from . import BaseModule
class PipenvModule(BaseModule):
'''Pipenv module
'''
DEFAULT_CONFIG = {
'base_path': '.',
'pipenv_bin': 'pipenv',
'pyenv_bin': 'pyenv',
}
def prepare_config(self):
self.config['base_path'] = os.path.realpath(os.path.join(
self.state.run_path,
self.config['base_path'],
))
def get_script(self):
script = [super(PipenvModule, self).get_script()]
script.append(self._script_config_vars())
script.append(self._script_function_source('install', '''
(
cd {base_path} && \\
{pipenv_bin} install --dev
)
'''.format(
base_path=shlex.quote(self.config['base_path']),
pipenv_bin=shlex.quote(self.config['pipenv_bin']),
name=self.name,
)))
script.append(self._script_function_source('update', '''
{name}:install
'''.format(
name=self.name,
)))
script.append(self._script_function_source('run', '''
(
local initial_path="$( pwd )"
cd "{base_path}" && \\
eval "$( {pyenv_bin} init - )" && \\
source "$( {pipenv_bin} --venv )/bin/activate" && \\
cd "$initial_path" && \\
"$@"
)
'''.format(
base_path=shlex.quote(self.config['base_path']),
pyenv_bin=self.config['pyenv_bin'],
pipenv_bin=self.config['pipenv_bin'],
)))
script.append(self._script_function_source('pipenv', '''
(
eval "$( {pyenv_bin} init - )" && \\
cd {base_path} && \\
{pipenv_bin} "$@"
)
'''.format(
base_path=shlex.quote(self.config['base_path']),
pyenv_bin=self.config['pyenv_bin'],
pipenv_bin=self.config['pipenv_bin'],
)))
script.append(self._script_function_source('pyenv', '''
(
eval "$( {pyenv_bin} init - )" && \\
cd {base_path} && \\
{pyenv_bin} "$@"
)
'''.format(
base_path=shlex.quote(self.config['base_path']),
pyenv_bin=self.config['pyenv_bin'],
)))
return '\n'.join(script)
......@@ -2,32 +2,28 @@
# b5 Taskfile, see https://git.team23.de/build/b5 for details
task:install() {
virtualenv:install
pipenv:install
}
task:update() {
virtualenv:update
(
cd .. &&
virtualenv:pip install -e .
)
pipenv:update
}
task:b5() {
# Runs the dev version of b5 inside the virtualenv
# Use Taskfile.local and local.yml for testing
virtualenv:run b5 "$@"
pipenv:run b5 "$@"
}
task:b5-init() {
# Runs the dev version of b5 inside the virtualenv
# Use Taskfile.local and local.yml for testing
virtualenv:run b5-init "$@"
pipenv:run b5-init "$@"
}
task:shell() {
(
source "${VIRTUALENV_env_path}/bin/activate"
source "$( pipenv:pipenv --venv )/bin/activate"
echo -e "${B5_FONT_GREEN}Starting /bin/zsh in a new virtualenv environment, happy developing${B5_FONT_RESTORE}"
${SHELL:-/bin/zsh} "$@"
)
......
......@@ -4,5 +4,5 @@ project:
url: https://git.team23.de/build/b5
paths: # None necessary
modules:
virtualenv:
pipenv:
base_path: ..
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment