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
a032f8e2
Commit
a032f8e2
authored
Apr 16, 2010
by
Godefroid Chapelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revert changes moved to branch gotcha-timeout-cfg
parent
a8506de0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
79 deletions
+9
-79
CHANGES.txt
CHANGES.txt
+0
-4
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+9
-29
src/zc/buildout/buildout.txt
src/zc/buildout/buildout.txt
+0
-46
No files found.
CHANGES.txt
View file @
a032f8e2
...
...
@@ -4,10 +4,6 @@ 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 @
a032f8e2
...
...
@@ -32,7 +32,6 @@ import pkg_resources
import
re
import
shutil
import
sys
import
socket
import
tempfile
import
UserDict
import
zc.buildout
...
...
@@ -122,20 +121,8 @@ _buildout_default_options = _annotate_section({
'executable'
:
sys
.
executable
,
'log-level'
:
'INFO'
,
'log-format'
:
''
,
'socket-timeout'
:
''
,
},
'DEFAULT_VALUE'
)
DEFAULT_SOCKET_TIMEOUT
=
socket
.
getdefaulttimeout
()
def
_setup_socket_timeout
(
timeout_string
):
try
:
timeout
=
int
(
timeout_string
)
except
ValueError
:
_error
(
"Timeout value must be numeric [%s]."
%
timeout_string
)
current_timeout
=
socket
.
getdefaulttimeout
()
if
current_timeout
<>
timeout
:
socket
.
setdefaulttimeout
(
timeout
)
class
Buildout
(
UserDict
.
DictMixin
):
...
...
@@ -258,7 +245,6 @@ class Buildout(UserDict.DictMixin):
options
[
'installed'
])
self
.
_setup_logging
()
self
.
_display_socket_timeout
()
offline
=
options
.
get
(
'offline'
,
'false'
)
if
offline
not
in
(
'true'
,
'false'
):
...
...
@@ -763,12 +749,6 @@ class Buildout(UserDict.DictMixin):
def
_error
(
self
,
message
,
*
args
):
raise
zc
.
buildout
.
UserError
(
message
%
args
)
def
_display_socket_timeout
(
self
):
current_timeout
=
socket
.
getdefaulttimeout
()
if
current_timeout
<>
DEFAULT_SOCKET_TIMEOUT
:
info_msg
=
'Socket timeout is set to %d seconds.'
%
current_timeout
self
.
_logger
.
info
(
info_msg
)
def
_setup_logging
(
self
):
root_logger
=
logging
.
getLogger
()
self
.
_logger
=
logging
.
getLogger
(
'zc.buildout'
)
...
...
@@ -1336,18 +1316,13 @@ def _open(base, filename, seen, dl_options, override):
os
.
remove
(
path
)
extends
=
extended_by
=
None
socket_timeout
=
None
for
section
in
parser
.
sections
():
options
=
dict
(
parser
.
items
(
section
))
if
section
==
'buildout'
:
extends
=
options
.
pop
(
'extends'
,
extends
)
extended_by
=
options
.
pop
(
'extended-by'
,
extended_by
)
socket_timeout
=
options
.
pop
(
'socket-timeout'
,
socket_timeout
)
result
[
section
]
=
options
if
socket_timeout
is
not
None
:
_setup_socket_timeout
(
socket_timeout
)
result
=
_annotate
(
result
,
filename
)
if
root_config_file
and
'buildout'
in
result
:
...
...
@@ -1640,11 +1615,16 @@ def main(args=None):
_error
(
"No file name specified for option"
,
orig_op
)
elif
op_
==
't'
:
try
:
timeout_string
=
args
.
pop
(
0
)
_setup_socket_timeout
(
timeout_string
)
options
.
append
((
'buildout'
,
'socket-timeout'
,
timeout_string
))
timeout
=
int
(
args
.
pop
(
0
))
except
IndexError
:
_error
(
"No timeout value specified for option t"
,
orig_op
)
_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
)
elif
op
:
if
orig_op
==
'--help'
:
_help
()
...
...
src/zc/buildout/buildout.txt
View file @
a032f8e2
...
...
@@ -748,8 +748,6 @@ COMMAND_LINE_VALUE).
DEFAULT_VALUE
python= buildout
DEFAULT_VALUE
socket-timeout=
DEFAULT_VALUE
<BLANKLINE>
[data-dir]
path= foo bins
...
...
@@ -1493,49 +1491,6 @@ 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),
Socket timeout is set to 5 seconds.
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Installing debug.
op timeout
recipe recipes:debug
If socket-timeout is not numeric, an error message is issued.
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... socket-timeout = 5s
... develop = recipes
... parts = debug
...
... [debug]
... recipe = recipes:debug
... op = timeout
... """)
>>> print system(buildout),
Error: Timeout value must be numeric [5s].
Uninstall recipes
-----------------
...
...
@@ -2258,7 +2213,6 @@ 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