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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
slapos.buildout
Commits
92fd30a9
Commit
92fd30a9
authored
Sep 11, 2006
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added an **experimental** extensions mechamism, mainly to support
adding sftp support to buildouts that need it.
parent
e7af2d7d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
96 additions
and
0 deletions
+96
-0
README.txt
README.txt
+6
-0
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+17
-0
src/zc/buildout/buildout.txt
src/zc/buildout/buildout.txt
+73
-0
No files found.
README.txt
View file @
92fd30a9
...
@@ -189,6 +189,12 @@ You can send questions to jim@zope.com.
...
@@ -189,6 +189,12 @@ You can send questions to jim@zope.com.
Change History
Change History
==============
==============
1.0.0b4
-------
Added an **experimental** extensions mechamism, mainly to support
adding sftp support to buildouts that need it.
1.0.0b3
1.0.0b3
-------
-------
...
...
src/zc/buildout/buildout.py
View file @
92fd30a9
...
@@ -137,6 +137,7 @@ class Buildout(dict):
...
@@ -137,6 +137,7 @@ class Buildout(dict):
options
[
'installed'
])
options
[
'installed'
])
self
.
_setup_logging
()
self
.
_setup_logging
()
self
.
_load_extensions
()
def
_dosubs
(
self
,
section
,
option
,
value
,
data
,
converted
,
seen
):
def
_dosubs
(
self
,
section
,
option
,
value
,
data
,
converted
,
seen
):
key
=
section
,
option
key
=
section
,
option
...
@@ -590,6 +591,22 @@ class Buildout(dict):
...
@@ -590,6 +591,22 @@ class Buildout(dict):
args
.
insert
(
0
,
sys
.
executable
)
args
.
insert
(
0
,
sys
.
executable
)
sys
.
exit
(
os
.
spawnv
(
os
.
P_WAIT
,
sys
.
executable
,
args
))
sys
.
exit
(
os
.
spawnv
(
os
.
P_WAIT
,
sys
.
executable
,
args
))
def
_load_extensions
(
self
):
specs
=
self
[
'buildout'
].
get
(
'extensions'
,
''
).
split
()
if
specs
:
if
self
[
'buildout'
].
get
(
'offline'
)
==
'true'
:
dest
=
None
else
:
dest
=
self
[
'buildout'
][
'eggs-directory'
]
zc
.
buildout
.
easy_install
.
install
(
specs
,
dest
,
path
=
[
self
[
'buildout'
][
'develop-eggs-directory'
]],
working_set
=
pkg_resources
.
working_set
,
)
for
ep
in
pkg_resources
.
iter_entry_points
(
'zc.buildout.extension'
):
ep
.
load
()(
self
)
_spacey_nl
=
re
.
compile
(
'[
\
t
\
r
\
f
\
v
]*
\
n
[
\
t
\
r
\
f
\
v
\
n
]*'
_spacey_nl
=
re
.
compile
(
'[
\
t
\
r
\
f
\
v
]*
\
n
[
\
t
\
r
\
f
\
v
\
n
]*'
'|'
'|'
...
...
src/zc/buildout/buildout.txt
View file @
92fd30a9
...
@@ -1271,3 +1271,76 @@ Note that a basic setup.cfg was created for us.
...
@@ -1271,3 +1271,76 @@ Note that a basic setup.cfg was created for us.
Note that the buildout script was installed but not run. To run
Note that the buildout script was installed but not run. To run
the buildout, we'd have to run the installed buildout script.
the buildout, we'd have to run the installed buildout script.
Extensions
----------
An **experimental** feature allows code to be loaded and run after
condiguration files have been read but before the buildout has begun
any processing. The intent is to allow special plugins such as
urllib2 request handlers to be loaded.
To load an extension, we use the extensions option and list one or
more distribution requirements, on separate lines. The distributions
named will be loaded and any zc.buildout.extensions entry points found
will be called with the buildout as an argument.
Let's create a sample extension in out sample buildout created in the
previous section:
>>> mkdir(sample_bootstrapped, 'demo')
>>> write(sample_bootstrapped, 'demo', 'demo.py',
... """
... def ext(buildout):
... print 'ext', list(buildout)
... """)
>>> write(sample_bootstrapped, 'demo', 'setup.py',
... """
... from setuptools import setup
...
... setup(
... name = "demo",
... entry_points = {'zc.buildout.extension': ['ext = demo:ext']},
... )
... """)
Our extension just prints out the word 'demo', and lists the sections
found in the buildout passed to it.
We'll update our buildout.cfg to list the demo directory as a develop
egg to be built:
>>> write(sample_bootstrapped, 'buildout.cfg',
... """
... [buildout]
... develop = demo
... parts =
... """)
>>> os.chdir(sample_bootstrapped)
>>> print system(os.path.join(sample_bootstrapped, 'bin', 'buildout')),
buildout: Develop: /sample-bootstrapped/demo/setup.py
Now we can add the extensions option. We were a bit tricly and ran
the buildout once with the demo develop egg defined but without the
extension option. This is because extensions are loaded before the
buildout creates develop eggs. We needed to use a separate buildout
run to create the develop egg. Normally, when eggs are loaded from
the network, we wouldn't need to do anything special.
>>> write(sample_bootstrapped, 'buildout.cfg',
... """
... [buildout]
... develop = demo
... extensions = demo
... parts =
... """)
We see that out extension is loaded and executed:
>>> print system(os.path.join(sample_bootstrapped, 'bin', 'buildout')),
ext ['buildout']
buildout: Develop: /tmp/tmpi0JFIIsample-bootstrapped/demo/setup.py
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