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
8
Merge Requests
8
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
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
Hide 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:
else
:
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
):
return
sep
,
end
,
file
...
...
@@ -289,8 +302,11 @@ _buildout_default_options = _annotate_section({
},
'DEFAULT_VALUE'
)
@
commands
class
Buildout
(
DictMixin
):
COMMANDS
=
set
()
def
__init__
(
self
,
config_file
,
cloptions
,
user_defaults
=
True
,
command
=
None
,
args
=
()):
...
...
@@ -555,6 +571,7 @@ class Buildout(DictMixin):
return
name
return
os
.
path
.
join
(
self
.
_buildout_dir
,
name
)
@
command
def
bootstrap
(
self
,
args
):
__doing__
=
'Bootstrapping.'
...
...
@@ -628,11 +645,13 @@ class Buildout(DictMixin):
f
.
write
(
'[buildout]
\
n
parts =
\
n
'
)
f
.
close
()
@
command
def
init
(
self
,
args
):
self
.
bootstrap
(())
if
args
:
self
.
install
(())
@
command
def
install
(
self
,
install_args
):
__doing__
=
'Installing.'
...
...
@@ -1210,6 +1229,7 @@ class Buildout(DictMixin):
print_
(
"Picked versions have been written to "
+
self
.
update_versions_file
)
@
command
def
setup
(
self
,
args
):
if
not
args
:
raise
zc
.
buildout
.
UserError
(
...
...
@@ -1236,8 +1256,11 @@ class Buildout(DictMixin):
os
.
close
(
fd
)
os
.
remove
(
tsetup
)
runsetup
=
setup
# backward compat.
@
command
def
runsetup
(
self
,
args
):
self
.
setup
(
args
)
@
command
def
query
(
self
,
args
=
None
):
if
args
is
None
or
len
(
args
)
!=
1
:
_error
(
'The query command requires a single argument.'
)
...
...
@@ -1259,6 +1282,7 @@ class Buildout(DictMixin):
else
:
_error
(
'Section not found:'
,
section
)
@
command
def
annotate
(
self
,
args
=
None
):
verbose
=
self
[
'buildout'
].
get
(
'verbosity'
,
0
)
!=
0
section
=
None
...
...
@@ -2138,10 +2162,7 @@ def main(args=None):
if
args
:
command
=
args
.
pop
(
0
)
if
command
not
in
(
'install'
,
'bootstrap'
,
'runsetup'
,
'setup'
,
'init'
,
'annotate'
,
'query'
,
):
if
command
not
in
Buildout
.
COMMANDS
:
_error
(
'invalid command:'
,
command
)
else
:
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