diff options
author | Gregory P. Smith <greg@krypto.org> | 2017-05-27 16:40:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-27 16:40:45 -0700 |
commit | 178418ad6791b6ef5ba610ed93fab75fc1567ad2 (patch) | |
tree | cf11e4194db22aacc506e4521523b7ac689c2341 | |
parent | bpo-30290: IDLE: Refactor help_about to PEP8 names (#1714) (diff) | |
download | cpython-178418ad6791b6ef5ba610ed93fab75fc1567ad2.tar.gz cpython-178418ad6791b6ef5ba610ed93fab75fc1567ad2.tar.bz2 cpython-178418ad6791b6ef5ba610ed93fab75fc1567ad2.zip |
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.
-rw-r--r-- | Makefile.pre.in | 2 | ||||
-rwxr-xr-x | Tools/clinic/clinic.py | 12 |
2 files changed, 11 insertions, 3 deletions
diff --git a/Makefile.pre.in b/Makefile.pre.in index 0aefcf2a307..ee1cd4a0280 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -528,7 +528,7 @@ coverage-report: regen-grammar regen-importlib # (depends on python having already been built) .PHONY=clinic clinic: $(BUILDPYTHON) $(srcdir)/Modules/_blake2/blake2s_impl.c - $(RUNSHARED) $(PYTHON_FOR_BUILD) ./Tools/clinic/clinic.py --make + $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/Tools/clinic/clinic.py --make --srcdir $(srcdir) # Build the interpreter $(BUILDPYTHON): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index 6be0ab2b3d1..0845a8e9b19 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) |