Skip to content

Commit

Permalink
Mark files as executable that are meant as scripts. (pythonGH-15354)
Browse files Browse the repository at this point in the history
This is the converse of pythonGH-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
  • Loading branch information
gnprice authored and Yhg1s committed Sep 9, 2019
1 parent e3c59a7 commit fa3a38d
Show file tree
Hide file tree
Showing 11 changed files with 0 additions and 0 deletions.
Empty file modified Lib/pydoc.py
100644 → 100755
Empty file.
Empty file modified Lib/turtledemo/__main__.py
100644 → 100755
Empty file.
Empty file modified Lib/turtledemo/sorting_animate.py
100644 → 100755
Empty file.
Empty file modified Misc/python-wing3.wpr
100644 → 100755
Empty file.
Empty file modified Misc/python-wing4.wpr
100644 → 100755
Empty file.
Empty file modified Misc/python-wing5.wpr
100644 → 100755
Empty file.
Empty file modified PCbuild/fix_encoding.py
100644 → 100755
Empty file.
Empty file modified PCbuild/get_external.py
100644 → 100755
Empty file.
Empty file modified PCbuild/prepare_ssl.py
100644 → 100755
Empty file.
Empty file modified Parser/asdl_c.py
100644 → 100755
Empty file.
Empty file modified Tools/scripts/generate_token.py
100644 → 100755
Empty file.

0 comments on commit fa3a38d

Please sign in to comment.