]> granicus.if.org Git - python/commitdiff
Merged revisions 78061 via svnmerge from
authorRonald Oussoren <ronaldoussoren@mac.com>
Sun, 7 Feb 2010 11:39:16 +0000 (11:39 +0000)
committerRonald Oussoren <ronaldoussoren@mac.com>
Sun, 7 Feb 2010 11:39:16 +0000 (11:39 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78061 | ronald.oussoren | 2010-02-07 12:38:28 +0100 (Sun, 07 Feb 2010) | 10 lines

  A number of APIs in macostools cannot work in 64-bit mode because they
  use Carbon APIs that aren't available there.

  This patch disables tests for the affected entrypoints in macostools and
  mentions this in the documentation.

  In theory it is possible to replace the implementation by code that does
  work in 64-bit mode, but that would require further updates to the Carbon
  wrappers because the modern APIs aren't wrapped properly.
........

Doc/library/macostools.rst
Lib/test/test_macostools.py

index 96d289749ae5d1e9a3d75b5dd2aa77587a90bb2b..fc26d2fd274ec0097bad3b83c2c96861274a13db 100644 (file)
@@ -17,6 +17,8 @@ files, so it should not be used on UFS partitions.
 
    This module has been removed in Python 3.0.
 
+
+
 The :mod:`macostools` module defines the following functions:
 
 
@@ -28,17 +30,30 @@ The :mod:`macostools` module defines the following functions:
    modification and backup times (default is to copy them). Custom icons, comments
    and icon position are not copied.
 
+   .. note::
+
+      This function does not work in 64-bit code because it uses APIs that
+      are not available in 64-bit mode.
 
 .. function:: copytree(src, dst)
 
    Recursively copy a file tree from *src* to *dst*, creating folders as needed.
    *src* and *dst* should be specified as pathnames.
 
+   .. note::
+
+      This function does not work in 64-bit code because it uses APIs that
+      are not available in 64-bit mode.
 
 .. function:: mkalias(src, dst)
 
    Create a finder alias *dst* pointing to *src*.
 
+   .. note::
+
+      This function does not work in 64-bit code because it uses APIs that
+      are not available in 64-bit mode.
+
 
 .. function:: touched(dst)
 
index 5c83d28c47cc7ca36d4a9aa73e6d80527bcd34be..ac965acd40b072c27bcf536c3b00eb3e048a6c3b 100644 (file)
@@ -57,37 +57,39 @@ class TestMacostools(unittest.TestCase):
                                     DeprecationWarning)
             macostools.touched(test_support.TESTFN)
 
-    def test_copy(self):
-        try:
-            os.unlink(TESTFN2)
-        except:
-            pass
-        macostools.copy(test_support.TESTFN, TESTFN2)
-        self.assertEqual(self.compareData(), '')
+    if sys.maxint < 2**32:
+        def test_copy(self):
+            try:
+                os.unlink(TESTFN2)
+            except:
+                pass
+            macostools.copy(test_support.TESTFN, TESTFN2)
+            self.assertEqual(self.compareData(), '')
 
-    def test_mkalias(self):
-        try:
-            os.unlink(TESTFN2)
-        except:
-            pass
-        macostools.mkalias(test_support.TESTFN, TESTFN2)
-        fss, _, _ = Carbon.File.ResolveAliasFile(TESTFN2, 0)
-        self.assertEqual(fss.as_pathname(), os.path.realpath(test_support.TESTFN))
+    if sys.maxint < 2**32:
+        def test_mkalias(self):
+            try:
+                os.unlink(TESTFN2)
+            except:
+                pass
+            macostools.mkalias(test_support.TESTFN, TESTFN2)
+            fss, _, _ = Carbon.File.ResolveAliasFile(TESTFN2, 0)
+            self.assertEqual(fss.as_pathname(), os.path.realpath(test_support.TESTFN))
 
-    def test_mkalias_relative(self):
-        try:
-            os.unlink(TESTFN2)
-        except:
-            pass
-        # If the directory doesn't exist, then chances are this is a new
-        # install of Python so don't create it since the user might end up
-        # running ``sudo make install`` and creating the directory here won't
-        # leave it with the proper permissions.
-        if not os.path.exists(sys.prefix):
-            return
-        macostools.mkalias(test_support.TESTFN, TESTFN2, sys.prefix)
-        fss, _, _ = Carbon.File.ResolveAliasFile(TESTFN2, 0)
-        self.assertEqual(fss.as_pathname(), os.path.realpath(test_support.TESTFN))
+        def test_mkalias_relative(self):
+            try:
+                os.unlink(TESTFN2)
+            except:
+                pass
+            # If the directory doesn't exist, then chances are this is a new
+            # install of Python so don't create it since the user might end up
+            # running ``sudo make install`` and creating the directory here won't
+            # leave it with the proper permissions.
+            if not os.path.exists(sys.prefix):
+                return
+            macostools.mkalias(test_support.TESTFN, TESTFN2, sys.prefix)
+            fss, _, _ = Carbon.File.ResolveAliasFile(TESTFN2, 0)
+            self.assertEqual(fss.as_pathname(), os.path.realpath(test_support.TESTFN))
 
 
 def test_main():