posix.copyfile does not exist on Tiger. 

Python 3.8's posix._fcopyfile implementation unconditionally uses <copyfile.h>, 
which only exists on Leopard ane newer. This patch removes posix._fcopyfile 
on Tiger - this is okay because the rest of the stdlib uses posix._fcopyfile 
only conditionally after checking that the function exists 
(non-Apple systems don't have posix._fcopyfile either).


thanks to @dgelessus
https://github.com/macports/macports-ports/pull/5987


--- Lib/test/test_shutil.py.orig
+++ Lib/test/test_shutil.py
@@ -2393,7 +2393,7 @@
             shutil._USE_CP_SENDFILE = True
 
 
-@unittest.skipIf(not MACOS, 'macOS only')
+@unittest.skipIf(not MACOS or not hasattr(posix, "_fcopyfile"), 'macOS with posix._fcopyfile only')
 class TestZeroCopyMACOS(_ZeroCopyFileTest, unittest.TestCase):
     PATCHPOINT = "posix._fcopyfile"
 
--- Modules/clinic/posixmodule.c.h.orig
+++ Modules/clinic/posixmodule.c.h
@@ -4975,7 +4975,7 @@ exit:
     return return_value;
 }
 
-#if defined(__APPLE__)
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
 
 PyDoc_STRVAR(os__fcopyfile__doc__,
 "_fcopyfile($module, infd, outfd, flags, /)\n"
--- ./Modules/posixmodule.c.orig
+++ ./Modules/posixmodule.c
@@ -11,6 +11,7 @@
 
 
 #ifdef __APPLE__
+#include <AvailabilityMacros.h>
    /*
     * Step 1 of support for weak-linking a number of symbols existing on
     * OSX 10.4 and later, see the comment in the #ifdef __APPLE__ block
@@ -109,7 +110,7 @@
 #include <sys/sendfile.h>
 #endif
 
-#if defined(__APPLE__)
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
 #include <copyfile.h>
 #endif
 
@@ -9266,7 +9267,7 @@
 #endif /* HAVE_SENDFILE */
 
 
-#if defined(__APPLE__)
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
 /*[clinic input]
 os._fcopyfile
 
@@ -14368,7 +14369,7 @@
 #endif
 #endif
 
-#if defined(__APPLE__)
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
     if (PyModule_AddIntConstant(m, "_COPYFILE_DATA", COPYFILE_DATA)) return -1;
 #endif
 
