Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Sat, 14 Nov 2015 21:57:22 UTC Commit: 59e13f9e446acfc901d9ff42245b1d2da964ed30 https://github.com/geany/geany/commit/59e13f9e446acfc901d9ff42245b1d2da964ed...
Log Message: ----------- Add a script to update Python filetype's identifiers list
Modified Paths: -------------- scripts/update-python-identifiers.sh
Modified: scripts/update-python-identifiers.sh 26 lines changed, 26 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,26 @@ +#!/bin/sh +# +# Author: Colomban Wendling colomban@geany.org +# License: GPL v2 or later +# +# Updates the `identifiers` entry in data/filetypes.python. +# Requires both Python 2 and 3. + +set -e + +file=data/filetypes.python + +[ -f "$file" ] + +py2_builtins=$(python2 -c 'print("\n".join(dir(__builtins__)))') +py3_builtins=$(python3 -c 'print("\n".join(dir(__builtins__)))') + +# merge Python 2 and 3 keywords but exclude the ones that are already listed primary= +identifiers=$( (echo "$py2_builtins" && echo "$py3_builtins") | python -c '\ +from sys import stdin; \ +builtins=set(stdin.read().strip().split("\n")); \ +exclude=["False", "None", "True", "exec"]; \ +print(" ".join(sorted([i for i in builtins if i not in exclude]))) +') + +sed -e "s/^identifiers=.*$/identifiers=$identifiers/" -i "$file"
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).