Skip to content

Commit

Permalink
python39: fix patchfile for older MacOS X
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelld committed Feb 23, 2021
1 parent 735c245 commit 138d609
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions lang/python39/files/patch-no-copyfile-on-Tiger.diff
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ diff --git Lib/test/test_shutil.py Lib/test/test_shutil.py
index e56b337..fdc53e3 100644
--- Lib/test/test_shutil.py
+++ Lib/test/test_shutil.py
@@ -2451,7 +2451,7 @@ class TestZeroCopySendfile(_ZeroCopyFileTest, unittest.TestCase):
@@ -2468,7 +2468,7 @@ class TestZeroCopySendfile(_ZeroCopyFileTest, unittest.TestCase):
shutil._USE_CP_SENDFILE = True


Expand All @@ -41,27 +41,16 @@ diff --git Modules/posixmodule.c Modules/posixmodule.c
index 01e8bcb..ff7fb30 100644
--- Modules/posixmodule.c
+++ Modules/posixmodule.c
@@ -56,7 +56,10 @@
@@ -56,6 +56,8 @@
*/
#if defined(__APPLE__)

-#if defined(__has_builtin) && __has_builtin(__builtin_available)
+#include <AvailabilityMacros.h>
+
+#if defined(__has_builtin)
+#if __has_builtin(__builtin_available)
# define HAVE_FSTATAT_RUNTIME __builtin_available(macOS 10.10, iOS 8.0, *)
# define HAVE_FACCESSAT_RUNTIME __builtin_available(macOS 10.10, iOS 8.0, *)
# define HAVE_FCHMODAT_RUNTIME __builtin_available(macOS 10.10, iOS 8.0, *)
@@ -74,6 +77,7 @@
# define HAVE_PWRITEV_RUNTIME __builtin_available(macOS 11.0, iOS 14.0, tvOS 14.0, watchOS 7.0, *)

# define HAVE_POSIX_SPAWN_SETSID_RUNTIME __builtin_available(macOS 10.15, *)
+#endif

#else /* Xcode 8 or earlier */

@@ -109,7 +110,7 @@ corresponding Unix manual entries for more information on calls.");
#if defined(__has_builtin)
#if __has_builtin(__builtin_available)
#define HAVE_BUILTIN_AVAILABLE 1
@@ -224,7 +226,7 @@ corresponding Unix manual entries for more information on calls.");
# include <sys/sendfile.h>
#endif

Expand All @@ -70,7 +59,7 @@ index 01e8bcb..ff7fb30 100644
# include <copyfile.h>
#endif

@@ -9484,7 +9485,7 @@ done:
@@ -9905,7 +9907,7 @@ done:
#endif /* HAVE_SENDFILE */


Expand All @@ -79,7 +68,7 @@ index 01e8bcb..ff7fb30 100644
/*[clinic input]
os._fcopyfile

@@ -14671,7 +14672,7 @@ all_ins(PyObject *m)
@@ -15110,7 +15112,7 @@ all_ins(PyObject *m)
#endif
#endif

Expand Down

4 comments on commit 138d609

@kencu
Copy link
Contributor

@kencu kencu commented on 138d609 Feb 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Next we have to figure out why the c bindings are so horribly broken on .. < 10.6 I guess it is. That is harder :>

@theadminmanager
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance this broke compiling for intel 10.5 ?

I only just installed macports last night and receive this error in the log

:debug:patch CPATH='/opt/local/include'
:debug:patch DEVELOPER_DIR='/Developer'
:debug:patch LIBRARY_PATH='/opt/local/lib'
:debug:patch MACOSX_DEPLOYMENT_TARGET='10.5'
:info:patch Executing: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_pyth
on39/python39/work/Python-3.9.2" && /usr/bin/patch -p0 < '/opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/lang/pyth
on39/files/patch-no-copyfile-on-Tiger.diff'
:debug:patch system: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python
39/python39/work/Python-3.9.2" && /usr/bin/patch -p0 < '/opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/lang/python
39/files/patch-no-copyfile-on-Tiger.diff'
:info:patch patching file Lib/test/test_shutil.py
:info:patch Hunk #1 succeeded at 2468 (offset 17 lines).
:info:patch patching file Modules/clinic/posixmodule.c.h
:info:patch patching file Modules/posixmodule.c
:info:patch Hunk #1 FAILED at 56.
:info:patch Hunk #2 succeeded at 83 (offset 6 lines).
:info:patch Hunk #3 succeeded at 225 (offset 115 lines).
:info:patch Hunk #4 succeeded at 9906 (offset 421 lines).
:info:patch Hunk #5 succeeded at 15111 (offset 439 lines).
:info:patch 1 out of 5 hunks FAILED -- saving rejects to file Modules/posixmodule.c.rej
:info:patch Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang
_python39/python39/work/Python-3.9.2" && /usr/bin/patch -p0 < '/opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/lang
/python39/files/patch-no-copyfile-on-Tiger.diff'
:info:patch Exit code: 1
:error:patch Failed to patch python39: command execution failed
:debug:patch Error code: CHILDSTATUS 9810 1
:debug:patch Backtrace: command execution failed
:debug:patch while executing
:debug:patch "system {}$notty {}$nice $fullcmdstring"
:debug:patch invoked from within
:debug:patch "command_exec patch "" "< '$patch'""
:debug:patch (procedure "portpatch::patch_main" line 41)
:debug:patch invoked from within
:debug:patch "$procedure $targetname"
:error:patch See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python39/python3
9/main.log for details.

@michaelld
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@theadminmanager you need to update your ports. the log shows the original (before this change) issue. All this PR does is if that patchfile to apply cleanly ... and correctly, actually .. .there's a subtle change in the first hunk based on upstream changes to that part of the file ...

@theadminmanager
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks that worked perfectly now

Please sign in to comment.