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
e490d130
Commit
e490d130
authored
Mar 31, 1992
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
posix -> os
parent
bf6cc9e4
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
35 additions
and
35 deletions
+35
-35
Lib/cmp.py
Lib/cmp.py
+2
-2
Lib/cmpcache.py
Lib/cmpcache.py
+2
-2
Lib/irix5/flp.py
Lib/irix5/flp.py
+5
-5
Lib/lib-stdwin/anywin.py
Lib/lib-stdwin/anywin.py
+2
-2
Lib/lib-stdwin/dirwin.py
Lib/lib-stdwin/dirwin.py
+4
-4
Lib/persist.py
Lib/persist.py
+5
-5
Lib/plat-irix5/flp.py
Lib/plat-irix5/flp.py
+5
-5
Lib/statcache.py
Lib/statcache.py
+4
-4
Lib/stdwin/anywin.py
Lib/stdwin/anywin.py
+2
-2
Lib/stdwin/dirwin.py
Lib/stdwin/dirwin.py
+4
-4
No files found.
Lib/cmp.py
View file @
e490d130
...
@@ -8,14 +8,14 @@
...
@@ -8,14 +8,14 @@
# - We keep a cache of outcomes of earlier comparisons
# - We keep a cache of outcomes of earlier comparisons
# - We don't fork a process to run 'cmp' but read the files ourselves
# - We don't fork a process to run 'cmp' but read the files ourselves
import
posix
import
os
cache
=
{}
cache
=
{}
def
cmp
(
f1
,
f2
):
# Compare two files, use the cache if possible.
def
cmp
(
f1
,
f2
):
# Compare two files, use the cache if possible.
# Return 1 for identical files, 0 for different.
# Return 1 for identical files, 0 for different.
# Raise exceptions if either file could not be statted, read, etc.
# Raise exceptions if either file could not be statted, read, etc.
s1
,
s2
=
sig
(
posix
.
stat
(
f1
)),
sig
(
posix
.
stat
(
f2
))
s1
,
s2
=
sig
(
os
.
stat
(
f1
)),
sig
(
os
.
stat
(
f2
))
if
s1
[
0
]
<>
8
or
s2
[
0
]
<>
8
:
if
s1
[
0
]
<>
8
or
s2
[
0
]
<>
8
:
# Either is a not a plain file -- always report as different
# Either is a not a plain file -- always report as different
return
0
return
0
...
...
Lib/cmpcache.py
View file @
e490d130
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
# - We keep a cache of outcomes of earlier comparisons
# - We keep a cache of outcomes of earlier comparisons
# - We don't fork a process to run 'cmp' but read the files ourselves
# - We don't fork a process to run 'cmp' but read the files ourselves
import
posix
import
os
from
stat
import
*
from
stat
import
*
import
statcache
import
statcache
...
@@ -20,7 +20,7 @@ cache = {}
...
@@ -20,7 +20,7 @@ cache = {}
# Compare two files, use the cache if possible.
# Compare two files, use the cache if possible.
# May raise
posix
.error if a stat or open of either fails.
# May raise
os
.error if a stat or open of either fails.
#
#
def
cmp
(
f1
,
f2
):
def
cmp
(
f1
,
f2
):
# Return 1 for identical files, 0 for different.
# Return 1 for identical files, 0 for different.
...
...
Lib/irix5/flp.py
View file @
e490d130
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
# Jack Jansen, December 1991
# Jack Jansen, December 1991
#
#
import
string
import
string
import
path
import
os
import
sys
import
sys
import
FL
import
FL
...
@@ -106,11 +106,11 @@ def wrlong(fp, x):
...
@@ -106,11 +106,11 @@ def wrlong(fp, x):
fp
.
write
(
chr
(
a
)
+
chr
(
b
)
+
chr
(
c
)
+
chr
(
d
))
fp
.
write
(
chr
(
a
)
+
chr
(
b
)
+
chr
(
c
)
+
chr
(
d
))
def
getmtime
(
filename
):
def
getmtime
(
filename
):
import
posix
import
os
from
stat
import
ST_MTIME
from
stat
import
ST_MTIME
try
:
try
:
return
posix
.
stat
(
filename
)[
ST_MTIME
]
return
os
.
stat
(
filename
)[
ST_MTIME
]
except
posix
.
error
:
except
os
.
error
:
return
None
return
None
#
#
...
@@ -157,7 +157,7 @@ def _open_formfile2(filename):
...
@@ -157,7 +157,7 @@ def _open_formfile2(filename):
fp
=
None
fp
=
None
else
:
else
:
for
pc
in
sys
.
path
:
for
pc
in
sys
.
path
:
pn
=
path
.
join
(
pc
,
filename
)
pn
=
os
.
path
.
join
(
pc
,
filename
)
try
:
try
:
fp
=
open
(
pn
,
'r'
)
fp
=
open
(
pn
,
'r'
)
filename
=
pn
filename
=
pn
...
...
Lib/lib-stdwin/anywin.py
View file @
e490d130
...
@@ -3,11 +3,11 @@
...
@@ -3,11 +3,11 @@
import
dirwin
import
dirwin
import
filewin
import
filewin
import
path
import
os
def
open
(
name
):
def
open
(
name
):
print
'opening'
,
name
,
'...'
print
'opening'
,
name
,
'...'
if
path
.
isdir
(
name
):
if
os
.
path
.
isdir
(
name
):
w
=
dirwin
.
open
(
name
)
w
=
dirwin
.
open
(
name
)
else
:
else
:
w
=
filewin
.
open
(
name
)
w
=
filewin
.
open
(
name
)
...
...
Lib/lib-stdwin/dirwin.py
View file @
e490d130
...
@@ -2,24 +2,24 @@
...
@@ -2,24 +2,24 @@
# Directory windows, a subclass of listwin
# Directory windows, a subclass of listwin
import
os
import
gwin
import
gwin
import
listwin
import
listwin
import
anywin
import
anywin
import
path
import
dircache
import
dircache
def
action
(
w
,
string
,
i
,
detail
):
def
action
(
w
,
string
,
i
,
detail
):
(
h
,
v
),
clicks
,
button
,
mask
=
detail
(
h
,
v
),
clicks
,
button
,
mask
=
detail
if
clicks
==
2
:
if
clicks
==
2
:
name
=
path
.
join
(
w
.
name
,
string
)
name
=
os
.
path
.
join
(
w
.
name
,
string
)
try
:
try
:
w2
=
anywin
.
open
(
name
)
w2
=
anywin
.
open
(
name
)
w2
.
parent
=
w
w2
.
parent
=
w
except
posix
.
error
,
why
:
except
os
.
error
,
why
:
stdwin
.
message
(
'Can
\
'
t open '
+
name
+
': '
+
why
[
1
])
stdwin
.
message
(
'Can
\
'
t open '
+
name
+
': '
+
why
[
1
])
def
open
(
name
):
def
open
(
name
):
name
=
path
.
join
(
name
,
''
)
name
=
os
.
path
.
join
(
name
,
''
)
list
=
dircache
.
opendir
(
name
)[:]
list
=
dircache
.
opendir
(
name
)[:]
list
.
sort
()
list
.
sort
()
dircache
.
annotate
(
name
,
list
)
dircache
.
annotate
(
name
,
list
)
...
...
Lib/persist.py
View file @
e490d130
...
@@ -32,16 +32,16 @@ defaultfile = 'wsrestore.py'
...
@@ -32,16 +32,16 @@ defaultfile = 'wsrestore.py'
def
save
():
def
save
():
import
__main__
import
__main__
import
posix
import
os
# XXX On SYSV, if len(defaultfile) >= 14, this is wrong!
# XXX On SYSV, if len(defaultfile) >= 14, this is wrong!
backup
=
defaultfile
+
'~'
backup
=
defaultfile
+
'~'
try
:
try
:
posix
.
unlink
(
backup
)
os
.
unlink
(
backup
)
except
posix
.
error
:
except
os
.
error
:
pass
pass
try
:
try
:
posix
.
rename
(
defaultfile
,
backup
)
os
.
rename
(
defaultfile
,
backup
)
except
posix
.
error
:
except
os
.
error
:
pass
pass
fp
=
open
(
defaultfile
,
'w'
)
fp
=
open
(
defaultfile
,
'w'
)
writedict
(
__main__
.
__dict__
,
fp
)
writedict
(
__main__
.
__dict__
,
fp
)
...
...
Lib/plat-irix5/flp.py
View file @
e490d130
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
# Jack Jansen, December 1991
# Jack Jansen, December 1991
#
#
import
string
import
string
import
path
import
os
import
sys
import
sys
import
FL
import
FL
...
@@ -106,11 +106,11 @@ def wrlong(fp, x):
...
@@ -106,11 +106,11 @@ def wrlong(fp, x):
fp
.
write
(
chr
(
a
)
+
chr
(
b
)
+
chr
(
c
)
+
chr
(
d
))
fp
.
write
(
chr
(
a
)
+
chr
(
b
)
+
chr
(
c
)
+
chr
(
d
))
def
getmtime
(
filename
):
def
getmtime
(
filename
):
import
posix
import
os
from
stat
import
ST_MTIME
from
stat
import
ST_MTIME
try
:
try
:
return
posix
.
stat
(
filename
)[
ST_MTIME
]
return
os
.
stat
(
filename
)[
ST_MTIME
]
except
posix
.
error
:
except
os
.
error
:
return
None
return
None
#
#
...
@@ -157,7 +157,7 @@ def _open_formfile2(filename):
...
@@ -157,7 +157,7 @@ def _open_formfile2(filename):
fp
=
None
fp
=
None
else
:
else
:
for
pc
in
sys
.
path
:
for
pc
in
sys
.
path
:
pn
=
path
.
join
(
pc
,
filename
)
pn
=
os
.
path
.
join
(
pc
,
filename
)
try
:
try
:
fp
=
open
(
pn
,
'r'
)
fp
=
open
(
pn
,
'r'
)
filename
=
pn
filename
=
pn
...
...
Lib/statcache.py
View file @
e490d130
...
@@ -3,11 +3,11 @@
...
@@ -3,11 +3,11 @@
# Maintain a cache of file stats.
# Maintain a cache of file stats.
# There are functions to reset the cache or to selectively remove items.
# There are functions to reset the cache or to selectively remove items.
import
posix
import
os
from
stat
import
*
from
stat
import
*
# The cache.
# The cache.
# Keys are pathnames, values are `
posix
.stat' outcomes.
# Keys are pathnames, values are `
os
.stat' outcomes.
#
#
cache
=
{}
cache
=
{}
...
@@ -17,7 +17,7 @@ cache = {}
...
@@ -17,7 +17,7 @@ cache = {}
def
stat
(
path
):
def
stat
(
path
):
if
cache
.
has_key
(
path
):
if
cache
.
has_key
(
path
):
return
cache
[
path
]
return
cache
[
path
]
cache
[
path
]
=
ret
=
posix
.
stat
(
path
)
cache
[
path
]
=
ret
=
os
.
stat
(
path
)
return
ret
return
ret
...
@@ -81,6 +81,6 @@ def forget_except_prefix(prefix):
...
@@ -81,6 +81,6 @@ def forget_except_prefix(prefix):
def
isdir
(
path
):
def
isdir
(
path
):
try
:
try
:
st
=
stat
(
path
)
st
=
stat
(
path
)
except
posix
.
error
:
except
os
.
error
:
return
0
return
0
return
S_ISDIR
(
st
[
ST_MODE
])
return
S_ISDIR
(
st
[
ST_MODE
])
Lib/stdwin/anywin.py
View file @
e490d130
...
@@ -3,11 +3,11 @@
...
@@ -3,11 +3,11 @@
import
dirwin
import
dirwin
import
filewin
import
filewin
import
path
import
os
def
open
(
name
):
def
open
(
name
):
print
'opening'
,
name
,
'...'
print
'opening'
,
name
,
'...'
if
path
.
isdir
(
name
):
if
os
.
path
.
isdir
(
name
):
w
=
dirwin
.
open
(
name
)
w
=
dirwin
.
open
(
name
)
else
:
else
:
w
=
filewin
.
open
(
name
)
w
=
filewin
.
open
(
name
)
...
...
Lib/stdwin/dirwin.py
View file @
e490d130
...
@@ -2,24 +2,24 @@
...
@@ -2,24 +2,24 @@
# Directory windows, a subclass of listwin
# Directory windows, a subclass of listwin
import
os
import
gwin
import
gwin
import
listwin
import
listwin
import
anywin
import
anywin
import
path
import
dircache
import
dircache
def
action
(
w
,
string
,
i
,
detail
):
def
action
(
w
,
string
,
i
,
detail
):
(
h
,
v
),
clicks
,
button
,
mask
=
detail
(
h
,
v
),
clicks
,
button
,
mask
=
detail
if
clicks
==
2
:
if
clicks
==
2
:
name
=
path
.
join
(
w
.
name
,
string
)
name
=
os
.
path
.
join
(
w
.
name
,
string
)
try
:
try
:
w2
=
anywin
.
open
(
name
)
w2
=
anywin
.
open
(
name
)
w2
.
parent
=
w
w2
.
parent
=
w
except
posix
.
error
,
why
:
except
os
.
error
,
why
:
stdwin
.
message
(
'Can
\
'
t open '
+
name
+
': '
+
why
[
1
])
stdwin
.
message
(
'Can
\
'
t open '
+
name
+
': '
+
why
[
1
])
def
open
(
name
):
def
open
(
name
):
name
=
path
.
join
(
name
,
''
)
name
=
os
.
path
.
join
(
name
,
''
)
list
=
dircache
.
opendir
(
name
)[:]
list
=
dircache
.
opendir
(
name
)[:]
list
.
sort
()
list
.
sort
()
dircache
.
annotate
(
name
,
list
)
dircache
.
annotate
(
name
,
list
)
...
...
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