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
2bf8b65c
Commit
2bf8b65c
authored
Mar 10, 2010
by
Godefroid Chapelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added buildout:socket-timout option so that socket timeout can be configured
both from command line and from config files.
parent
a260a0a6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
7 deletions
+76
-7
CHANGES.txt
CHANGES.txt
+4
-0
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+19
-7
src/zc/buildout/buildout.txt
src/zc/buildout/buildout.txt
+53
-0
No files found.
CHANGES.txt
View file @
2bf8b65c
...
...
@@ -4,6 +4,10 @@ Change History
1.4.4 (?)
=========
New feature:
- Added buildout:socket-timout option so that socket timeout can be configured
both from command line and from config files. (gotcha)
1.4.3 (2009-12-10)
==================
...
...
src/zc/buildout/buildout.py
View file @
2bf8b65c
...
...
@@ -121,6 +121,7 @@ _buildout_default_options = _annotate_section({
'executable'
:
sys
.
executable
,
'log-level'
:
'INFO'
,
'log-format'
:
''
,
'socket-timeout'
:
''
,
},
'DEFAULT_VALUE'
)
...
...
@@ -245,6 +246,7 @@ class Buildout(UserDict.DictMixin):
options
[
'installed'
])
self
.
_setup_logging
()
self
.
_setup_socket_timeout
()
offline
=
options
.
get
(
'offline'
,
'false'
)
if
offline
not
in
(
'true'
,
'false'
):
...
...
@@ -749,6 +751,19 @@ class Buildout(UserDict.DictMixin):
def
_error
(
self
,
message
,
*
args
):
raise
zc
.
buildout
.
UserError
(
message
%
args
)
def
_setup_socket_timeout
(
self
):
timeout
=
self
[
'buildout'
][
'socket-timeout'
]
if
timeout
<>
''
:
try
:
timeout
=
int
(
timeout
)
import
socket
self
.
_logger
.
info
(
'Setting socket time out to %d seconds.'
,
timeout
)
socket
.
setdefaulttimeout
(
timeout
)
except
ValueError
:
self
.
_logger
.
warning
(
"Default socket timeout is used !
\
n
"
"Value in configuration is not numeric: [%s].
\
n
"
,
timeout
)
def
_setup_logging
(
self
):
root_logger
=
logging
.
getLogger
()
self
.
_logger
=
logging
.
getLogger
(
'zc.buildout'
)
...
...
@@ -1615,16 +1630,13 @@ def main(args=None):
_error
(
"No file name specified for option"
,
orig_op
)
elif
op_
==
't'
:
try
:
timeout
=
int
(
args
.
pop
(
0
))
timeout_string
=
args
.
pop
(
0
)
timeout
=
int
(
timeout_string
)
options
.
append
((
'buildout'
,
'socket-timeout'
,
timeout_string
))
except
IndexError
:
_error
(
"No timeout value specified for option"
,
orig_op
)
except
ValueError
:
_error
(
"No timeout value must be numeric"
,
orig_op
)
import
socket
print
'Setting socket time out to %d seconds'
%
timeout
socket
.
setdefaulttimeout
(
timeout
)
_error
(
"Timeout value must be numeric"
,
orig_op
)
elif
op
:
if
orig_op
==
'--help'
:
_help
()
...
...
src/zc/buildout/buildout.txt
View file @
2bf8b65c
...
...
@@ -748,6 +748,8 @@ COMMAND_LINE_VALUE).
DEFAULT_VALUE
python= buildout
DEFAULT_VALUE
socket-timeout=
DEFAULT_VALUE
<BLANKLINE>
[data-dir]
path= foo bins
...
...
@@ -1491,6 +1493,56 @@ set the logging level to WARNING
op3 b2 3
recipe recipes:debug
Socket timeout
--------------
The timeout of the connections to egg and configuration servers can be
configured in the buildout section. Its value is configured in seconds.
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... socket-timeout = 5
... develop = recipes
... parts = debug
...
... [debug]
... recipe = recipes:debug
... op = timeout
... """)
>>> print system(buildout),
Setting socket time out to 5 seconds.
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Installing debug.
op timeout
recipe recipes:debug
If the socket-timeout is not numeric, a warning is issued and the default
timeout of the Python socket module is used.
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... socket-timeout = 5s
... develop = recipes
... parts = debug
...
... [debug]
... recipe = recipes:debug
... op = timeout
... """)
>>> print system(buildout),
Default socket timeout is used !
Value in configuration is not numeric: [5s].
<BLANKLINE>
Develop: '/sample-buildout/recipes'
Updating debug.
op timeout
recipe recipes:debug
Uninstall recipes
-----------------
...
...
@@ -2213,6 +2265,7 @@ database is shown.
parts =
parts-directory = /sample-buildout/parts
python = buildout
socket-timeout =
verbosity = 20
<BLANKLINE>
...
...
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