mirror of
https://github.com/python/cpython.git
synced 2025-07-24 19:54:21 +00:00
macostools.copy() now has an optional forcetype flag, which sets the filetype. This is used by various tools to set the type to APPL when copying interpreter template files (Atmp filetype).
This commit is contained in:
parent
bb74f95821
commit
c1463c9870
3 changed files with 5 additions and 3 deletions
|
@ -78,7 +78,7 @@ def touched_ae(dst):
|
||||||
dir_fss = macfs.FSSpec((vRefNum, dirID, ''))
|
dir_fss = macfs.FSSpec((vRefNum, dirID, ''))
|
||||||
f.update(dir_fss)
|
f.update(dir_fss)
|
||||||
|
|
||||||
def copy(src, dst, createpath=0, copydates=1):
|
def copy(src, dst, createpath=0, copydates=1, forcetype=None):
|
||||||
"""Copy a file, including finder info, resource fork, etc"""
|
"""Copy a file, including finder info, resource fork, etc"""
|
||||||
if createpath:
|
if createpath:
|
||||||
mkdirs(os.path.split(dst)[0])
|
mkdirs(os.path.split(dst)[0])
|
||||||
|
@ -106,6 +106,8 @@ def copy(src, dst, createpath=0, copydates=1):
|
||||||
sf = srcfss.GetFInfo()
|
sf = srcfss.GetFInfo()
|
||||||
df = dstfss.GetFInfo()
|
df = dstfss.GetFInfo()
|
||||||
df.Creator, df.Type = sf.Creator, sf.Type
|
df.Creator, df.Type = sf.Creator, sf.Type
|
||||||
|
if forcetype != None:
|
||||||
|
df.Type = forcetype
|
||||||
df.Flags = (sf.Flags & (kIsStationary|kNameLocked|kHasBundle|kIsInvisible|kIsAlias))
|
df.Flags = (sf.Flags & (kIsStationary|kNameLocked|kHasBundle|kIsInvisible|kIsAlias))
|
||||||
dstfss.SetFInfo(df)
|
dstfss.SetFInfo(df)
|
||||||
if copydates:
|
if copydates:
|
||||||
|
|
|
@ -102,7 +102,7 @@ def buildcopy(top, dummy, list):
|
||||||
for src, dst in list:
|
for src, dst in list:
|
||||||
src = os.path.join(top, src)
|
src = os.path.join(top, src)
|
||||||
dst = os.path.join(top, dst)
|
dst = os.path.join(top, dst)
|
||||||
macostools.copy(src, dst)
|
macostools.copy(src, dst, forcetype="APPL")
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
verbose = 0
|
verbose = 0
|
||||||
|
|
|
@ -167,7 +167,7 @@ def buildcopy(top, dummy, list):
|
||||||
for src, dst in list:
|
for src, dst in list:
|
||||||
src = os.path.join(top, src)
|
src = os.path.join(top, src)
|
||||||
dst = os.path.join(top, dst)
|
dst = os.path.join(top, dst)
|
||||||
macostools.copy(src, dst)
|
macostools.copy(src, dst, forcetype="APPL")
|
||||||
|
|
||||||
def handle_dialog(filename):
|
def handle_dialog(filename):
|
||||||
"""Handle selection dialog, return list of selected items"""
|
"""Handle selection dialog, return list of selected items"""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue