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
Xavier Thompson
slapos.buildout
Commits
3a5c6f95
Commit
3a5c6f95
authored
Jan 15, 2019
by
Godefroid Chapelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid explicit list of commands
as suggested by @leorochael
parent
0d56ba28
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
5 deletions
+26
-5
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+26
-5
No files found.
src/zc/buildout/buildout.py
View file @
3a5c6f95
...
@@ -50,6 +50,19 @@ if PY3:
...
@@ -50,6 +50,19 @@ if PY3:
else
:
else
:
text_type
=
unicode
text_type
=
unicode
def
command
(
method
):
method
.
buildout_command
=
True
return
method
def
commands
(
cls
):
for
name
,
method
in
cls
.
__dict__
.
items
():
if
hasattr
(
method
,
"buildout_command"
):
cls
.
COMMANDS
.
add
(
name
)
return
cls
def
_print_options
(
sep
=
' '
,
end
=
'
\
n
'
,
file
=
None
):
def
_print_options
(
sep
=
' '
,
end
=
'
\
n
'
,
file
=
None
):
return
sep
,
end
,
file
return
sep
,
end
,
file
...
@@ -289,8 +302,11 @@ _buildout_default_options = _annotate_section({
...
@@ -289,8 +302,11 @@ _buildout_default_options = _annotate_section({
},
'DEFAULT_VALUE'
)
},
'DEFAULT_VALUE'
)
@
commands
class
Buildout
(
DictMixin
):
class
Buildout
(
DictMixin
):
COMMANDS
=
set
()
def
__init__
(
self
,
config_file
,
cloptions
,
def
__init__
(
self
,
config_file
,
cloptions
,
user_defaults
=
True
,
user_defaults
=
True
,
command
=
None
,
args
=
()):
command
=
None
,
args
=
()):
...
@@ -555,6 +571,7 @@ class Buildout(DictMixin):
...
@@ -555,6 +571,7 @@ class Buildout(DictMixin):
return
name
return
name
return
os
.
path
.
join
(
self
.
_buildout_dir
,
name
)
return
os
.
path
.
join
(
self
.
_buildout_dir
,
name
)
@
command
def
bootstrap
(
self
,
args
):
def
bootstrap
(
self
,
args
):
__doing__
=
'Bootstrapping.'
__doing__
=
'Bootstrapping.'
...
@@ -628,11 +645,13 @@ class Buildout(DictMixin):
...
@@ -628,11 +645,13 @@ class Buildout(DictMixin):
f
.
write
(
'[buildout]
\
n
parts =
\
n
'
)
f
.
write
(
'[buildout]
\
n
parts =
\
n
'
)
f
.
close
()
f
.
close
()
@
command
def
init
(
self
,
args
):
def
init
(
self
,
args
):
self
.
bootstrap
(())
self
.
bootstrap
(())
if
args
:
if
args
:
self
.
install
(())
self
.
install
(())
@
command
def
install
(
self
,
install_args
):
def
install
(
self
,
install_args
):
__doing__
=
'Installing.'
__doing__
=
'Installing.'
...
@@ -1210,6 +1229,7 @@ class Buildout(DictMixin):
...
@@ -1210,6 +1229,7 @@ class Buildout(DictMixin):
print_
(
"Picked versions have been written to "
+
print_
(
"Picked versions have been written to "
+
self
.
update_versions_file
)
self
.
update_versions_file
)
@
command
def
setup
(
self
,
args
):
def
setup
(
self
,
args
):
if
not
args
:
if
not
args
:
raise
zc
.
buildout
.
UserError
(
raise
zc
.
buildout
.
UserError
(
...
@@ -1236,8 +1256,11 @@ class Buildout(DictMixin):
...
@@ -1236,8 +1256,11 @@ class Buildout(DictMixin):
os
.
close
(
fd
)
os
.
close
(
fd
)
os
.
remove
(
tsetup
)
os
.
remove
(
tsetup
)
runsetup
=
setup
# backward compat.
@
command
def
runsetup
(
self
,
args
):
self
.
setup
(
args
)
@
command
def
query
(
self
,
args
=
None
):
def
query
(
self
,
args
=
None
):
if
args
is
None
or
len
(
args
)
!=
1
:
if
args
is
None
or
len
(
args
)
!=
1
:
_error
(
'The query command requires a single argument.'
)
_error
(
'The query command requires a single argument.'
)
...
@@ -1259,6 +1282,7 @@ class Buildout(DictMixin):
...
@@ -1259,6 +1282,7 @@ class Buildout(DictMixin):
else
:
else
:
_error
(
'Section not found:'
,
section
)
_error
(
'Section not found:'
,
section
)
@
command
def
annotate
(
self
,
args
=
None
):
def
annotate
(
self
,
args
=
None
):
verbose
=
self
[
'buildout'
].
get
(
'verbosity'
,
0
)
!=
0
verbose
=
self
[
'buildout'
].
get
(
'verbosity'
,
0
)
!=
0
section
=
None
section
=
None
...
@@ -2138,10 +2162,7 @@ def main(args=None):
...
@@ -2138,10 +2162,7 @@ def main(args=None):
if
args
:
if
args
:
command
=
args
.
pop
(
0
)
command
=
args
.
pop
(
0
)
if
command
not
in
(
if
command
not
in
Buildout
.
COMMANDS
:
'install'
,
'bootstrap'
,
'runsetup'
,
'setup'
,
'init'
,
'annotate'
,
'query'
,
):
_error
(
'invalid command:'
,
command
)
_error
(
'invalid command:'
,
command
)
else
:
else
:
command
=
'install'
command
=
'install'
...
...
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