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
e3c90a42
Kaydet (Commit)
e3c90a42
authored
Agu 28, 1996
tarafından
Jack Jansen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Merged Guido's mkaliases and Jack's MkPluginAliases
üst
86288976
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
70 deletions
+82
-70
ConfigurePython.py
Mac/scripts/ConfigurePython.py
+82
-70
No files found.
Mac/scripts/ConfigurePython.py
Dosyayı görüntüle @
e3c90a42
# This python script creates Finder aliases for all the
# This python script creates Finder aliases for all the
# dynamically-loaded modules that "live in" in a single
# dynamically-loaded modules that "live in" in a single
# shared library.
# shared library.
# It needs a fully functional non-dynamic python to work
# but you can run it in a shared python as long as you can point
# it to toolboxmodules.slb
#
#
# Jack Jansen, CWI, August 1995
# This is sort-of a merger between Jack's MkPluginAliases
# and Guido's mkaliases.
#
# Jack Jansen, CWI, August 1996
import
sys
import
sys
import
os
def
help
():
print
"""
Try the following:
1. Remove any old "Python Preferences" files from the system folder.
2. Remove any old "PythonCore" or "PythonCoreCFM68K" files from the system folder.
3. Make sure this script, your interpreter and your PythonCore are all located in the
same folder.
4. Run this script again, by dropping it on your interpreter.
If this fails try removing starting afresh from the distribution archive.
"""
sys
.
exit
(
1
)
try
:
import
os
except
ImportError
:
print
"""
I cannot import the 'os' module, so something is wrong with sys.path
"""
help
()
try
:
import
Res
except
ImportError
:
import
macfs
#
# Check that we are actually in the main python directory
#
fss
,
ok
=
macfs
.
StandardGetFile
(
'Where are the toolbox modules?'
,
'shlb'
)
tblibname
=
fss
.
as_pathname
()
try
:
for
wtd
in
[
"Ctl"
,
"Dlg"
,
"Evt"
,
"Qd"
,
"Res"
,
"Win"
]:
imp
.
load_dynamic
(
wtd
,
tblibname
)
except
ImportError
:
print
"""
I cannot load the toolbox modules by hand. Are you sure you are
using a PowerPC mac?
"""
sys
.
exit
(
1
)
import
macfs
import
macfs
import
EasyDialogs
import
macostools
ppc_goals
=
[
ppc_goals
=
[
(
"AE.ppc.slb"
,
"toolboxmodules.ppc.slb"
),
(
"AE.ppc.slb"
,
"toolboxmodules.ppc.slb"
),
...
@@ -103,42 +60,97 @@ cfm68k_goals = [
...
@@ -103,42 +60,97 @@ cfm68k_goals = [
(
"Qt.CFM68K.slb"
,
"qtmodules.CFM68K.slb"
),
(
"Qt.CFM68K.slb"
,
"qtmodules.CFM68K.slb"
),
]
]
def
gotopluginfolder
():
"""Go to the plugin folder, assuming we are somewhere in the Python tree"""
import
os
while
not
os
.
path
.
isdir
(
":Plugins"
):
os
.
chdir
(
"::"
)
os
.
chdir
(
":Plugins"
)
print
"current directory is"
,
os
.
getcwd
()
def
loadtoolboxmodules
():
"""Attempt to load the Res module"""
try
:
import
Res
except
ImportError
,
arg
:
err1
=
arg
pass
else
:
print
'imported Res the standard way.'
return
# We cannot import it. First attempt to load the cfm68k version
import
imp
try
:
dummy
=
imp
.
load_dynamic
(
'Res'
,
'toolboxmodules.CFM68K.slb'
)
except
ImportError
,
arg
:
err2
=
arg
pass
else
:
print
'Loaded Res from toolboxmodules.CFM68K.slb.'
return
# Ok, try the ppc version
try
:
dummy
=
imp
.
load_dynamic
(
'Res'
,
'toolboxmodules.ppc.slb'
)
except
ImportError
,
arg
:
err3
=
arg
pass
else
:
print
'Loaded Res from toolboxmodules.ppc.slb.'
return
# Tough luck....
print
"I cannot import the Res module, nor load it from either of"
print
"toolboxmodules shared libraries. The errors encountered were:"
print
"import Res:"
,
err1
print
"load from toolboxmodules.CFM68K.slb:"
,
err2
print
"load from toolboxmodules.ppc.slb:"
,
err3
sys
.
exit
(
1
)
def
main
():
def
main
():
# Ask the user for the plugins directory
gotopluginfolder
()
dir
,
ok
=
macfs
.
GetDirectory
(
'Where is the PlugIns folder?'
)
if
not
ok
:
sys
.
exit
(
0
)
loadtoolboxmodules
()
os
.
chdir
(
dir
.
as_pathname
())
import
macostools
# Remove old .slb aliases and collect a list of .slb files
# Remove old .slb aliases and collect a list of .slb files
if
EasyDialogs
.
AskYesNoCancel
(
'Proceed with removing old aliases?'
)
<=
0
:
sys
.
exit
(
0
)
LibFiles
=
[]
LibFiles
=
[]
allfiles
=
os
.
listdir
(
':'
)
allfiles
=
os
.
listdir
(
':'
)
print
'Removing old aliases...'
for
f
in
allfiles
:
for
f
in
allfiles
:
if
f
[
-
4
:]
==
'.slb'
:
if
f
[
-
4
:]
==
'.slb'
:
finfo
=
macfs
.
FSSpec
(
f
)
.
GetFInfo
()
finfo
=
macfs
.
FSSpec
(
f
)
.
GetFInfo
()
if
finfo
.
Flags
&
0x8000
:
if
finfo
.
Flags
&
0x8000
:
print
' Removing'
,
f
os
.
unlink
(
f
)
os
.
unlink
(
f
)
else
:
else
:
LibFiles
.
append
(
f
)
LibFiles
.
append
(
f
)
print
' Found'
,
f
print
print
LibFiles
# Create the new PPC aliases.
# Create the new aliases.
print
'Creating PPC aliases...'
if
EasyDialogs
.
AskYesNoCancel
(
'Proceed with creating PPC aliases?'
)
>
0
:
for
dst
,
src
in
ppc_goals
:
for
dst
,
src
in
ppc_goals
:
if
src
in
LibFiles
:
if
src
in
LibFiles
:
macostools
.
mkalias
(
src
,
dst
)
macostools
.
mkalias
(
src
,
dst
)
print
' '
,
dst
,
'->'
,
src
else
:
else
:
EasyDialogs
.
Message
(
dst
+
' not created: '
+
src
+
' not found'
)
print
'*'
,
dst
,
'not created:'
,
src
,
'not found'
if
EasyDialogs
.
AskYesNoCancel
(
'Proceed with creating CFM68K aliases?'
)
>
0
:
print
for
dst
,
src
in
cfm68k_goals
:
if
src
in
LibFiles
:
# Create the CFM68K aliases.
macostools
.
mkalias
(
src
,
dst
)
print
'Creating CFM68K aliases...'
else
:
for
dst
,
src
in
cfm68k_goals
:
EasyDialogs
.
Message
(
dst
+
' not created: '
+
src
+
' not found'
)
if
src
in
LibFiles
:
macostools
.
mkalias
(
src
,
dst
)
EasyDialogs
.
Message
(
'All done!'
)
print
' '
,
dst
,
'->'
,
src
else
:
print
'*'
,
dst
,
'not created:'
,
src
,
'not found'
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
main
()
main
()
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