summaryrefslogtreecommitdiffstats
path: root/Tools/clinic
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2017-05-27 23:40:45 (GMT)
committerGitHub <noreply@github.com>2017-05-27 23:40:45 (GMT)
commit178418ad6791b6ef5ba610ed93fab75fc1567ad2 (patch)
treecf11e4194db22aacc506e4521523b7ac689c2341 /Tools/clinic
parent5a346d5dbc1f0f70eca706a8ba19f7645bf17837 (diff)
downloadcpython-178418ad6791b6ef5ba610ed93fab75fc1567ad2.zip
cpython-178418ad6791b6ef5ba610ed93fab75fc1567ad2.tar.gz
cpython-178418ad6791b6ef5ba610ed93fab75fc1567ad2.tar.bz2
bpo-30492: Allow make clinic to work out of tree. (#1836)
* bpo-30492: Allow make clinic to work out of tree. * Use os.curdir instead of "." as the default value.
Diffstat (limited to 'Tools/clinic')
-rwxr-xr-xTools/clinic/clinic.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
index 6be0ab2..0845a8e 100755
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -4335,7 +4335,10 @@ def main(argv):
cmdline.add_argument("-o", "--output", type=str)
cmdline.add_argument("-v", "--verbose", action='store_true')
cmdline.add_argument("--converters", action='store_true')
- cmdline.add_argument("--make", action='store_true')
+ cmdline.add_argument("--make", action='store_true',
+ help="Walk --srcdir to run over all relevant files.")
+ cmdline.add_argument("--srcdir", type=str, default=os.curdir,
+ help="The directory tree to walk in --make mode.")
cmdline.add_argument("filename", type=str, nargs="*")
ns = cmdline.parse_args(argv)
@@ -4406,7 +4409,12 @@ def main(argv):
print()
cmdline.print_usage()
sys.exit(-1)
- for root, dirs, files in os.walk('.'):
+ if not ns.srcdir:
+ print("Usage error: --srcdir must not be empty with --make.")
+ print()
+ cmdline.print_usage()
+ sys.exit(-1)
+ for root, dirs, files in os.walk(ns.srcdir):
for rcs_dir in ('.svn', '.git', '.hg', 'build', 'externals'):
if rcs_dir in dirs:
dirs.remove(rcs_dir)