patman: import gitutil module where it is needed
Instead of propagating it from the module entry point (main script). Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
8b73f9bf9e
commit
57e3b03fe1
@ -21,7 +21,6 @@ if __name__ == "__main__":
|
||||
# Our modules
|
||||
from patman import control
|
||||
from patman import func_test
|
||||
from patman import gitutil
|
||||
from patman import project
|
||||
from patman import settings
|
||||
from patman import terminal
|
||||
@ -118,7 +117,7 @@ status.add_argument('-f', '--force', action='store_true',
|
||||
argv = sys.argv[1:]
|
||||
args, rest = parser.parse_known_args(argv)
|
||||
if hasattr(args, 'project'):
|
||||
settings.Setup(gitutil, parser, args.project, '')
|
||||
settings.Setup(parser, args.project, '')
|
||||
args, rest = parser.parse_known_args(argv)
|
||||
|
||||
# If we have a command, it is safe to parse all arguments
|
||||
|
@ -11,6 +11,8 @@ import argparse
|
||||
import os
|
||||
import re
|
||||
|
||||
from patman import gitutil
|
||||
|
||||
"""Default settings per-project.
|
||||
|
||||
These are used by _ProjectConfigParser. Settings names should match
|
||||
@ -190,7 +192,7 @@ def ReadGitAliases(fname):
|
||||
fd.close()
|
||||
|
||||
|
||||
def CreatePatmanConfigFile(gitutil, config_fname):
|
||||
def CreatePatmanConfigFile(config_fname):
|
||||
"""Creates a config file under $(HOME)/.patman if it can't find one.
|
||||
|
||||
Args:
|
||||
@ -331,7 +333,7 @@ def GetItems(config, section):
|
||||
return []
|
||||
|
||||
|
||||
def Setup(gitutil, parser, project_name, config_fname=''):
|
||||
def Setup(parser, project_name, config_fname=''):
|
||||
"""Set up the settings module by reading config files.
|
||||
|
||||
Args:
|
||||
@ -348,7 +350,7 @@ def Setup(gitutil, parser, project_name, config_fname=''):
|
||||
|
||||
if not os.path.exists(config_fname):
|
||||
print("No config file found ~/.patman\nCreating one...\n")
|
||||
CreatePatmanConfigFile(gitutil, config_fname)
|
||||
CreatePatmanConfigFile(config_fname)
|
||||
|
||||
config.read(config_fname)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user