Commit 3f37cbc7 authored by Thomas Leymonerie's avatar Thomas Leymonerie

slapos : Recipe test egg

parent 15562f41
File added
...@@ -28,7 +28,7 @@ from setuptools import setup, find_packages ...@@ -28,7 +28,7 @@ from setuptools import setup, find_packages
import glob import glob
import os import os
version = '1.0.226' version = '1.0.226+tleymone2'
name = 'slapos.cookbook' name = 'slapos.cookbook'
long_description = open("README.rst").read() long_description = open("README.rst").read()
...@@ -163,6 +163,7 @@ setup(name=name, ...@@ -163,6 +163,7 @@ setup(name=name,
'symbolic.link = slapos.recipe.symbolic_link:Recipe', 'symbolic.link = slapos.recipe.symbolic_link:Recipe',
'tidstorage = slapos.recipe.tidstorage:Recipe', 'tidstorage = slapos.recipe.tidstorage:Recipe',
'trac = slapos.recipe.trac:Recipe', 'trac = slapos.recipe.trac:Recipe',
'test_recipe = slapos.recipe.test_recipe:Recipe',
'urlparse = slapos.recipe._urlparse:Recipe', 'urlparse = slapos.recipe._urlparse:Recipe',
'uuid = slapos.recipe._uuid:Recipe', 'uuid = slapos.recipe._uuid:Recipe',
'userinfo = slapos.recipe.userinfo:Recipe', 'userinfo = slapos.recipe.userinfo:Recipe',
......
import os
from slapos.recipe.librecipe import GenericBaseRecipe
import slapos.slap
import subprocess
class Recipe(GenericBaseRecipe):
_WORKING_SET_CACHE_NAME = "slapos.cookbook_pplugin_ws_cache"
def __init__(self, buildout, name, options):
options['path'] = os.path.join(
buildout['buildout']['parts-directory'],
name,
)
self.options = options
self.buildout = buildout
buildout_section = buildout['buildout']
options['eggs-directory'] = buildout_section['eggs-directory']
options['develop-eggs-directory'] = buildout_section['develop-eggs-directory']
def _get_cache_storage(self):
"""Return a mapping where to store generated working sets.
from https://github.com/buildout/buildout/blob/master/zc.recipe.egg_/src/zc/recipe/egg/egg.py#L170
"""
try:
return getattr(self.buildout, self._WORKING_SET_CACHE_NAME)
except AttributeError:
cache_storage = {}
try:
setattr(
self.buildout,
self._WORKING_SET_CACHE_NAME,
cache_storage
)
except AttributeError:
if not isinstance(self.buildout, dict):
raise
# failed to set attribute in test mode, cache not used
return cache_storage
def install(self):
'''self.options.created(self.options['path'])
with open(self.options['path'], 'w') as f:
f.write(self.options['contents'])
return self.options.created()'''
develop_eggs_dir = self.options['develop-eggs-directory']
eggs_dir = self.options['eggs-directory']
egg_list = tuple(
egg.strip()
for egg in self.options['eggs'].splitlines()
if egg.strip()
)
cache_storage = self._get_cache_storage()
cache_key = (
egg_list,
eggs_dir,
develop_eggs_dir,
)
try:
working_set = cache_storage[cache_key]
except KeyError:
if develop_eggs_dir and eggs_dir:
working_set = zc.buildout.easy_install.working_set(
egg_list,
[develop_eggs_dir, eggs_dir]
)
cache_storage[cache_key] = working_set
else:
working_set = set()
test = pformat(tuple(dist.location for dist in working_set), indent=2)
print("/\---------/\ ")
self.options['test'] = "test"
print(self.options)
print("/\---------/\ ")
update = install
\ No newline at end of file
...@@ -26,7 +26,9 @@ context = ...@@ -26,7 +26,9 @@ context =
raw django_interpreter ${buildout:bin-directory}/${django:interpreter} raw django_interpreter ${buildout:bin-directory}/${django:interpreter}
[versions] [versions]
Django = 3.2.12 #Django = 3.2.12
Django = 3.2.3
sqlparse = 0.4.2 sqlparse = 0.4.2
asgiref = 3.5.0 asgiref = 3.5.0
typing-extensions = 3.7.2 typing-extensions = 3.7.2
django-cors-headers = 3.11.0
[instance]
filename = instance.cfg.in
md5sum = ed701a06948e749b3e5ad312c8989e93
[buildout]
parts =
test_recipe
eggs-directory = {{ buildout['eggs-directory'] }}
develop-eggs-directory = {{ buildout['develop-eggs-directory'] }}
[test_recipe]
recipe = slapos.cookbook:test_recipe
port = 8080
eggs = {{ django['eggs'] }}
contents =
<zeo>
address ${:port}
</zeo>
<mappingstorage>
</mappingstorage>
[buildout]
extends =
../../stack/slapos.cfg
buildout.hash.cfg
parts =
slapos-cookbook
instance
django
[python]
part = python3
[django]
recipe = zc.recipe.egg
eggs =
Django
[instance]
recipe = slapos.recipe.template:jinja2
rendered = ${buildout:directory}/template.cfg
template = ${:_profile_base_location_}/${:filename}
context =
section buildout buildout
section django django
[versions]
Django = 3.2.12
sqlparse = 0.4.2
asgiref = 3.5.0
typing-extensions = 3.7.2
django-cors-headers = 3.11.0
...@@ -37,6 +37,7 @@ additional-url = $${remote-additional-frontend:connection-secure_access} ...@@ -37,6 +37,7 @@ additional-url = $${remote-additional-frontend:connection-secure_access}
username = $${frontend-instance-password:username} username = $${frontend-instance-password:username}
password = $${frontend-instance-password:passwd} password = $${frontend-instance-password:passwd}
backend-url = $${frontend-instance:url} backend-url = $${frontend-instance:url}
ipv6 = {{ ipv6_random }}
[directory] [directory]
......
...@@ -39,6 +39,7 @@ exec-sitecustomize = false ...@@ -39,6 +39,7 @@ exec-sitecustomize = false
find-links += find-links +=
http://www.nexedi.org/static/packages/source/ http://www.nexedi.org/static/packages/source/
http://www.nexedi.org/static/packages/source/slapos.buildout/ http://www.nexedi.org/static/packages/source/slapos.buildout/
/srv/slapgrid/slappart28/srv/project/slapos/dist/
# Use only quite well working sites. # Use only quite well working sites.
allow-hosts += allow-hosts +=
...@@ -189,7 +190,7 @@ setproctitle = 1.1.10 ...@@ -189,7 +190,7 @@ setproctitle = 1.1.10
setuptools-dso = 1.7 setuptools-dso = 1.7
rubygemsrecipe = 0.4.3 rubygemsrecipe = 0.4.3
six = 1.12.0 six = 1.12.0
slapos.cookbook = 1.0.226 slapos.cookbook = 1.0.226+tleymone2
slapos.core = 1.7.2 slapos.core = 1.7.2
slapos.extension.strip = 0.4 slapos.extension.strip = 0.4
slapos.extension.shared = 1.0 slapos.extension.shared = 1.0
......
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