Patchwork D11451: pyoxidizer: don't use in-memory for resources on macOS

login
register
mail settings
Submitter phabricator
Date Sept. 17, 2021, 9:01 p.m.
Message ID <differential-rev-PHID-DREV-swjeytriurfo4u2ouh7j-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49767/
State Superseded
Headers show

Comments

phabricator - Sept. 17, 2021, 9:01 p.m.
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  When trying to debug something else on macOS, pyoxidized builds were failing
  with the following message about pywatchman (and then cext.base85 when I
  commented out pywatchman):
  
    "cannot be loaded from memory but memory loading required"
  
  I don't have any immediate plans to do more work on macOS, but maybe this will
  save someone else time debugging this.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D11451

AFFECTED FILES
  rust/hgcli/pyoxidizer.bzl

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/rust/hgcli/pyoxidizer.bzl b/rust/hgcli/pyoxidizer.bzl
--- a/rust/hgcli/pyoxidizer.bzl
+++ b/rust/hgcli/pyoxidizer.bzl
@@ -33,6 +33,7 @@ 
 TIME_STAMP_SERVER_URL = VARS.get("TIME_STAMP_SERVER_URL", "http://timestamp.digicert.com")
 
 IS_WINDOWS = "windows" in BUILD_TARGET_TRIPLE
+IS_MACOS = "darwin" in BUILD_TARGET_TRIPLE
 
 # Code to run in Python interpreter.
 RUN_CODE = """
@@ -69,7 +70,7 @@ 
     return default_python_distribution(python_version = "3.9")
 
 def resource_callback(policy, resource):
-    if not IS_WINDOWS:
+    if not (IS_WINDOWS or IS_MACOS):
         resource.add_location = "in-memory"
         return
 
@@ -100,7 +101,7 @@ 
     # extensions.
     packaging_policy.extension_module_filter = "all"
     packaging_policy.resources_location = "in-memory"
-    if IS_WINDOWS:
+    if IS_WINDOWS or IS_MACOS:
         packaging_policy.resources_location_fallback = "filesystem-relative:lib"
     packaging_policy.register_resource_callback(resource_callback)