Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
70cb1875
Kaydet (Commit)
70cb1875
authored
Haz 24, 2017
tarafından
Brett Cannon
Kaydeden (comit)
GitHub
Haz 24, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Check the whitespace of pull requests on Travis (GH-2367)
üst
13e96cc5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
2 deletions
+37
-2
.travis.yml
.travis.yml
+5
-0
patchcheck.py
Tools/scripts/patchcheck.py
+32
-2
No files found.
.travis.yml
Dosyayı görüntüle @
70cb1875
...
@@ -89,6 +89,11 @@ before_script:
...
@@ -89,6 +89,11 @@ before_script:
fi
fi
script
:
script
:
# Using the built Python as patchcheck.py is built around the idea of using
# a checkout-build of CPython to know things like what base branch the changes
# should be compared against.
# Only run on Linux as the check only needs to be run once.
-
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./python Tools/scripts/patchcheck.py --travis $TRAVIS_PULL_REQUEST; fi
# `-r -w` implicitly provided through `make buildbottest`.
# `-r -w` implicitly provided through `make buildbottest`.
-
make buildbottest TESTOPTS="-j4 -uall,-cpu,-tzdata"
-
make buildbottest TESTOPTS="-j4 -uall,-cpu,-tzdata"
...
...
Tools/scripts/patchcheck.py
Dosyayı görüntüle @
70cb1875
#!/usr/bin/env python3
#!/usr/bin/env python3
"""Check proposed changes for common issues."""
import
re
import
re
import
sys
import
sys
import
shutil
import
shutil
...
@@ -135,7 +136,7 @@ def report_modified_files(file_paths):
...
@@ -135,7 +136,7 @@ def report_modified_files(file_paths):
return
"
\n
"
.
join
(
lines
)
return
"
\n
"
.
join
(
lines
)
@status
(
"Fixing whitespace"
,
info
=
report_modified_files
)
@status
(
"Fixing
Python file
whitespace"
,
info
=
report_modified_files
)
def
normalize_whitespace
(
file_paths
):
def
normalize_whitespace
(
file_paths
):
"""Make sure that the whitespace for .py files have been normalized."""
"""Make sure that the whitespace for .py files have been normalized."""
reindent
.
makebackup
=
False
# No need to create backups.
reindent
.
makebackup
=
False
# No need to create backups.
...
@@ -212,6 +213,27 @@ def regenerated_pyconfig_h_in(file_paths):
...
@@ -212,6 +213,27 @@ def regenerated_pyconfig_h_in(file_paths):
else
:
else
:
return
"not needed"
return
"not needed"
def
travis
(
pull_request
):
if
pull_request
==
'false'
:
print
(
'Not a pull request; skipping'
)
return
base_branch
=
get_base_branch
()
file_paths
=
changed_files
(
base_branch
)
python_files
=
[
fn
for
fn
in
file_paths
if
fn
.
endswith
(
'.py'
)]
c_files
=
[
fn
for
fn
in
file_paths
if
fn
.
endswith
((
'.c'
,
'.h'
))]
doc_files
=
[
fn
for
fn
in
file_paths
if
fn
.
startswith
(
'Doc'
)
and
fn
.
endswith
((
'.rst'
,
'.inc'
))]
fixed
=
[]
fixed
.
extend
(
normalize_whitespace
(
python_files
))
fixed
.
extend
(
normalize_c_whitespace
(
c_files
))
fixed
.
extend
(
normalize_docs_whitespace
(
doc_files
))
if
not
fixed
:
print
(
'No whitespace issues found'
)
else
:
print
(
f
'Please fix the {len(fixed)} file(s) with whitespace issues'
)
print
(
'(on UNIX you can run `make patchcheck` to make the fixes)'
)
sys
.
exit
(
1
)
def
main
():
def
main
():
base_branch
=
get_base_branch
()
base_branch
=
get_base_branch
()
file_paths
=
changed_files
(
base_branch
)
file_paths
=
changed_files
(
base_branch
)
...
@@ -246,4 +268,12 @@ def main():
...
@@ -246,4 +268,12 @@ def main():
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
main
()
import
argparse
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
parser
.
add_argument
(
'--travis'
,
help
=
'Perform pass/fail checks'
)
args
=
parser
.
parse_args
()
if
args
.
travis
:
travis
(
args
.
travis
)
else
:
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment