Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.buildout
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
slapos.buildout
Commits
f1c87887
Commit
f1c87887
authored
Jun 07, 2006
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finished egglinker doctest.
Added the ability to control script generation.
parent
4215b4b7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
112 additions
and
7 deletions
+112
-7
eggrecipe/src/zc/recipe/egg/README.txt
eggrecipe/src/zc/recipe/egg/README.txt
+74
-0
eggrecipe/src/zc/recipe/egg/egg.py
eggrecipe/src/zc/recipe/egg/egg.py
+13
-4
src/zc/buildout/egglinker.py
src/zc/buildout/egglinker.py
+25
-3
No files found.
eggrecipe/src/zc/recipe/egg/README.txt
View file @
f1c87887
...
...
@@ -92,3 +92,77 @@ the bits if the path added to reflect the eggs:
/tmp/tmpcy8MvGbuildout-tests/eggs/demoneeded-1.0-py2.3.egg
<BLANKLINE>
The recipe gets the most recent distribution that satisfies the
specification. For example, if we remove the restriction on demo:
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... parts = demo
...
... [demo]
... recipe = zc.recipe.egg
... distribution = demo
... find_links = %s
... """ % sample_eggs)
and rerun the buildout:
>>> print system(runscript),
Then we'll get a new demo egg:
>>> ls(sample_buildout, 'eggs')
- demo-0.2-py2.3.egg
- demo-0.3-py2.3.egg
- demoneeded-1.0-py2.3.egg
- zc.recipe.egg.egg-link
The script is updated too:
>>> print system(os.path.join(sample_buildout, 'bin', 'demo')),
3 1
You can control which scripts get generated using the scripts option.
For example, to suppress scripts, use the scripts option without any
arguments:
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... parts = demo
...
... [demo]
... recipe = zc.recipe.egg
... distribution = demo
... find_links = %s
... scripts =
... """ % sample_eggs)
>>> print system(runscript),
>>> ls(sample_buildout, 'bin')
- buildout
You can also control the name used for scripts:
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... parts = demo
...
... [demo]
... recipe = zc.recipe.egg
... distribution = demo
... find_links = %s
... scripts = demo=foo
... """ % sample_eggs)
>>> print system(runscript),
>>> ls(sample_buildout, 'bin')
- buildout
- foo
eggrecipe/src/zc/recipe/egg/egg.py
View file @
f1c87887
...
...
@@ -44,7 +44,16 @@ class Egg:
[
buildout
.
buildout_path
(
link
)
for
link
in
links
],
always_copy
=
True
,
)
zc
.
buildout
.
egglinker
.
scripts
(
[
distribution
],
buildout
.
bin
,
[
buildout
.
eggs
],
)
scripts
=
self
.
options
.
get
(
'scripts'
)
if
scripts
or
scripts
is
None
:
if
scripts
is
not
None
:
scripts
=
scripts
.
split
()
scripts
=
dict
([
(
'='
in
s
)
and
s
.
split
(
'='
,
1
)
or
(
s
,
s
)
for
s
in
scripts
])
return
zc
.
buildout
.
egglinker
.
scripts
(
[
distribution
],
buildout
.
bin
,
[
buildout
.
eggs
],
scripts
=
scripts
)
src/zc/buildout/egglinker.py
View file @
f1c87887
...
...
@@ -46,17 +46,39 @@ def location(spec, eggss):
dist
=
env
.
best_match
(
req
,
pkg_resources
.
WorkingSet
())
return
dist
.
location
def
scripts
(
reqs
,
dest
,
eggss
):
def
scripts
(
reqs
,
dest
,
eggss
,
scripts
=
None
):
dists
=
distributions
(
reqs
,
eggss
)
reqs
=
[
pkg_resources
.
Requirement
.
parse
(
r
)
for
r
in
reqs
]
projects
=
[
r
.
project_name
for
r
in
reqs
]
path
=
"',
\
n
'"
.
join
([
dist
.
location
for
dist
in
dists
])
generated
=
[]
for
dist
in
dists
:
if
dist
.
project_name
in
projects
:
for
name
in
pkg_resources
.
get_entry_map
(
dist
,
'console_scripts'
):
_script
(
dist
,
name
,
path
,
os
.
path
.
join
(
dest
,
name
))
_pyscript
(
path
,
os
.
path
.
join
(
dest
,
'py_'
+
dist
.
project_name
))
if
scripts
is
not
None
:
sname
=
scripts
.
get
(
name
)
if
sname
is
None
:
continue
else
:
sname
=
name
sname
=
os
.
path
.
join
(
dest
,
sname
)
generated
.
append
(
sname
)
_script
(
dist
,
name
,
path
,
sname
)
name
=
'py_'
+
dist
.
project_name
if
scripts
is
not
None
:
sname
=
scripts
.
get
(
name
)
else
:
sname
=
name
if
sname
is
not
None
:
sname
=
os
.
path
.
join
(
dest
,
sname
)
generated
.
append
(
sname
)
_pyscript
(
path
,
sname
)
return
generated
def
_script
(
dist
,
name
,
path
,
dest
):
open
(
dest
,
'w'
).
write
(
script_template
%
dict
(
...
...
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