[Python-checkins] Mark files as executable that are meant as scripts. (GH-15354)

T. Wouters webhook-mailer at python.org
Mon Sep 9 10:16:37 EDT 2019


https://github.com/python/cpython/commit/fa3a38d81faaf96d17b5a7f0248b9923e3a648cc
commit: fa3a38d81faaf96d17b5a7f0248b9923e3a648cc
branch: master
author: Greg Price <gnprice at gmail.com>
committer: T. Wouters <thomas at python.org>
date: 2019-09-09T07:16:33-07:00
summary:

Mark files as executable that are meant as scripts. (GH-15354)

This is the converse of GH-15353 -- in addition to plenty of
scripts in the tree that are marked with the executable bit
(and so can be directly executed), there are a few that have
a leading `#!` which could let them be executed, but it doesn't
do anything because they don't have the executable bit set.

Here's a command which finds such files and marks them.  The
first line finds files in the tree with a `#!` line *anywhere*;
the next-to-last step checks that the *first* line is actually of
that form.  In between we filter out files that already have the
bit set, and some files that are meant as fragments to be
consumed by one or another kind of preprocessor.

    $ git grep -l '^#!' \
      | grep -vxFf <( \
          git ls-files --stage \
          | perl -lane 'print $F[3] if (!/^100644/)' \
        ) \
      | grep -ve '\.in$' -e '^Doc/includes/' \
      | while read f; do
          head -c2 "$f" | grep -qxF '#!' \
          && chmod a+x "$f"; \
        done

files:
M Lib/pydoc.py
M Lib/turtledemo/__main__.py
M Lib/turtledemo/sorting_animate.py
M Misc/python-wing3.wpr
M Misc/python-wing4.wpr
M Misc/python-wing5.wpr
M PCbuild/fix_encoding.py
M PCbuild/get_external.py
M PCbuild/prepare_ssl.py
M Parser/asdl_c.py
M Tools/scripts/generate_token.py

diff --git a/Lib/pydoc.py b/Lib/pydoc.py
old mode 100644
new mode 100755
diff --git a/Lib/turtledemo/__main__.py b/Lib/turtledemo/__main__.py
old mode 100644
new mode 100755
diff --git a/Lib/turtledemo/sorting_animate.py b/Lib/turtledemo/sorting_animate.py
old mode 100644
new mode 100755
diff --git a/Misc/python-wing3.wpr b/Misc/python-wing3.wpr
old mode 100644
new mode 100755
diff --git a/Misc/python-wing4.wpr b/Misc/python-wing4.wpr
old mode 100644
new mode 100755
diff --git a/Misc/python-wing5.wpr b/Misc/python-wing5.wpr
old mode 100644
new mode 100755
diff --git a/PCbuild/fix_encoding.py b/PCbuild/fix_encoding.py
old mode 100644
new mode 100755
diff --git a/PCbuild/get_external.py b/PCbuild/get_external.py
old mode 100644
new mode 100755
diff --git a/PCbuild/prepare_ssl.py b/PCbuild/prepare_ssl.py
old mode 100644
new mode 100755
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
old mode 100644
new mode 100755
diff --git a/Tools/scripts/generate_token.py b/Tools/scripts/generate_token.py
old mode 100644
new mode 100755



More information about the Python-checkins mailing list