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
be614ee7
Commit
be614ee7
authored
Jan 02, 2001
by
Jack Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use re in stead of regex.
parent
ef92edd9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
31 deletions
+34
-31
Mac/scripts/MkDistr.py
Mac/scripts/MkDistr.py
+3
-3
Mac/scripts/fullbuild.py
Mac/scripts/fullbuild.py
+5
-5
Mac/scripts/mkestrres.py
Mac/scripts/mkestrres.py
+26
-23
No files found.
Mac/scripts/MkDistr.py
View file @
be614ee7
...
...
@@ -16,7 +16,7 @@
#
from
MkDistr_ui
import
*
import
fnmatch
import
re
gex
import
re
import
os
import
sys
import
macfs
...
...
@@ -187,7 +187,7 @@ class ExcMatcher(Matcher):
pat
=
fnmatch
.
translate
(
src
)
if
DEBUG
:
print
'PATTERN'
,
`src`
,
'REGEX'
,
`pat`
self
.
relist
.
append
(
re
gex
.
compile
(
pat
))
self
.
relist
.
append
(
re
.
compile
(
pat
))
def
unrebuild1
(
self
,
num
,
src
):
del
self
.
relist
[
num
]
...
...
@@ -196,7 +196,7 @@ class ExcMatcher(Matcher):
comps
=
os
.
path
.
split
(
path
)
file
=
comps
[
-
1
]
for
pat
in
self
.
relist
:
if
pat
and
pat
.
match
(
file
)
==
len
(
file
)
:
if
pat
and
pat
.
match
(
file
):
if
DEBUG
:
print
'excmatch'
,
file
,
pat
return
1
...
...
Mac/scripts/fullbuild.py
View file @
be614ee7
...
...
@@ -16,7 +16,7 @@ import sys
import
macfs
import
MacOS
import
EasyDialogs
import
re
gex
import
re
import
string
import
aetools
...
...
@@ -278,11 +278,11 @@ def incbuildno(filename):
line
=
fp
.
readline
()
fp
.
close
()
pat
=
regex
.
compile
(
'#define BUILD
\
([
0
-9][0-9]*
\
)
'
)
pat.match(line)
buildno = pat.group(1)
if not buildno:
pat
=
re
.
compile
(
'#define BUILD ([0-9]+)'
)
m
=
pat
.
search
(
line
)
if
not
m
or
not
m
.
group
(
1
):
raise
'Incorrect macbuildno.h line'
,
line
buildno
=
m
.
group
(
1
)
new
=
string
.
atoi
(
buildno
)
+
1
fp
=
open
(
filename
,
'w'
)
fp
.
write
(
'#define BUILD %d
\
n
'
%
new
)
...
...
Mac/scripts/mkestrres.py
View file @
be614ee7
"""Parse sys/errno.h and Errors.h and create Estr resource"""
import
re
gex
import
re
import
macfs
import
string
import
Res
...
...
@@ -11,25 +11,25 @@ WRITE = 2
smAllScripts
=
-
3
ERRNO_PROG
=
"#define[
\
t
]+"
\
"
\
([A-Z
0
-9a-z_]+
\
)
"
\
"
([A-Z0-9a-z_]+
)"
\
"[
\
t
]+"
\
"
\
([
0
-
9
]
+
\
)
"
\
"
([0-9]+
)"
\
"[
\
t
]*/
\
*[
\
t]*"
\
"
\
(.
*
\
)
"
\
"
(.*
)"
\
"[
\
t
]*
\
*/
"
ERRORS_PROG="
[
\
t
]
*
"
\
"
\
([
A
-
Z0
-
9
a
-
z_
]
+
\
)
"
\
"
([
A
-
Z0
-
9
a
-
z_
]
+
)
"
\
"
[
\
t
]
*=
[
\
t
]
*
"
\
"
\
([
-
0
-
9
]
+
\
)
"
\
"
([
-
0
-
9
]
+
)
"
\
"
[,
\
t
]
*/
\
*
[
\
t
]
*
"
\
"
\
(.
*
\
)
"
\
"
(.
*
)
"
\
"
[
\
t
]
*
\
*/
"
ERRORS_PROG_2="
[
\
t
]
*
"
\
"
\
([
A
-
Z0
-
9
a
-
z_
]
+
\
)
"
\
"
([
A
-
Z0
-
9
a
-
z_
]
+
)
"
\
"
[
\
t
]
*=
[
\
t
]
*
"
\
"
\
([
-
0
-
9
]
+
\
)
"
\
"
([
-
0
-
9
]
+
)
"
\
"
[,
\
t
]
*
"
def Pstring(str):
...
...
@@ -58,12 +58,13 @@ def writepython(fp, dict):
def
parse_errno_h
(
fp
,
dict
):
errno_prog
=
re
gex
.
compile
(
ERRNO_PROG
)
errno_prog
=
re
.
compile
(
ERRNO_PROG
)
for
line
in
fp
.
readlines
():
if
errno_prog
.
match
(
line
)
>
0
:
number
=
string
.
atoi
(
errno_prog
.
group
(
2
))
name
=
errno_prog
.
group
(
1
)
desc
=
string
.
strip
(
errno_prog
.
group
(
3
))
m
=
errno_prog
.
match
(
line
)
if
m
:
number
=
string
.
atoi
(
m
.
group
(
2
))
name
=
m
.
group
(
1
)
desc
=
string
.
strip
(
m
.
group
(
3
))
if
not
dict
.
has_key
(
number
):
dict
[
number
]
=
desc
,
name
...
...
@@ -73,18 +74,20 @@ def parse_errno_h(fp, dict):
print
'
\
t
'
,
(
desc
,
name
)
def
parse_errors_h
(
fp
,
dict
):
errno_prog
=
re
gex
.
compile
(
ERRORS_PROG
)
errno_prog_2
=
re
gex
.
compile
(
ERRORS_PROG_2
)
errno_prog
=
re
.
compile
(
ERRORS_PROG
)
errno_prog_2
=
re
.
compile
(
ERRORS_PROG_2
)
for
line
in
fp
.
readlines
():
match
=
0
if
errno_prog
.
match
(
line
)
>
0
:
number
=
string
.
atoi
(
errno_prog
.
group
(
2
))
name
=
errno_prog
.
group
(
1
)
desc
=
string
.
strip
(
errno_prog
.
group
(
3
))
m
=
errno_prog
.
match
(
line
)
m2
=
errno_prog_2
.
match
(
line
)
if
m
:
number
=
string
.
atoi
(
m
.
group
(
2
))
name
=
m
.
group
(
1
)
desc
=
string
.
strip
(
m
.
group
(
3
))
match
=
1
elif
errno_prog_2
.
match
(
line
)
>
0
:
number
=
string
.
atoi
(
errno_prog_
2
.
group
(
2
))
name
=
errno_prog_
2
.
group
(
1
)
elif
m2
:
number
=
string
.
atoi
(
m
2
.
group
(
2
))
name
=
m
2
.
group
(
1
)
desc
=
name
match
=
1
if
match
:
...
...
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