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
a3e072bb
Kaydet (Commit)
a3e072bb
authored
Tem 30, 2011
tarafından
Éric Araujo
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Let “make patchcheck” work for out-of-dir builds (#9860)
üst
b603b277
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
patchcheck.py
Tools/scripts/patchcheck.py
+13
-7
No files found.
Tools/scripts/patchcheck.py
Dosyayı görüntüle @
a3e072bb
...
...
@@ -4,11 +4,15 @@ import sys
import
shutil
import
os.path
import
subprocess
import
sysconfig
import
reindent
import
untabify
SRCDIR
=
sysconfig
.
get_config_var
(
'srcdir'
)
def
n_files_str
(
count
):
"""Return 'N file(s)' with the proper plurality on 'file'."""
return
"{} file{}"
.
format
(
count
,
"s"
if
count
!=
1
else
""
)
...
...
@@ -36,7 +40,7 @@ def status(message, modal=False, info=None):
info
=
lambda
x
:
n_files_str
(
len
(
x
)))
def
changed_files
():
"""Get the list of changed or added files from the VCS."""
if
os
.
path
.
isdir
(
'.hg'
):
if
os
.
path
.
isdir
(
os
.
path
.
join
(
SRCDIR
,
'.hg'
)
):
vcs
=
'hg'
cmd
=
'hg status --added --modified --no-status'
elif
os
.
path
.
isdir
(
'.svn'
):
...
...
@@ -75,7 +79,7 @@ def normalize_whitespace(file_paths):
reindent
.
makebackup
=
False
# No need to create backups.
fixed
=
[]
for
path
in
(
x
for
x
in
file_paths
if
x
.
endswith
(
'.py'
)):
if
reindent
.
check
(
path
):
if
reindent
.
check
(
os
.
path
.
join
(
SRCDIR
,
path
)
):
fixed
.
append
(
path
)
return
fixed
...
...
@@ -85,10 +89,11 @@ def normalize_c_whitespace(file_paths):
"""Report if any C files """
fixed
=
[]
for
path
in
file_paths
:
with
open
(
path
,
'r'
)
as
f
:
abspath
=
os
.
path
.
join
(
SRCDIR
,
path
)
with
open
(
abspath
,
'r'
)
as
f
:
if
'
\t
'
not
in
f
.
read
():
continue
untabify
.
process
(
path
,
8
,
verbose
=
False
)
untabify
.
process
(
abs
path
,
8
,
verbose
=
False
)
fixed
.
append
(
path
)
return
fixed
...
...
@@ -99,13 +104,14 @@ ws_re = re.compile(br'\s+(\r?\n)$')
def
normalize_docs_whitespace
(
file_paths
):
fixed
=
[]
for
path
in
file_paths
:
abspath
=
os
.
path
.
join
(
SRCDIR
,
path
)
try
:
with
open
(
path
,
'rb'
)
as
f
:
with
open
(
abs
path
,
'rb'
)
as
f
:
lines
=
f
.
readlines
()
new_lines
=
[
ws_re
.
sub
(
br
'
\1
'
,
line
)
for
line
in
lines
]
if
new_lines
!=
lines
:
shutil
.
copyfile
(
path
,
path
+
'.bak'
)
with
open
(
path
,
'wb'
)
as
f
:
shutil
.
copyfile
(
abspath
,
abs
path
+
'.bak'
)
with
open
(
abs
path
,
'wb'
)
as
f
:
f
.
writelines
(
new_lines
)
fixed
.
append
(
path
)
except
Exception
as
err
:
...
...
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