annotate scripts/whitespacecleanup.sh @ 8288:5b1f43027662

scripts: drop isort --wrap-length 160 - it is broken with py3 and not really necessary Under Python 3, isort 4.3.21 failed with https://github.com/timothycrosley/isort/issues/741 on kallithea/controllers/api/api.py : Traceback (most recent call last): File "data/env/bin/isort", line 10, in <module> sys.exit(main()) File ".../env/lib64/python3.7/site-packages/isort/main.py", line 379, in main for sort_attempt in attempt_iterator: File ".../env/lib64/python3.7/site-packages/isort/main.py", line 377, in <genexpr> attempt_iterator = (sort_imports(file_name, **arguments) for file_name in file_names) File ".../env/lib64/python3.7/site-packages/isort/main.py", line 88, in sort_imports result = SortImports(file_name, **arguments) File ".../env/lib64/python3.7/site-packages/isort/isort.py", line 207, in __init__ self._add_formatted_imports() File ".../env/lib64/python3.7/site-packages/isort/isort.py", line 606, in _add_formatted_imports self._add_from_imports(from_modules, section, section_output, sort_ignore_case) File ".../env/lib64/python3.7/site-packages/isort/isort.py", line 526, in _add_from_imports import_statement = self._multi_line_reformat(import_start, from_import_section, comments) File ".../env/lib64/python3.7/site-packages/isort/isort.py", line 552, in _multi_line_reformat dynamic_indent, indent, line_length, comments) File ".../env/lib64/python3.7/site-packages/isort/isort.py", line 705, in _output_grid if len(next_statement.split(self.line_separator)[-1]) + 1 > line_length: TypeError: '>' not supported between instances of 'int' and 'str'
author Mads Kiilerich <mads@kiilerich.com>
date Tue, 10 Mar 2020 15:08:46 +0100
parents abb83e4edfd9
children 8d663d23ab85
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4727
9cf229b46e49 whitespacecleanup.sh - run regularly to ensure consistent spacing and avoid spurious changes
Mads Kiilerich <madski@unity3d.com>
parents:
diff changeset
1 #!/bin/bash -x
9cf229b46e49 whitespacecleanup.sh - run regularly to ensure consistent spacing and avoid spurious changes
Mads Kiilerich <madski@unity3d.com>
parents:
diff changeset
2
9cf229b46e49 whitespacecleanup.sh - run regularly to ensure consistent spacing and avoid spurious changes
Mads Kiilerich <madski@unity3d.com>
parents:
diff changeset
3 # Enforce some consistency in whitespace - just to avoid spurious whitespaces changes
9cf229b46e49 whitespacecleanup.sh - run regularly to ensure consistent spacing and avoid spurious changes
Mads Kiilerich <madski@unity3d.com>
parents:
diff changeset
4
7895
0288dd052033 vcs: drop unused lockfiles.py
Mads Kiilerich <mads@kiilerich.com>
parents: 7810
diff changeset
5 files=`hg mani | egrep -v '/fontello/|/email_templates/|(^LICENSE-MERGELY.html|^docs/Makefile|^scripts/whitespacecleanup.sh|/(graph|mergely|native.history)\.js|/test_dump_html_mails.ref.html|\.png|\.gif|\.ico|\.pot|\.po|\.mo|\.tar\.gz|\.diff)$'`
5379
1949ece749ce cleanup: fix whitespace in CONTRIBUTORS (and other forgotten files) too
Mads Kiilerich <madski@unity3d.com>
parents: 5378
diff changeset
6
6390
6e952212bf06 scripts: ensure unix line endings
Mads Kiilerich <mads@kiilerich.com>
parents: 6370
diff changeset
7 sed -i "s/`printf '\r'`//g" $files
5378
bdfba68cdfea cleanup: remove empty trailing lines
Mads Kiilerich <madski@unity3d.com>
parents: 5330
diff changeset
8 sed -i -e "s,`printf '\t'`, ,g" $files
bdfba68cdfea cleanup: remove empty trailing lines
Mads Kiilerich <madski@unity3d.com>
parents: 5330
diff changeset
9 sed -i -e "s, *$,,g" $files
5598
edb24bc0f71a cleanup: consistent space before line continuation backslash
Mads Kiilerich <madski@unity3d.com>
parents: 5517
diff changeset
10 sed -i -e 's,\([^ ]\)\\$,\1 \\,g' -e 's,\(["'"'"']["'"'"']["'"'"']\) \\$,\1\\,g' $files
5378
bdfba68cdfea cleanup: remove empty trailing lines
Mads Kiilerich <madski@unity3d.com>
parents: 5330
diff changeset
11 # ensure one trailing newline - remove empty last line and make last line include trailing newline:
bdfba68cdfea cleanup: remove empty trailing lines
Mads Kiilerich <madski@unity3d.com>
parents: 5330
diff changeset
12 sed -i -e '$,${/^$/d}' -e '$a\' $files
4727
9cf229b46e49 whitespacecleanup.sh - run regularly to ensure consistent spacing and avoid spurious changes
Mads Kiilerich <madski@unity3d.com>
parents:
diff changeset
13
5378
bdfba68cdfea cleanup: remove empty trailing lines
Mads Kiilerich <madski@unity3d.com>
parents: 5330
diff changeset
14 sed -i -e 's,\([^ /]\){,\1 {,g' `hg loc '*.css'`
bdfba68cdfea cleanup: remove empty trailing lines
Mads Kiilerich <madski@unity3d.com>
parents: 5330
diff changeset
15 sed -i -e 's|^\([^ /].*,\)\([^ ]\)|\1 \2|g' `hg loc '*.css'`
4727
9cf229b46e49 whitespacecleanup.sh - run regularly to ensure consistent spacing and avoid spurious changes
Mads Kiilerich <madski@unity3d.com>
parents:
diff changeset
16
5390
530bcb645d32 cleanup: set reasonable x bits
Mads Kiilerich <madski@unity3d.com>
parents: 5379
diff changeset
17 hg mani | xargs chmod -x
530bcb645d32 cleanup: set reasonable x bits
Mads Kiilerich <madski@unity3d.com>
parents: 5379
diff changeset
18 hg loc 'set:!binary()&grep("^#!")&!(**_tmpl.py)&!(**/template**)' | xargs chmod +x
530bcb645d32 cleanup: set reasonable x bits
Mads Kiilerich <madski@unity3d.com>
parents: 5379
diff changeset
19
7810
5698307382de scripts: introduce import cleanup using isort
Mads Kiilerich <mads@kiilerich.com>
parents: 7470
diff changeset
20 # isort is installed from dev_requirements.txt
8288
5b1f43027662 scripts: drop isort --wrap-length 160 - it is broken with py3 and not really necessary
Mads Kiilerich <mads@kiilerich.com>
parents: 8287
diff changeset
21 hg loc 'set:!binary()&grep("^#!.*python")' '*.py' | xargs isort --line-width 160 --lines-after-imports 2
7810
5698307382de scripts: introduce import cleanup using isort
Mads Kiilerich <mads@kiilerich.com>
parents: 7470
diff changeset
22
4727
9cf229b46e49 whitespacecleanup.sh - run regularly to ensure consistent spacing and avoid spurious changes
Mads Kiilerich <madski@unity3d.com>
parents:
diff changeset
23 hg diff