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
35f81f2e
Commit
35f81f2e
authored
Aug 03, 2010
by
Gary Poster
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make the two built-in recipes use the new bool option conveniences
parent
67ffcdf5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
51 deletions
+27
-51
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+21
-19
z3c.recipe.scripts_/src/z3c/recipe/scripts/scripts.py
z3c.recipe.scripts_/src/z3c/recipe/scripts/scripts.py
+4
-14
zc.recipe.egg_/src/zc/recipe/egg/egg.py
zc.recipe.egg_/src/zc/recipe/egg/egg.py
+2
-18
No files found.
src/zc/buildout/buildout.py
View file @
35f81f2e
...
@@ -1068,6 +1068,7 @@ def _install_and_load(spec, group, entry, buildout):
...
@@ -1068,6 +1068,7 @@ def _install_and_load(spec, group, entry, buildout):
group
,
entry
,
spec
,
v
)
group
,
entry
,
spec
,
v
)
raise
raise
class
Options
(
UserDict
.
DictMixin
):
class
Options
(
UserDict
.
DictMixin
):
def
__init__
(
self
,
buildout
,
section
,
data
):
def
__init__
(
self
,
buildout
,
section
,
data
):
...
@@ -1277,30 +1278,31 @@ class Options(UserDict.DictMixin):
...
@@ -1277,30 +1278,31 @@ class Options(UserDict.DictMixin):
self
.
name
)
self
.
name
)
return
self
.
_created
return
self
.
_created
def
get_bool
(
self
,
name
,
default
=
None
,
on_error
=
None
):
def
query_bool
(
self
,
name
,
default
=
None
):
"""Given a name, return a boolean value for that name.
"""Given a name, return a boolean value for that name.
``default``, if given, should be 'true', 'false', or None. None
``default``, if given, should be 'true', 'false', or None.
is the default, and means that there is no default for the
value: the call should raise a MissingOption error if the name
is not present.
``on_error``, if given, should be a callable that takes the name and
the found value.
"""
"""
if
default
is
None
:
if
default
is
not
None
:
value
=
self
[
name
]
value
=
self
.
setdefault
(
name
,
default
=
default
)
else
:
value
=
self
.
get
(
name
,
default
=
default
)
if
value
not
in
(
'true'
,
'false'
):
if
on_error
is
None
:
raise
zc
.
buildout
.
UserError
(
'Invalid value for %s option: %s'
%
(
name
,
value
))
else
:
on_error
(
name
,
value
)
else
:
else
:
return
value
==
'true'
value
=
self
.
get
(
name
)
if
value
is
None
:
return
value
return
_convert_bool
(
name
,
value
)
def
get_bool
(
self
,
name
):
"""Given a name, return a boolean value for that name.
"""
return
_convert_bool
(
name
,
self
[
name
])
def
_convert_bool
(
name
,
value
):
if
value
not
in
(
'true'
,
'false'
):
raise
zc
.
buildout
.
UserError
(
'Invalid value for %s option: %s'
%
(
name
,
value
))
else
:
return
value
==
'true'
_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
]*'
'|'
'|'
...
...
z3c.recipe.scripts_/src/z3c/recipe/scripts/scripts.py
View file @
35f81f2e
...
@@ -35,23 +35,13 @@ class Base(ScriptBase):
...
@@ -35,23 +35,13 @@ class Base(ScriptBase):
'*'
)
'*'
)
self
.
allowed_eggs
=
tuple
(
name
.
strip
()
for
name
in
value
.
split
(
'
\
n
'
))
self
.
allowed_eggs
=
tuple
(
name
.
strip
()
for
name
in
value
.
split
(
'
\
n
'
))
value
=
options
.
setdefault
(
self
.
include_site_packages
=
options
.
query_bool
(
'include-site-packages'
,
'include-site-packages'
,
b_options
.
get
(
'include-site-packages'
,
'false'
))
default
=
b_options
.
get
(
'include-site-packages'
,
'false'
))
if
value
not
in
(
'true'
,
'false'
):
raise
zc
.
buildout
.
UserError
(
"Invalid value for include-site-packages option: %s"
%
(
value
,))
self
.
include_site_packages
=
(
value
==
'true'
)
value
=
options
.
setdefault
(
self
.
exec_sitecustomize
=
options
.
query_bool
(
'exec-sitecustomize'
,
'exec-sitecustomize'
,
b_options
.
get
(
'exec-sitecustomize'
,
'false'
))
default
=
b_options
.
get
(
'exec-sitecustomize'
,
'false'
))
if
value
not
in
(
'true'
,
'false'
):
raise
zc
.
buildout
.
UserError
(
"Invalid value for exec-sitecustomize option: %s"
%
(
value
,))
self
.
exec_sitecustomize
=
(
value
==
'true'
)
class
Interpreter
(
Base
):
class
Interpreter
(
Base
):
...
...
zc.recipe.egg_/src/zc/recipe/egg/egg.py
View file @
35f81f2e
...
@@ -52,9 +52,6 @@ class Eggs(object):
...
@@ -52,9 +52,6 @@ class Eggs(object):
options
[
'develop-eggs-directory'
]
=
b_options
[
'develop-eggs-directory'
]
options
[
'develop-eggs-directory'
]
=
b_options
[
'develop-eggs-directory'
]
options
[
'_d'
]
=
options
[
'develop-eggs-directory'
]
# backward compat.
options
[
'_d'
]
=
options
[
'develop-eggs-directory'
]
# backward compat.
# verify that this is None, 'true' or 'false'
get_bool
(
options
,
'unzip'
)
python
=
options
.
setdefault
(
'python'
,
b_options
[
'python'
])
python
=
options
.
setdefault
(
'python'
,
b_options
[
'python'
])
options
[
'executable'
]
=
buildout
[
python
][
'executable'
]
options
[
'executable'
]
=
buildout
[
python
][
'executable'
]
...
@@ -84,7 +81,7 @@ class Eggs(object):
...
@@ -84,7 +81,7 @@ class Eggs(object):
else
:
else
:
kw
=
{}
kw
=
{}
if
'unzip'
in
options
:
if
'unzip'
in
options
:
kw
[
'always_unzip'
]
=
get_bool
(
options
,
'unzip'
)
kw
[
'always_unzip'
]
=
options
.
query_bool
(
'unzip'
,
None
)
ws
=
zc
.
buildout
.
easy_install
.
install
(
ws
=
zc
.
buildout
.
easy_install
.
install
(
distributions
,
options
[
'eggs-directory'
],
distributions
,
options
[
'eggs-directory'
],
links
=
self
.
links
,
links
=
self
.
links
,
...
@@ -159,7 +156,7 @@ class ScriptBase(Eggs):
...
@@ -159,7 +156,7 @@ class ScriptBase(Eggs):
raise
zc
.
buildout
.
UserError
(
"Invalid entry point"
)
raise
zc
.
buildout
.
UserError
(
"Invalid entry point"
)
reqs
.
append
(
parsed
.
groups
())
reqs
.
append
(
parsed
.
groups
())
if
get_bool
(
options
,
'dependent-scripts
'
):
if
options
.
query_bool
(
'dependent-scripts'
,
'false
'
):
# Generate scripts for all packages in the working set,
# Generate scripts for all packages in the working set,
# except setuptools.
# except setuptools.
reqs
=
list
(
reqs
)
reqs
=
list
(
reqs
)
...
@@ -192,17 +189,4 @@ class Scripts(ScriptBase):
...
@@ -192,17 +189,4 @@ class Scripts(ScriptBase):
relative_paths
=
self
.
_relative_paths
relative_paths
=
self
.
_relative_paths
)
)
def
get_bool
(
options
,
name
,
default
=
False
):
value
=
options
.
get
(
name
)
if
not
value
:
return
default
if
value
==
'true'
:
return
True
elif
value
==
'false'
:
return
False
else
:
raise
zc
.
buildout
.
UserError
(
"Invalid value for %s option: %s"
%
(
name
,
value
))
Egg
=
Scripts
Egg
=
Scripts
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