def mkalias(src, dst, relative=None):
 srcfsr = File.FSRef(src)
 (dstdir, dstname) = os.path.split(dst)
 if (not dstdir):
  dstdir = os.curdir
 dstdirfsr = File.FSRef(dstdir)
 if relative:
  relativefsr = File.FSRef(relative)
  alias = File.FSNewAlias(relativefsr, srcfsr)
 else:
  alias = srcfsr.FSNewAliasMinimal()
 (dstfsr, dstfss) = Res.FSCreateResourceFile(dstdirfsr, unicode(dstname), File.FSGetResourceForkName())
 h = Res.FSOpenResourceFile(dstfsr, File.FSGetResourceForkName(), 3)
 resource = Res.Resource(alias.data)
 resource.AddResource('alis', 0, '')
 Res.CloseResFile(h)
 dstfinfo = dstfss.FSpGetFInfo()
 dstfinfo.Flags = (dstfinfo.Flags | 32768)
 dstfss.FSpSetFInfo(dstfinfo)

def mkalias ( src , dst , relative = None ) : srcfsr = File . FSRef ( src ) ( dstdir , dstname ) = os . path . split ( dst ) if ( not dstdir ) : dstdir = os . curdir dstdirfsr = File . FSRef ( dstdir ) if relative : relativefsr = File . FSRef ( relative ) alias = File . FSNewAlias ( relativefsr , srcfsr ) else : alias = srcfsr . FSNewAliasMinimal ( ) ( dstfsr , dstfss ) = Res . FSCreateResourceFile ( dstdirfsr , unicode ( dstname ) , File . FSGetResourceForkName ( ) ) h = Res . FSOpenResourceFile ( dstfsr , File . FSGetResourceForkName ( ) , 3 ) resource = Res . Resource ( alias . data ) resource . AddResource ( 'alis' , 0 , '' ) Res . CloseResFile ( h ) dstfinfo = dstfss . FSpGetFInfo ( ) dstfinfo . Flags = ( dstfinfo . Flags | 32768 ) dstfss . FSpSetFInfo ( dstfinfo )
create a finder alias .