mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Getting rid of macfs.
This commit is contained in:
parent
abeb7d5f7f
commit
98fc683719
3 changed files with 9 additions and 9 deletions
|
@ -129,8 +129,8 @@ def islink(s):
|
||||||
"""Return true if the pathname refers to a symbolic link."""
|
"""Return true if the pathname refers to a symbolic link."""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import macfs
|
import Carbon.File
|
||||||
return macfs.ResolveAliasFile(s)[2]
|
return Carbon.File.ResolveAliasFile(s, 0)[2]
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ def abspath(path):
|
||||||
def realpath(path):
|
def realpath(path):
|
||||||
path = abspath(path)
|
path = abspath(path)
|
||||||
try:
|
try:
|
||||||
import macfs
|
import Carbon.File
|
||||||
except ImportError:
|
except ImportError:
|
||||||
return path
|
return path
|
||||||
if not path:
|
if not path:
|
||||||
|
@ -256,7 +256,7 @@ def realpath(path):
|
||||||
path = components[0] + ':'
|
path = components[0] + ':'
|
||||||
for c in components[1:]:
|
for c in components[1:]:
|
||||||
path = join(path, c)
|
path = join(path, c)
|
||||||
path = macfs.ResolveAliasFile(path)[0].as_pathname()
|
path = Carbon.File.FSResolveAliasFile(path, 1)[0].as_pathname()
|
||||||
return path
|
return path
|
||||||
|
|
||||||
supports_unicode_filenames = False
|
supports_unicode_filenames = False
|
||||||
|
|
|
@ -63,9 +63,9 @@ class PyCompileError(Exception):
|
||||||
|
|
||||||
# Define an internal helper according to the platform
|
# Define an internal helper according to the platform
|
||||||
if os.name == "mac":
|
if os.name == "mac":
|
||||||
import macfs
|
import MacOS
|
||||||
def set_creator_type(file):
|
def set_creator_type(file):
|
||||||
macfs.FSSpec(file).SetCreatorType('Pyth', 'PYC ')
|
MacOS.SetCreatorAndType(file, 'Pyth', 'PYC ')
|
||||||
else:
|
else:
|
||||||
def set_creator_type(file):
|
def set_creator_type(file):
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
import macostools
|
import macostools
|
||||||
import macfs
|
import Carbon.File
|
||||||
import MacOS
|
import MacOS
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@ -67,7 +67,7 @@ class TestMacostools(unittest.TestCase):
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
macostools.mkalias(test_support.TESTFN, TESTFN2)
|
macostools.mkalias(test_support.TESTFN, TESTFN2)
|
||||||
fss, _, _ = macfs.ResolveAliasFile(TESTFN2)
|
fss, _, _ = Carbon.File.ResolveAliasFile(TESTFN2, 0)
|
||||||
self.assertEqual(fss.as_pathname(), os.path.realpath(test_support.TESTFN))
|
self.assertEqual(fss.as_pathname(), os.path.realpath(test_support.TESTFN))
|
||||||
|
|
||||||
def test_mkalias_relative(self):
|
def test_mkalias_relative(self):
|
||||||
|
@ -76,7 +76,7 @@ class TestMacostools(unittest.TestCase):
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
macostools.mkalias(test_support.TESTFN, TESTFN2, sys.prefix)
|
macostools.mkalias(test_support.TESTFN, TESTFN2, sys.prefix)
|
||||||
fss, _, _ = macfs.ResolveAliasFile(TESTFN2)
|
fss, _, _ = Carbon.File.ResolveAliasFile(TESTFN2, 0)
|
||||||
self.assertEqual(fss.as_pathname(), os.path.realpath(test_support.TESTFN))
|
self.assertEqual(fss.as_pathname(), os.path.realpath(test_support.TESTFN))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue