Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
e7b88e74
Kaydet (Commit)
e7b88e74
authored
Mar 30, 1992
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
change posix to os
üst
b2ac8092
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
65 deletions
+64
-65
linktree.py
Tools/scripts/linktree.py
+17
-17
lll.py
Tools/scripts/lll.py
+7
-7
mkreal.py
Tools/scripts/mkreal.py
+18
-19
which.py
Tools/scripts/which.py
+6
-6
xxci.py
Tools/scripts/xxci.py
+16
-16
No files found.
Tools/scripts/linktree.py
Dosyayı görüntüle @
e7b88e74
...
...
@@ -10,7 +10,7 @@
#
# usage: mklinks oldtree newtree
import
sys
,
posix
,
path
import
sys
,
os
LINK
=
'.LINK'
# Name of special symlink at the top.
...
...
@@ -27,18 +27,18 @@ def main():
else
:
link
=
LINK
link_may_fail
=
0
if
not
path
.
isdir
(
oldtree
):
if
not
os
.
path
.
isdir
(
oldtree
):
print
oldtree
+
': not a directory'
return
1
try
:
posix
.
mkdir
(
newtree
,
0777
)
except
posix
.
error
,
msg
:
os
.
mkdir
(
newtree
,
0777
)
except
os
.
error
,
msg
:
print
newtree
+
': cannot mkdir:'
,
msg
return
1
linkname
=
path
.
cat
(
newtree
,
link
)
linkname
=
os
.
path
.
join
(
newtree
,
link
)
try
:
posix
.
symlink
(
path
.
cat
(
'..'
,
oldtree
),
linkname
)
except
posix
.
error
,
msg
:
os
.
symlink
(
os
.
path
.
join
(
os
.
pardir
,
oldtree
),
linkname
)
except
os
.
error
,
msg
:
if
not
link_may_fail
:
print
linkname
+
': cannot symlink:'
,
msg
return
1
...
...
@@ -50,27 +50,27 @@ def main():
def
linknames
(
old
,
new
,
link
):
if
debug
:
print
'linknames'
,
(
old
,
new
,
link
)
try
:
names
=
posix
.
listdir
(
old
)
except
posix
.
error
,
msg
:
names
=
os
.
listdir
(
old
)
except
os
.
error
,
msg
:
print
old
+
': warning: cannot listdir:'
,
msg
return
for
name
in
names
:
if
name
not
in
(
'.'
,
'..'
):
oldname
=
path
.
cat
(
old
,
name
)
linkname
=
path
.
cat
(
link
,
name
)
newname
=
path
.
cat
(
new
,
name
)
if
name
not
in
(
os
.
curdir
,
os
.
pardir
):
oldname
=
os
.
path
.
join
(
old
,
name
)
linkname
=
os
.
path
.
join
(
link
,
name
)
newname
=
os
.
path
.
join
(
new
,
name
)
if
debug
>
1
:
print
oldname
,
newname
,
linkname
if
path
.
isdir
(
oldname
)
and
not
path
.
islink
(
oldname
):
if
os
.
path
.
isdir
(
oldname
)
and
not
os
.
path
.
islink
(
oldname
):
try
:
posix
.
mkdir
(
newname
,
0777
)
os
.
mkdir
(
newname
,
0777
)
ok
=
1
except
:
print
newname
+
': warning: cannot mkdir:'
,
msg
ok
=
0
if
ok
:
linkname
=
path
.
cat
(
'..'
,
linkname
)
linkname
=
os
.
path
.
join
(
os
.
pardir
,
linkname
)
linknames
(
oldname
,
newname
,
linkname
)
else
:
posix
.
symlink
(
linkname
,
newname
)
os
.
symlink
(
linkname
,
newname
)
sys
.
exit
(
main
())
Tools/scripts/lll.py
Dosyayı görüntüle @
e7b88e74
...
...
@@ -5,17 +5,17 @@
# No recursion.
# (This is a totally different program from "findsymlinks.py"!)
import
sys
,
posix
,
path
import
sys
,
os
def
lll
(
dirname
):
for
name
in
posix
.
listdir
(
dirname
):
if
name
not
in
[
'.'
,
'..'
]
:
full
=
path
.
join
(
dirname
,
name
)
if
path
.
islink
(
full
):
print
name
,
'->'
,
posix
.
readlink
(
full
)
for
name
in
os
.
listdir
(
dirname
):
if
name
not
in
(
os
.
curdir
,
os
.
pardir
)
:
full
=
os
.
path
.
join
(
dirname
,
name
)
if
os
.
path
.
islink
(
full
):
print
name
,
'->'
,
os
.
readlink
(
full
)
args
=
sys
.
argv
[
1
:]
if
not
args
:
args
=
[
'.'
]
if
not
args
:
args
=
[
os
.
curdir
]
first
=
1
for
arg
in
args
:
if
len
(
args
)
>
1
:
...
...
Tools/scripts/mkreal.py
Dosyayı görüntüle @
e7b88e74
...
...
@@ -5,58 +5,57 @@
# turn a symlink to a directory into a real directory
import
sys
import
posix
import
path
import
os
from
stat
import
*
join
=
path
.
join
join
=
os
.
path
.
join
error
=
'mkreal error'
BUFSIZE
=
32
*
1024
def
mkrealfile
(
name
):
st
=
posix
.
stat
(
name
)
# Get the mode
st
=
os
.
stat
(
name
)
# Get the mode
mode
=
S_IMODE
(
st
[
ST_MODE
])
linkto
=
posix
.
readlink
(
name
)
# Make sure again it's a symlink
linkto
=
os
.
readlink
(
name
)
# Make sure again it's a symlink
f_in
=
open
(
name
,
'r'
)
# This ensures it's a file
posix
.
unlink
(
name
)
os
.
unlink
(
name
)
f_out
=
open
(
name
,
'w'
)
while
1
:
buf
=
f_in
.
read
(
BUFSIZE
)
if
not
buf
:
break
f_out
.
write
(
buf
)
del
f_out
# Flush data to disk before changing mode
posix
.
chmod
(
name
,
mode
)
os
.
chmod
(
name
,
mode
)
def
mkrealdir
(
name
):
st
=
posix
.
stat
(
name
)
# Get the mode
st
=
os
.
stat
(
name
)
# Get the mode
mode
=
S_IMODE
(
st
[
ST_MODE
])
linkto
=
posix
.
readlink
(
name
)
files
=
posix
.
listdir
(
name
)
posix
.
unlink
(
name
)
posix
.
mkdir
(
name
,
mode
)
posix
.
chmod
(
name
,
mode
)
linkto
=
join
(
'..'
,
linkto
)
linkto
=
os
.
readlink
(
name
)
files
=
os
.
listdir
(
name
)
os
.
unlink
(
name
)
os
.
mkdir
(
name
,
mode
)
os
.
chmod
(
name
,
mode
)
linkto
=
join
(
os
.
pardir
,
linkto
)
#
for
file
in
files
:
if
file
not
in
(
'.'
,
'..'
):
posix
.
symlink
(
join
(
linkto
,
file
),
join
(
name
,
file
))
if
file
not
in
(
os
.
curdir
,
os
.
pardir
):
os
.
symlink
(
join
(
linkto
,
file
),
join
(
name
,
file
))
def
main
():
sys
.
stdout
=
sys
.
stderr
progname
=
path
.
basename
(
sys
.
argv
[
0
])
progname
=
os
.
path
.
basename
(
sys
.
argv
[
0
])
args
=
sys
.
argv
[
1
:]
if
not
args
:
print
'usage:'
,
progname
,
'path ...'
sys
.
exit
(
2
)
status
=
0
for
name
in
args
:
if
not
path
.
islink
(
name
):
if
not
os
.
path
.
islink
(
name
):
print
progname
+
':'
,
name
+
':'
,
'not a symlink'
status
=
1
else
:
if
path
.
isdir
(
name
):
if
os
.
path
.
isdir
(
name
):
mkrealdir
(
name
)
else
:
mkrealfile
(
name
)
...
...
Tools/scripts/which.py
Dosyayı görüntüle @
e7b88e74
...
...
@@ -4,13 +4,13 @@
# On stderr, near and total misses are reported.
# '-l<flags>' argument adds ls -l<flags> of each file found.
import
sys
,
posix
,
string
,
path
import
sys
,
os
,
string
from
stat
import
*
def
msg
(
str
):
sys
.
stderr
.
write
(
str
+
'
\n
'
)
pathlist
=
string
.
splitfields
(
posix
.
environ
[
'PATH'
],
':'
)
pathlist
=
string
.
splitfields
(
os
.
environ
[
'PATH'
],
':'
)
sts
=
0
longlist
=
''
...
...
@@ -22,10 +22,10 @@ if sys.argv[1:] and sys.argv[1][:2] == '-l':
for
prog
in
sys
.
argv
[
1
:]:
ident
=
()
for
dir
in
pathlist
:
file
=
path
.
join
(
dir
,
prog
)
file
=
os
.
path
.
join
(
dir
,
prog
)
try
:
st
=
posix
.
stat
(
file
)
except
posix
.
error
:
st
=
os
.
stat
(
file
)
except
os
.
error
:
continue
if
not
S_ISREG
(
st
[
ST_MODE
]):
msg
(
file
+
': not a disk file'
)
...
...
@@ -44,7 +44,7 @@ for prog in sys.argv[1:]:
else
:
msg
(
file
+
': not executable'
)
if
longlist
:
sts
=
posix
.
system
(
'ls '
+
longlist
+
' '
+
file
)
sts
=
os
.
system
(
'ls '
+
longlist
+
' '
+
file
)
if
sts
:
msg
(
'"ls -l" exit status: '
+
`sts`
)
if
not
ident
:
msg
(
prog
+
': not found'
)
...
...
Tools/scripts/xxci.py
Dosyayı görüntüle @
e7b88e74
...
...
@@ -6,9 +6,8 @@
# check in files for which rcsdiff returns nonzero exit status
import
sys
import
posix
import
os
from
stat
import
*
import
path
import
commands
import
fnmatch
import
string
...
...
@@ -23,7 +22,7 @@ def getargs():
return
args
print
'No arguments, checking almost *, in "ls -t" order'
list
=
[]
for
file
in
posix
.
listdir
(
'.'
):
for
file
in
os
.
listdir
(
os
.
curdir
):
if
not
skipfile
(
file
):
list
.
append
((
getmtime
(
file
),
file
))
list
.
sort
()
...
...
@@ -37,9 +36,9 @@ def getargs():
def
getmtime
(
file
):
try
:
st
=
posix
.
stat
(
file
)
st
=
os
.
stat
(
file
)
return
st
[
ST_MTIME
]
except
posix
.
error
:
except
os
.
error
:
return
-
1
badnames
=
[
'tags'
,
'TAGS'
,
'xyzzy'
,
'nohup.out'
,
'core'
]
...
...
@@ -65,8 +64,8 @@ def skipfile(file):
for
p
in
ignore
:
if
fnmatch
.
fnmatch
(
file
,
p
):
return
1
try
:
st
=
posix
.
lstat
(
file
)
except
posix
.
error
:
st
=
os
.
lstat
(
file
)
except
os
.
error
:
return
1
# Doesn't exist -- skip it
# Skip non-plain files.
if
not
S_ISREG
(
st
[
ST_MODE
]):
return
1
...
...
@@ -94,18 +93,19 @@ def go(args):
for
file
in
args
:
print
file
+
':'
if
differing
(
file
):
s
ts
=
posix
.
system
(
'rcsdiff '
+
file
)
# ignored
s
howdiffs
(
file
)
if
askyesno
(
'Check in '
+
file
+
' ? '
):
sts
=
posix
.
system
(
'rcs -l '
+
file
)
# ignored
sts
=
posix
.
system
(
'ci -l '
+
file
)
sts
=
os
.
system
(
'rcs -l '
+
file
)
# ignored
sts
=
os
.
system
(
'ci -l '
+
file
)
def
differing
(
file
):
try
:
this
=
open
(
file
,
'r'
)
.
read
()
that
=
posix
.
popen
(
'co -p '
+
file
+
' 2>/dev/null'
,
'r'
)
.
read
()
return
this
<>
that
except
:
return
1
cmd
=
'co -p '
+
file
+
' 2>/dev/null | cmp -s - '
+
file
sts
=
os
.
system
(
cmd
)
return
sts
!=
0
def
showdiffs
(
file
):
cmd
=
'rcsdiff '
+
file
+
' 2>&1 | ${PAGER-more}'
sts
=
os
.
system
(
cmd
)
def
askyesno
(
prompt
):
s
=
raw_input
(
prompt
)
...
...
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