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
2d0909b9
Commit
2d0909b9
authored
Jan 15, 2003
by
Jack Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented FSCatalogInfo structure support, and used this to implement
FSSpec.SetDates() and GetDates(). Closes #662836.
parent
a5caa6fc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
17 deletions
+32
-17
Lib/plat-mac/macfs.py
Lib/plat-mac/macfs.py
+30
-5
Mac/Modules/file/_Filemodule.c
Mac/Modules/file/_Filemodule.c
+1
-6
Mac/Modules/file/filesupport.py
Mac/Modules/file/filesupport.py
+1
-6
No files found.
Lib/plat-mac/macfs.py
View file @
2d0909b9
...
...
@@ -21,6 +21,23 @@ READ = 1
WRITE
=
2
smAllScripts
=
-
3
#
# Find the epoch conversion for file dates in a way that works on OS9 and OSX
import
time
if
time
.
gmtime
(
0
)[
0
]
==
1970
:
_EPOCHCONVERT
=
-
((
1970
-
1904
)
*
365
+
17
)
*
(
24
*
60
*
60
)
+
0x100000000
L
def
_utc2time
(
utc
):
t
=
utc
[
1
]
+
_EPOCHCONVERT
return
int
(
t
)
def
_time2utc
(
t
):
t
=
t
-
_EPOCHCONVERT
if
t
<
-
0x7fffffff
:
t
=
t
+
0x10000000
L
return
(
0
,
int
(
t
),
0
)
else
:
def
_utc2time
(
utc
):
return
utc
[
1
]
def
_time2utc
(
t
):
return
(
0
,
t
,
0
)
# The old name of the error object:
error
=
Carbon
.
File
.
Error
...
...
@@ -52,12 +69,20 @@ class FSSpec(Carbon.File.FSSpec):
return
self
.
FSpSetFInfo
(
info
)
def
GetDates
(
self
):
import
os
statb
=
os
.
stat
(
self
.
as_pathname
())
return
statb
.
st_ctime
,
statb
.
st_mtime
,
0
catInfoFlags
=
kFSCatInfoCreateDate
|
kFSCatInfoContentMod
|
kFSCatInfoBackupDate
catinfo
,
d1
,
d2
,
d3
=
FSRef
(
self
).
FSGetCatalogInfo
(
catInfoFlags
)
cdate
=
catinfo
.
createDate
mdate
=
catinfo
.
contentModDate
bdate
=
catinfo
.
backupDate
return
_utc2time
(
cdate
),
_utc2time
(
mdate
),
_utc2time
(
bdate
)
def
SetDates
(
self
,
*
dates
):
pass
# print "FSSpec.SetDates not yet implemented"
def
SetDates
(
self
,
cdate
,
mdate
,
bdate
):
catInfoFlags
=
kFSCatInfoCreateDate
|
kFSCatInfoContentMod
|
kFSCatInfoBackupDate
catinfo
=
Carbon
.
File
.
FSCatalogInfo
(
createDate
=
_time2utc
(
cdate
),
contentModDate
=
_time2utc
(
mdate
),
backupDate
=
_time2utc
(
bdate
))
FSRef
(
self
).
FSSetCatalogInfo
(
catInfoFlags
,
catinfo
)
class
FSRef
(
Carbon
.
File
.
FSRef
):
def
as_fsspec
(
self
):
...
...
Mac/Modules/file/_Filemodule.c
View file @
2d0909b9
...
...
@@ -370,7 +370,6 @@ static int FSCatalogInfo_tp_init(PyObject *self, PyObject *args, PyObject *kwds)
"atributeModDate"
,
"accessDate"
,
"backupDate"
,
"permissions"
,
"valence"
,
"dataLogicalSize"
,
"dataPhysicalSize"
,
...
...
@@ -380,7 +379,7 @@ static int FSCatalogInfo_tp_init(PyObject *self, PyObject *args, PyObject *kwds)
"userPrivileges"
,
0
};
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"|HhllO&O&O&O&O&
(llll)
llllllb"
,
kw
,
&
((
FSCatalogInfoObject
*
)
self
)
->
ob_itself
.
nodeFlags
,
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"|HhllO&O&O&O&O&llllllb"
,
kw
,
&
((
FSCatalogInfoObject
*
)
self
)
->
ob_itself
.
nodeFlags
,
&
((
FSCatalogInfoObject
*
)
self
)
->
ob_itself
.
volume
,
&
((
FSCatalogInfoObject
*
)
self
)
->
ob_itself
.
parentDirID
,
&
((
FSCatalogInfoObject
*
)
self
)
->
ob_itself
.
nodeID
,
...
...
@@ -389,10 +388,6 @@ static int FSCatalogInfo_tp_init(PyObject *self, PyObject *args, PyObject *kwds)
UTCDateTime_Convert
,
&
((
FSCatalogInfoObject
*
)
self
)
->
ob_itself
.
attributeModDate
,
UTCDateTime_Convert
,
&
((
FSCatalogInfoObject
*
)
self
)
->
ob_itself
.
accessDate
,
UTCDateTime_Convert
,
&
((
FSCatalogInfoObject
*
)
self
)
->
ob_itself
.
backupDate
,
&
((
FSCatalogInfoObject
*
)
self
)
->
ob_itself
.
permissions
[
0
],
&
((
FSCatalogInfoObject
*
)
self
)
->
ob_itself
.
permissions
[
1
],
&
((
FSCatalogInfoObject
*
)
self
)
->
ob_itself
.
permissions
[
2
],
&
((
FSCatalogInfoObject
*
)
self
)
->
ob_itself
.
permissions
[
3
],
&
((
FSCatalogInfoObject
*
)
self
)
->
ob_itself
.
valence
,
&
((
FSCatalogInfoObject
*
)
self
)
->
ob_itself
.
dataLogicalSize
,
&
((
FSCatalogInfoObject
*
)
self
)
->
ob_itself
.
dataPhysicalSize
,
...
...
Mac/Modules/file/filesupport.py
View file @
2d0909b9
...
...
@@ -413,7 +413,7 @@ class FSCatalogInfoDefinition(PEP253Mixin, ObjectDefinition):
),
]
# The same info, but in a different form
INITFORMAT
=
"HhllO&O&O&O&O&
(llll)
llllllb"
INITFORMAT
=
"HhllO&O&O&O&O&llllllb"
INITARGS
=
"""&((FSCatalogInfoObject *)self)->ob_itself.nodeFlags,
&((FSCatalogInfoObject *)self)->ob_itself.volume,
&((FSCatalogInfoObject *)self)->ob_itself.parentDirID,
...
...
@@ -423,10 +423,6 @@ class FSCatalogInfoDefinition(PEP253Mixin, ObjectDefinition):
UTCDateTime_Convert, &((FSCatalogInfoObject *)self)->ob_itself.attributeModDate,
UTCDateTime_Convert, &((FSCatalogInfoObject *)self)->ob_itself.accessDate,
UTCDateTime_Convert, &((FSCatalogInfoObject *)self)->ob_itself.backupDate,
&((FSCatalogInfoObject *)self)->ob_itself.permissions[0],
&((FSCatalogInfoObject *)self)->ob_itself.permissions[1],
&((FSCatalogInfoObject *)self)->ob_itself.permissions[2],
&((FSCatalogInfoObject *)self)->ob_itself.permissions[3],
&((FSCatalogInfoObject *)self)->ob_itself.valence,
&((FSCatalogInfoObject *)self)->ob_itself.dataLogicalSize,
&((FSCatalogInfoObject *)self)->ob_itself.dataPhysicalSize,
...
...
@@ -444,7 +440,6 @@ class FSCatalogInfoDefinition(PEP253Mixin, ObjectDefinition):
"atributeModDate",
"accessDate",
"backupDate",
"permissions",
"valence",
"dataLogicalSize",
"dataPhysicalSize",
...
...
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