Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Leymonerie
slapos
Commits
49dbfac4
Commit
49dbfac4
authored
Feb 21, 2022
by
Thomas Leymonerie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos/recipe/test_recipe.py : Add option python_path
parent
3f37cbc7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
45 deletions
+6
-45
slapos/recipe/test_recipe.py
slapos/recipe/test_recipe.py
+6
-45
No files found.
slapos/recipe/test_recipe.py
View file @
49dbfac4
import
os
from
slapos.recipe.librecipe
import
GenericBaseRecipe
import
slapos.slap
import
subprocess
import
zc.buildout.easy_install
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'
],
...
...
@@ -17,31 +14,7 @@ class Recipe(GenericBaseRecipe):
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
(
...
...
@@ -49,27 +22,15 @@ class Recipe(GenericBaseRecipe):
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
(
"/
\
---------/
\
"
)
else
:
working_set
=
set
()
python_path
=
":"
.
join
(
tuple
(
dist
.
location
for
dist
in
working_set
))
self
.
options
[
'python_path'
]
=
python_path
update
=
install
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment