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
0238497e
Kaydet (Commit)
0238497e
authored
Ock 02, 2009
tarafından
Ronald Oussoren
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix for issue1594
üst
8c95484c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
0 deletions
+67
-0
test_macos.py
Lib/test/test_macos.py
+55
-0
MacOS.c
Mac/Modules/MacOS.c
+9
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_macos.py
Dosyayı görüntüle @
0238497e
...
...
@@ -3,11 +3,66 @@ import MacOS
import
Carbon.File
from
test
import
test_support
import
os
import
subprocess
TESTFN2
=
test_support
.
TESTFN
+
'2'
class
TestMacOS
(
unittest
.
TestCase
):
def
testGetCreatorAndType
(
self
):
if
not
os
.
path
.
exists
(
'/Developer/Tools/SetFile'
):
return
try
:
fp
=
open
(
test_support
.
TESTFN
,
'w'
)
fp
.
write
(
'
\n
'
)
fp
.
close
()
subprocess
.
call
(
[
'/Developer/Tools/SetFile'
,
'-t'
,
'ABCD'
,
'-c'
,
'EFGH'
,
test_support
.
TESTFN
])
cr
,
tp
=
MacOS
.
GetCreatorAndType
(
test_support
.
TESTFN
)
self
.
assertEquals
(
tp
,
'ABCD'
)
self
.
assertEquals
(
cr
,
'EFGH'
)
finally
:
os
.
unlink
(
test_support
.
TESTFN
)
def
testSetCreatorAndType
(
self
):
if
not
os
.
path
.
exists
(
'/Developer/Tools/GetFileInfo'
):
return
try
:
fp
=
open
(
test_support
.
TESTFN
,
'w'
)
fp
.
write
(
'
\n
'
)
fp
.
close
()
MacOS
.
SetCreatorAndType
(
test_support
.
TESTFN
,
'ABCD'
,
'EFGH'
)
cr
,
tp
=
MacOS
.
GetCreatorAndType
(
test_support
.
TESTFN
)
self
.
assertEquals
(
cr
,
'ABCD'
)
self
.
assertEquals
(
tp
,
'EFGH'
)
data
=
subprocess
.
Popen
([
"/Developer/Tools/GetFileInfo"
,
test_support
.
TESTFN
],
stdout
=
subprocess
.
PIPE
)
.
communicate
()[
0
]
tp
=
None
cr
=
None
for
ln
in
data
.
splitlines
():
if
ln
.
startswith
(
'type:'
):
tp
=
ln
.
split
()[
-
1
][
1
:
-
1
]
if
ln
.
startswith
(
'creator:'
):
cr
=
ln
.
split
()[
-
1
][
1
:
-
1
]
self
.
assertEquals
(
cr
,
'ABCD'
)
self
.
assertEquals
(
tp
,
'EFGH'
)
finally
:
os
.
unlink
(
test_support
.
TESTFN
)
def
testOpenRF
(
self
):
try
:
fp
=
open
(
test_support
.
TESTFN
,
'w'
)
...
...
Mac/Modules/MacOS.c
Dosyayı görüntüle @
0238497e
...
...
@@ -30,6 +30,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <Carbon/Carbon.h>
#include <ApplicationServices/ApplicationServices.h>
#include <arpa/inet.h>
/* for ntohl, htonl */
#ifndef HAVE_OSX105_SDK
typedef
SInt16
FSIORefNum
;
#endif
...
...
@@ -310,6 +313,10 @@ MacOS_GetCreatorAndType(PyObject *self, PyObject *args)
if
((
err
=
FSpGetFInfo
(
&
fss
,
&
info
))
!=
noErr
)
{
return
PyErr_Mac
(
MacOS_Error
,
err
);
}
info
.
fdCreator
=
ntohl
(
info
.
fdCreator
);
info
.
fdType
=
ntohl
(
info
.
fdType
);
creator
=
PyString_FromStringAndSize
(
(
char
*
)
&
info
.
fdCreator
,
4
);
type
=
PyString_FromStringAndSize
((
char
*
)
&
info
.
fdType
,
4
);
...
...
@@ -341,6 +348,8 @@ MacOS_GetCreatorAndType(PyObject *self, PyObject *args)
}
finfo
=
(
FileInfo
*
)
&
(
cataloginfo
.
finderInfo
);
finfo
->
fileCreator
=
ntohl
(
finfo
->
fileCreator
);
finfo
->
fileType
=
ntohl
(
finfo
->
fileType
);
creator
=
PyString_FromStringAndSize
((
char
*
)
&
(
finfo
->
fileCreator
),
4
);
type
=
PyString_FromStringAndSize
((
char
*
)
&
(
finfo
->
fileType
),
4
);
...
...
Misc/NEWS
Dosyayı görüntüle @
0238497e
...
...
@@ -224,6 +224,9 @@ Library
- Issue #4730: Fixed the cPickle module to handle correctly astral characters
when protocol 0 is used.
- Issue #1594: MacOS.GetCreatorAndType now always returns a big-endian result,
to be consistent with Apple tools.
Tools/Demos
-----------
...
...
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