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
790932c4
Commit
790932c4
authored
Apr 22, 1999
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add command line flags to just list the files that contain the
offending lines or to include line numbers in the output.
parent
db40debd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
Doc/tools/findmodrefs
Doc/tools/findmodrefs
+20
-2
No files found.
Doc/tools/findmodrefs
View file @
790932c4
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
# -*- Python -*-
# -*- Python -*-
import
fileinput
import
fileinput
import
getopt
import
glob
import
glob
import
os
import
os
import
re
import
re
...
@@ -15,7 +16,15 @@ module_rx = re.compile(r"\\module{([a-zA-Z_0-9]+)}")
...
@@ -15,7 +16,15 @@ module_rx = re.compile(r"\\module{([a-zA-Z_0-9]+)}")
def
main
():
def
main
():
try
:
try
:
files
=
sys
.
argv
[
1
:]
just_list
=
0
print_lineno
=
0
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
"ln"
,
[
"list"
,
"number"
])
for
opt
,
arg
in
opts
:
if
opt
in
(
"-l"
,
"--list"
):
just_list
=
1
elif
opt
in
(
"-n"
,
"--number"
):
print_lineno
=
1
files
=
args
if
not
files
:
if
not
files
:
files
=
glob
.
glob
(
"*.tex"
)
files
=
glob
.
glob
(
"*.tex"
)
files
.
sort
()
files
.
sort
()
...
@@ -36,7 +45,16 @@ def main():
...
@@ -36,7 +45,16 @@ def main():
if
m
:
if
m
:
name
=
m
.
group
(
1
)
name
=
m
.
group
(
1
)
if
name
!=
modulename
:
if
name
!=
modulename
:
print
"%s:%s"
%
(
fileinput
.
filename
(),
line
[:
-
1
])
filename
=
fileinput
.
filename
()
if
just_list
:
print
filename
fileinput
.
nextfile
()
modulename
=
None
elif
print_lineno
:
print
"%s(%d):%s"
\
%
(
filename
,
fileinput
.
filelineno
(),
line
[:
-
1
])
else
:
print
"%s:%s"
%
(
filename
,
line
[:
-
1
])
except
KeyboardInterrupt
:
except
KeyboardInterrupt
:
sys
.
exit
(
1
)
sys
.
exit
(
1
)
...
...
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