Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Boxiang Sun
Pyston
Commits
725661bb
Commit
725661bb
authored
May 13, 2015
by
Michael Arntzenius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix linter to allow comments after includes
parent
e9090a32
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
tools/lint.py
tools/lint.py
+8
-4
No files found.
tools/lint.py
View file @
725661bb
import
os
import
sys
import
re
def
file_is_from_cpython
(
fn
):
if
'from_cpython'
in
fn
:
...
...
@@ -49,6 +50,8 @@ PYSTON_SRC_SUBDIRS = [bn for bn in os.listdir(PYSTON_SRC_DIR) if os.path.isdir(o
CAPI_HEADER_DIR
=
os
.
path
.
join
(
PYSTON_SRC_DIR
,
"../from_cpython/Include"
)
CAPI_HEADERS
=
[
bn
for
bn
in
os
.
listdir
(
CAPI_HEADER_DIR
)
if
bn
.
endswith
(
".h"
)]
include_re
=
re
.
compile
(
r'^\
#i
nclude \
s+ (<.+?>|
".+?") (?:\
s+ //.*)? $
', re.VERBOSE)
def verify_include_order(_, dir, files):
for bn in files:
fn = os.path.join(dir, bn)
...
...
@@ -71,10 +74,11 @@ def verify_include_order(_, dir, files):
section = None
continue
if
l
.
startswith
(
"#include"
):
m = include_re.match(l)
if m:
if section is None:
section = []
section
.
append
(
l
)
section.append(
m.group(1)
)
continue
if l.startswith("#ifndef PYSTON") or l.startswith("#define PYSTON"):
...
...
@@ -99,7 +103,7 @@ def verify_include_order(_, dir, files):
def is_third_party_section(section):
for incl in section:
if
incl
.
startswith
(
'
#include
"llvm/'
):
if incl.startswith('"llvm/'):
continue
if '"
opagent
.
h
"' in incl:
continue
...
...
@@ -119,7 +123,7 @@ def verify_include_order(_, dir, files):
# TODO generate this
include_dirs = PYSTON_SRC_SUBDIRS
for incl in section:
if
not
any
(
incl
.
startswith
(
'
#include
"%s/'
%
d
)
for
d
in
include_dirs
):
if not any(incl.startswith('"
%
s
/
' % d) for d in include_dirs):
return False
return True
...
...
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