Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
eb5be2fb
Commit
eb5be2fb
authored
Jul 26, 2011
by
Éric Araujo
Browse files
Options
Browse Files
Download
Plain Diff
Branch merge.
I moved the NEWS entry for the reindent fix to the right release section.
parents
ad964ab2
904a569a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
Misc/NEWS
Misc/NEWS
+6
-0
Tools/scripts/reindent.py
Tools/scripts/reindent.py
+12
-3
No files found.
Misc/NEWS
View file @
eb5be2fb
...
@@ -108,6 +108,11 @@ Build
...
@@ -108,6 +108,11 @@ Build
- Issue #12372: POSIX semaphores are broken on AIX: don't use them.
- Issue #12372: POSIX semaphores are broken on AIX: don't use them.
Tools/Demos
-----------
- Issue #10639: reindent.py no longer converts newlines and will raise
an error if attempting to convert a file with mixed newlines.
Tests
Tests
-----
-----
...
@@ -311,6 +316,7 @@ Build
...
@@ -311,6 +316,7 @@ Build
"make install" creates symlinks in --prefix bin for the "-32" files in the
"make install" creates symlinks in --prefix bin for the "-32" files in the
framework bin directory like the installer does.
framework bin directory like the installer does.
Tests
Tests
-----
-----
...
...
Tools/scripts/reindent.py
View file @
eb5be2fb
...
@@ -35,7 +35,7 @@ tabnanny.py, reindent should do a good job.
...
@@ -35,7 +35,7 @@ tabnanny.py, reindent should do a good job.
The backup file is a copy of the one that is being reindented. The ".bak"
The backup file is a copy of the one that is being reindented. The ".bak"
file is generated with shutil.copy(), but some corner cases regarding
file is generated with shutil.copy(), but some corner cases regarding
user/group and permissions could leave the backup file more readable tha
t
user/group and permissions could leave the backup file more readable tha
n
you'd prefer. You can always use the --nobackup option to prevent this.
you'd prefer. You can always use the --nobackup option to prevent this.
"""
"""
...
@@ -109,7 +109,7 @@ def check(file):
...
@@ -109,7 +109,7 @@ def check(file):
if
verbose
:
if
verbose
:
print
(
"checking"
,
file
,
"..."
,
end
=
' '
)
print
(
"checking"
,
file
,
"..."
,
end
=
' '
)
with
open
(
file
,
'rb'
)
as
f
:
with
open
(
file
,
'rb'
)
as
f
:
encoding
,
_
=
tokenize
.
detect_encoding
(
f
.
readline
)
encoding
,
_
=
tokenize
.
detect_encoding
(
f
.
readline
)
try
:
try
:
with
open
(
file
,
encoding
=
encoding
)
as
f
:
with
open
(
file
,
encoding
=
encoding
)
as
f
:
...
@@ -118,6 +118,11 @@ def check(file):
...
@@ -118,6 +118,11 @@ def check(file):
errprint
(
"%s: I/O Error: %s"
%
(
file
,
str
(
msg
)))
errprint
(
"%s: I/O Error: %s"
%
(
file
,
str
(
msg
)))
return
return
newline
=
r
.
newlines
if
isinstance
(
newline
,
tuple
):
errprint
(
"%s: mixed newlines detected; cannot process file"
%
file
)
return
if
r
.
run
():
if
r
.
run
():
if
verbose
:
if
verbose
:
print
(
"changed."
)
print
(
"changed."
)
...
@@ -129,7 +134,7 @@ def check(file):
...
@@ -129,7 +134,7 @@ def check(file):
shutil
.
copyfile
(
file
,
bak
)
shutil
.
copyfile
(
file
,
bak
)
if
verbose
:
if
verbose
:
print
(
"backed up"
,
file
,
"to"
,
bak
)
print
(
"backed up"
,
file
,
"to"
,
bak
)
with
open
(
file
,
"w"
,
encoding
=
encoding
)
as
f
:
with
open
(
file
,
"w"
,
encoding
=
encoding
,
newline
=
newline
)
as
f
:
r
.
write
(
f
)
r
.
write
(
f
)
if
verbose
:
if
verbose
:
print
(
"wrote new"
,
file
)
print
(
"wrote new"
,
file
)
...
@@ -177,6 +182,10 @@ class Reindenter:
...
@@ -177,6 +182,10 @@ class Reindenter:
# indeed, they're our headache!
# indeed, they're our headache!
self
.
stats
=
[]
self
.
stats
=
[]
# Save the newlines found in the file so they can be used to
# create output without mutating the newlines.
self
.
newlines
=
f
.
newlines
def
run
(
self
):
def
run
(
self
):
tokens
=
tokenize
.
generate_tokens
(
self
.
getline
)
tokens
=
tokenize
.
generate_tokens
(
self
.
getline
)
for
_token
in
tokens
:
for
_token
in
tokens
:
...
...
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