##// END OF EJS Templates
scripts: introduce import cleanup using isort
Mads Kiilerich -
r7717:56983073 default
parent child Browse files
Show More
@@ -1,8 +1,9 b''
1 pytest >= 3.3.0, < 4.7
1 pytest >= 3.3.0, < 4.7
2 pytest-runner < 5.2
2 pytest-runner < 5.2
3 pytest-sugar >= 0.7.0, < 0.10
3 pytest-sugar >= 0.7.0, < 0.10
4 pytest-benchmark < 3.3
4 pytest-benchmark < 3.3
5 pytest-localserver < 0.6
5 pytest-localserver < 0.6
6 mock < 3.1
6 mock < 3.1
7 Sphinx < 1.9
7 Sphinx < 1.9
8 WebTest < 2.1
8 WebTest < 2.1
9 isort == 4.3.21
@@ -1,20 +1,23 b''
1 #!/bin/bash -x
1 #!/bin/bash -x
2
2
3 # Enforce some consistency in whitespace - just to avoid spurious whitespaces changes
3 # Enforce some consistency in whitespace - just to avoid spurious whitespaces changes
4
4
5 files=`hg mani | egrep -v '/fontello/|/email_templates/|(/lockfiles.py|^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)$'`
5 files=`hg mani | egrep -v '/fontello/|/email_templates/|(/lockfiles.py|^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)$'`
6
6
7 sed -i "s/`printf '\r'`//g" $files
7 sed -i "s/`printf '\r'`//g" $files
8 sed -i -e "s,`printf '\t'`, ,g" $files
8 sed -i -e "s,`printf '\t'`, ,g" $files
9 sed -i -e "s, *$,,g" $files
9 sed -i -e "s, *$,,g" $files
10 sed -i -e 's,\([^ ]\)\\$,\1 \\,g' -e 's,\(["'"'"']["'"'"']["'"'"']\) \\$,\1\\,g' $files
10 sed -i -e 's,\([^ ]\)\\$,\1 \\,g' -e 's,\(["'"'"']["'"'"']["'"'"']\) \\$,\1\\,g' $files
11 # ensure one trailing newline - remove empty last line and make last line include trailing newline:
11 # ensure one trailing newline - remove empty last line and make last line include trailing newline:
12 sed -i -e '$,${/^$/d}' -e '$a\' $files
12 sed -i -e '$,${/^$/d}' -e '$a\' $files
13
13
14 sed -i -e 's,\([^ /]\){,\1 {,g' `hg loc '*.css'`
14 sed -i -e 's,\([^ /]\){,\1 {,g' `hg loc '*.css'`
15 sed -i -e 's|^\([^ /].*,\)\([^ ]\)|\1 \2|g' `hg loc '*.css'`
15 sed -i -e 's|^\([^ /].*,\)\([^ ]\)|\1 \2|g' `hg loc '*.css'`
16
16
17 hg mani | xargs chmod -x
17 hg mani | xargs chmod -x
18 hg loc 'set:!binary()&grep("^#!")&!(**_tmpl.py)&!(**/template**)' | xargs chmod +x
18 hg loc 'set:!binary()&grep("^#!")&!(**_tmpl.py)&!(**/template**)' | xargs chmod +x
19
19
20 # isort is installed from dev_requirements.txt
21 isort --line-width 160 --wrap-length 160 --lines-after-imports 2 `hg loc '*.py'`
22
20 hg diff
23 hg diff
General Comments 0
You need to be logged in to leave comments. Login now