Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
installsystems
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Seblu
installsystems
Commits
560029c1
Commit
560029c1
authored
13 years ago
by
Seblu
Browse files
Options
Downloads
Patches
Plain Diff
No more custom action to set debug and quiet mode
parent
d6649d20
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bin/isimage
+9
-14
9 additions, 14 deletions
bin/isimage
bin/isinstall
+8
-15
8 additions, 15 deletions
bin/isinstall
bin/isrepo
+18
-26
18 additions, 26 deletions
bin/isrepo
with
35 additions
and
55 deletions
bin/isimage
+
9
−
14
View file @
560029c1
...
@@ -10,19 +10,10 @@ import os
...
@@ -10,19 +10,10 @@ import os
import
time
import
time
import
datetime
import
datetime
import
installsystems
import
installsystems
import
installsystems.argparse
as
argparse
# To remove when
default to
python 2.7
import
installsystems.argparse
as
argparse
# To
be
remove
d
when python 2.7
from
installsystems.printer
import
*
from
installsystems.printer
import
*
from
installsystems.image
import
SourceImage
from
installsystems.image
import
SourceImage
class
ISAction
(
argparse
.
Action
):
'''
Set installsystems quiet/debug mode. Argparse callback
'''
def
__call__
(
self
,
parser
,
namespace
,
values
,
option_string
=
None
):
if
option_string
in
(
"
-q
"
,
"
--quiet
"
):
installsystems
.
quiet
=
True
elif
option_string
in
(
"
-d
"
,
"
--debug
"
):
installsystems
.
debug
=
True
def
init
(
args
):
def
init
(
args
):
'''
Create an empty fresh source image tree
'''
'''
Create an empty fresh source image tree
'''
# call init from library
# call init from library
...
@@ -49,12 +40,12 @@ def build(args):
...
@@ -49,12 +40,12 @@ def build(args):
# Top level argument parsing
# Top level argument parsing
p_main
=
argparse
.
ArgumentParser
()
p_main
=
argparse
.
ArgumentParser
()
p_main
.
add_argument
(
"
-V
"
,
"
--version
"
,
action
=
"
version
"
,
p_main
.
add_argument
(
"
-V
"
,
"
--version
"
,
action
=
"
version
"
,
version
=
installsystems
.
version
,
version
=
installsystems
.
version
,
help
=
"
show installsystems version
"
)
help
=
"
show installsystems version
"
)
p_main
.
add_argument
(
'
-d
'
,
"
--debug
"
,
action
=
ISAction
,
nargs
=
0
,
p_main
.
add_argument
(
'
-d
'
,
"
--debug
"
,
action
=
"
store_true
"
,
help
=
"
active debug mode
"
)
help
=
"
active debug mode
"
)
p_main
.
add_argument
(
'
-q
'
,
"
--quiet
"
,
action
=
ISAction
,
nargs
=
0
,
p_main
.
add_argument
(
'
-q
'
,
"
--quiet
"
,
action
=
"
store_true
"
,
help
=
"
active quiet mode
"
)
help
=
"
active quiet mode
"
)
subparsers
=
p_main
.
add_subparsers
()
subparsers
=
p_main
.
add_subparsers
()
...
@@ -73,4 +64,8 @@ p_build.add_argument("path", nargs = "?", default = ".")
...
@@ -73,4 +64,8 @@ p_build.add_argument("path", nargs = "?", default = ".")
p_build
.
set_defaults
(
func
=
build
)
p_build
.
set_defaults
(
func
=
build
)
# Parse and run
# Parse and run
args
=
p_main
.
parse_args
()
args
=
p_main
.
parse_args
()
# set debug and quiet mode
installsystems
.
debug
=
args
.
debug
installsystems
.
quiet
=
args
.
quiet
# exectue subparser functions
args
.
func
(
args
)
args
.
func
(
args
)
This diff is collapsed.
Click to expand it.
bin/isinstall
+
8
−
15
View file @
560029c1
...
@@ -17,26 +17,15 @@ from installsystems.repository import RepositoryManager, RepositoryConfig
...
@@ -17,26 +17,15 @@ from installsystems.repository import RepositoryManager, RepositoryConfig
from
installsystems.image
import
PackageImage
from
installsystems.image
import
PackageImage
from
installsystems.config
import
MainConfigFile
,
RepoConfigFile
from
installsystems.config
import
MainConfigFile
,
RepoConfigFile
class
ISAction
(
argparse
.
Action
):
'''
Set installsystems quiet/debug mode. Argparse callback
'''
def
__call__
(
self
,
parser
,
namespace
,
values
,
option_string
=
None
):
if
option_string
in
(
"
-q
"
,
"
--quiet
"
):
installsystems
.
debug
=
False
elif
option_string
in
(
"
-d
"
,
"
--debug
"
):
installsystems
.
debug
=
True
# Argument parsing loading
# Argument parsing loading
p_main
=
argparse
.
ArgumentParser
()
p_main
=
argparse
.
ArgumentParser
()
p_main
.
add_argument
(
"
-V
"
,
"
--version
"
,
action
=
"
version
"
,
p_main
.
add_argument
(
"
-V
"
,
"
--version
"
,
action
=
"
version
"
,
version
=
installsystems
.
version
,
version
=
installsystems
.
version
,
help
=
"
show installsystems version
"
)
help
=
"
show installsystems version
"
)
p_main
.
add_argument
(
'
-d
'
,
"
--debug
"
,
action
=
ISAction
,
nargs
=
0
,
p_main
.
add_argument
(
'
-d
'
,
"
--debug
"
,
action
=
"
store_true
"
,
help
=
"
active debug mode
"
)
help
=
"
active debug mode
"
)
p_main
.
add_argument
(
'
-q
'
,
"
--quiet
"
,
action
=
ISAction
,
nargs
=
0
,
p_main
.
add_argument
(
'
-q
'
,
"
--quiet
"
,
action
=
"
store_true
"
,
help
=
"
active quiet mode
"
)
help
=
"
active quiet mode
"
)
p_main
.
add_argument
(
"
--no-cache
"
,
action
=
"
store_false
"
,
default
=
False
,
p_main
.
add_argument
(
"
--no-cache
"
,
action
=
"
store_false
"
,
default
=
False
,
help
=
"
Not use persistent db caching
"
)
help
=
"
Not use persistent db caching
"
)
p_main
.
add_argument
(
"
-c
"
,
"
--config
"
,
dest
=
"
config
"
,
default
=
"
isinstall
"
,
p_main
.
add_argument
(
"
-c
"
,
"
--config
"
,
dest
=
"
config
"
,
default
=
"
isinstall
"
,
...
@@ -56,6 +45,10 @@ try:
...
@@ -56,6 +45,10 @@ try:
args
=
p_main
.
parse_known_args
()[
0
]
args
=
p_main
.
parse_known_args
()[
0
]
# load main config
# load main config
config
=
MainConfigFile
(
args
.
config
)
config
=
MainConfigFile
(
args
.
config
)
config
.
merge
(
args
)
# set debug and quiet mode after merge
installsystems
.
debug
=
args
.
debug
installsystems
.
quiet
=
args
.
quiet
# looks if arguments is a file or image name
# looks if arguments is a file or image name
if
istools
.
pathtype
(
args
.
image_name
)
==
"
file
"
and
os
.
path
.
isfile
(
args
.
image_name
):
if
istools
.
pathtype
(
args
.
image_name
)
==
"
file
"
and
os
.
path
.
isfile
(
args
.
image_name
):
pkg
=
PackageImage
(
istools
.
abspath
(
args
.
image_name
))
pkg
=
PackageImage
(
istools
.
abspath
(
args
.
image_name
))
...
...
This diff is collapsed.
Click to expand it.
bin/isrepo
+
18
−
26
View file @
560029c1
...
@@ -8,23 +8,12 @@ InstallSystems Repository Manipulation Tool
...
@@ -8,23 +8,12 @@ InstallSystems Repository Manipulation Tool
import
os
import
os
import
installsystems
import
installsystems
import
installsystems.argparse
as
argparse
# To
R
emove when python 2.7
import
installsystems.argparse
as
argparse
# To
be r
emove
d
when python 2.7
from
installsystems.printer
import
*
from
installsystems.printer
import
*
from
installsystems.repository
import
Repository
,
RepositoryConfig
from
installsystems.repository
import
Repository
,
RepositoryConfig
from
installsystems.image
import
PackageImage
from
installsystems.image
import
PackageImage
from
installsystems.config
import
MainConfigFile
,
RepoConfigFile
from
installsystems.config
import
MainConfigFile
,
RepoConfigFile
class
ISAction
(
argparse
.
Action
):
'''
Set installsystems quiet/debug mode. Argparse callback
'''
def
__call__
(
self
,
parser
,
namespace
,
values
,
option_string
=
None
):
if
option_string
in
(
"
-q
"
,
"
--quiet
"
):
installsystems
.
quiet
=
True
elif
option_string
in
(
"
-d
"
,
"
--debug
"
):
installsystems
.
debug
=
True
def
init
(
args
):
def
init
(
args
):
'''
'''
Create an empty fresh repo tree
Create an empty fresh repo tree
...
@@ -58,20 +47,20 @@ def delete(args):
...
@@ -58,20 +47,20 @@ def delete(args):
# Top level argument parsing
# Top level argument parsing
p_main
=
argparse
.
ArgumentParser
()
p_main
=
argparse
.
ArgumentParser
()
p_main
.
add_argument
(
"
-V
"
,
"
--version
"
,
action
=
"
version
"
,
p_main
.
add_argument
(
"
-V
"
,
"
--version
"
,
action
=
"
version
"
,
version
=
installsystems
.
version
,
version
=
installsystems
.
version
,
help
=
"
show installsystems version
"
)
help
=
"
show installsystems version
"
)
p_main
.
add_argument
(
'
-d
'
,
"
--debug
"
,
action
=
ISAction
,
nargs
=
0
,
p_main
.
add_argument
(
'
-d
'
,
"
--debug
"
,
action
=
"
store_true
"
,
help
=
"
active debug mode
"
)
help
=
"
active debug mode
"
)
p_main
.
add_argument
(
'
-q
'
,
"
--quiet
"
,
action
=
ISAction
,
nargs
=
0
,
p_main
.
add_argument
(
'
-q
'
,
"
--quiet
"
,
action
=
"
store_true
"
,
help
=
"
active quiet mode
"
)
help
=
"
active quiet mode
"
)
p_main
.
add_argument
(
"
-c
"
,
"
--config
"
,
default
=
"
isrepo
"
,
p_main
.
add_argument
(
"
-c
"
,
"
--config
"
,
default
=
"
isrepo
"
,
help
=
"
config file path
"
)
help
=
"
config file path
"
)
p_main
.
add_argument
(
"
-r
"
,
"
--repo-name
"
,
default
=
None
,
p_main
.
add_argument
(
"
-r
"
,
"
--repo-name
"
,
default
=
None
,
help
=
"
select repository by name in config files
"
)
help
=
"
select repository by name in config files
"
)
p_main
.
add_argument
(
"
-R
"
,
"
--repo-config
"
,
action
=
"
append
"
,
p_main
.
add_argument
(
"
-R
"
,
"
--repo-config
"
,
action
=
"
append
"
,
default
=
[
"
repository
"
],
default
=
[
"
repository
"
],
help
=
"
repository config (can be specified more than one time)
"
)
help
=
"
repository config (can be specified more than one time)
"
)
subparsers
=
p_main
.
add_subparsers
()
subparsers
=
p_main
.
add_subparsers
()
# Init command parser
# Init command parser
p_init
=
subparsers
.
add_parser
(
"
init
"
,
help
=
init
.
__doc__
.
lower
())
p_init
=
subparsers
.
add_parser
(
"
init
"
,
help
=
init
.
__doc__
.
lower
())
...
@@ -91,6 +80,9 @@ try:
...
@@ -91,6 +80,9 @@ try:
# load isinstall config
# load isinstall config
config
=
MainConfigFile
(
args
.
config
)
config
=
MainConfigFile
(
args
.
config
)
config
.
merge
(
args
)
config
.
merge
(
args
)
# set debug and quiet mode after merge
installsystems
.
debug
=
args
.
debug
installsystems
.
quiet
=
args
.
quiet
# load repo configs
# load repo configs
repos
=
[]
repos
=
[]
for
r_config
in
args
.
repo_config
:
for
r_config
in
args
.
repo_config
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment