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
8094f0dd
Kaydet (Commit)
8094f0dd
authored
Agu 31, 1995
tarafından
Jack Jansen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added functionality: locate CW projects, copy them, empty them and
binhex them.
üst
fbac4bbf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
103 additions
and
4 deletions
+103
-4
binhextree.py
Mac/scripts/binhextree.py
+103
-4
No files found.
Mac/scripts/binhextree.py
Dosyayı görüntüle @
8094f0dd
...
...
@@ -13,19 +13,118 @@
import
os
import
binhex
import
sys
import
macostools
import
macfs
extensions
=
[
'.rsrc'
]
import
addpack
addpack
.
addpack
(
'Tools'
)
addpack
.
addpack
(
'bgen'
)
addpack
.
addpack
(
'AE'
)
import
aetools
from
Metrowerks_Shell_Suite
import
Metrowerks_Shell_Suite
from
Required_Suite
import
Required_Suite
class
MwShell
(
aetools
.
TalkTo
,
Metrowerks_Shell_Suite
,
Required_Suite
):
pass
# Top-level directory
TOP
=
''
# Where to put CW projects, relative to TOP
CWDIR
=
':Mac:mwerks:projects'
# Helper routines
def
binhexit
(
path
,
name
):
dstfile
=
path
+
'.hqx'
if
os
.
path
.
exists
(
dstfile
)
and
\
os
.
stat
(
dstfile
)[
8
]
>
os
.
stat
(
path
)[
8
]:
print
'Skip'
,
path
,
'- Up-to-date'
return
print
'Binhexing'
,
path
binhex
.
binhex
(
path
,
dstfile
)
# Project files to handle
project_files
=
{}
def
hexbincwprojects
(
creator
):
"""Compact and hexbin all files remembered with a given creator"""
print
'Please start project mgr with signature'
,
creator
,
'-'
sys
.
stdin
.
readline
()
try
:
mgr
=
MwShell
(
creator
)
except
'foo'
:
print
'Not handled:'
,
creator
return
for
fss
in
project_files
[
creator
]:
srcfile
=
fss
.
as_pathname
()
dstfile
=
srcfile
+
'.hqx'
if
os
.
path
.
exists
(
dstfile
)
and
\
os
.
stat
(
dstfile
)[
8
]
>
os
.
stat
(
srcfile
)[
8
]:
print
'Skip'
,
path
,
'- Up-to-date'
continue
print
'Compacting'
,
dstfile
mgr
.
open
(
fss
)
mgr
.
Reset_File_Paths
()
mgr
.
Remove_Binaries
()
mgr
.
Close_Project
()
print
'Binhexing'
,
dstfile
binhex
.
binhex
(
srcfile
,
dstfile
)
mgr
.
quit
()
def
copycwproject
(
path
,
name
):
"""Copy CW project (if needed) and remember for hexbinning"""
global
project_files
dstdir
=
os
.
path
.
join
(
TOP
,
CWDIR
)
if
not
os
.
path
.
exists
(
dstdir
):
print
dstdir
print
'No CW-project dir, skip'
,
name
return
dstfile
=
os
.
path
.
join
(
dstdir
,
name
)
# Check that we're not in the dest directory
if
dstfile
==
path
:
return
# If the destination doesn't exists or is older that the source
# we copy and remember it
if
os
.
path
.
exists
(
dstfile
)
and
\
os
.
stat
(
dstfile
)[
8
]
>
os
.
stat
(
path
)[
8
]:
print
'Not copying'
,
path
,
'- Up-to-date'
else
:
print
'Copy'
,
path
macostools
.
copy
(
path
,
dstfile
)
fss
=
macfs
.
FSSpec
(
dstfile
)
creator
=
fss
.
GetCreatorType
()[
0
]
if
project_files
.
has_key
(
creator
):
project_files
[
creator
]
.
append
(
fss
)
else
:
project_files
[
creator
]
=
[
fss
]
extensions
=
[
(
'.rsrc'
,
binhexit
),
(
'.'
,
copycwproject
)
]
def
walker
(
arg
,
top
,
names
):
for
n
in
names
:
for
ext
in
extensions
:
for
ext
,
handler
in
extensions
:
if
n
[
-
len
(
ext
):]
==
ext
:
name
=
os
.
path
.
join
(
top
,
n
)
print
'Binhexing'
,
name
binhex
.
binhex
(
name
,
name
+
'.hqx'
)
handler
(
name
,
n
)
def
dodir
(
name
):
global
TOP
,
project_files
TOP
=
name
os
.
path
.
walk
(
name
,
walker
,
None
)
for
creator
in
project_files
.
keys
():
hexbincwprojects
(
creator
)
project_files
=
{}
def
main
():
if
len
(
sys
.
argv
)
>
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