@@ -1779,11 +1779,13 @@ def __init__(self, *args, **kwargs):
1779
1779
# build options from the command line
1780
1780
self .checker_class = kwargs .pop ('checker_class' , Checker )
1781
1781
parse_argv = kwargs .pop ('parse_argv' , False )
1782
+ config_file = kwargs .pop ('config_file' , False )
1782
1783
parser = kwargs .pop ('parser' , None )
1783
1784
# build options from dict
1784
1785
options_dict = dict (* args , ** kwargs )
1785
1786
arglist = None if parse_argv else options_dict .get ('paths' , None )
1786
- options , self .paths = process_options (arglist , parse_argv , parser )
1787
+ options , self .paths = process_options (
1788
+ arglist , parse_argv , config_file , parser )
1787
1789
if options_dict :
1788
1790
options .__dict__ .update (options_dict )
1789
1791
if 'paths' in options_dict :
@@ -2035,8 +2037,13 @@ def read_config(options, args, arglist, parser):
2035
2037
return options
2036
2038
2037
2039
2038
- def process_options (arglist = None , parse_argv = False , parser = None ):
2039
- """Process options passed either via arglist or via command line args."""
2040
+ def process_options (arglist = None , parse_argv = False , config_file = None ,
2041
+ parser = None ):
2042
+ """Process options passed either via arglist or via command line args.
2043
+
2044
+ Passing in the ``config_file`` parameter allows other tools, such as flake8
2045
+ to specify their own options to be processed in pep8.
2046
+ """
2040
2047
if not parser :
2041
2048
parser = get_parser ()
2042
2049
if not parser .has_option ('--config' ):
@@ -2045,7 +2052,7 @@ def process_options(arglist=None, parse_argv=False, parser=None):
2045
2052
"tox.ini file or the setup.cfg file located in any parent folder "
2046
2053
"of the path(s) being processed. Allowed options are: %s." %
2047
2054
(parser .prog , ', ' .join (parser .config_options ))))
2048
- group .add_option ('--config' , metavar = 'path' , default = None ,
2055
+ group .add_option ('--config' , metavar = 'path' , default = config_file ,
2049
2056
help = "user config file location" )
2050
2057
# Don't read the command line if the module is used as a library.
2051
2058
if not arglist and not parse_argv :
0 commit comments