h-vetinari commented on issue #48874:
URL: https://github.com/apache/arrow/issues/48874#issuecomment-3772831757

   Thanks a lot! Conda-forge has the ability to backport patches where 
necessary. Since `main` had barely any time to move on, and we need this change 
to fix our builds, I'll definitely consider a backport. That said, looking at 
the description of #48601, you're IMO going quite a bit further than would be 
necessary. Not that I'm against using C++20 std facilities per se (though 
they're still not completely implemented in libc++), but strictly speaking we 
only need a way to use conda-forge's tzdata.
   
   When I started down this rabbit hole, I had some first trivial changes that 
looked as follows (before realizing that it's connected pretty deeply with the 
vendored stuff and probably not so easy to pipe through; from that POV, I can 
understand going with C++20 😅):
   
   ```diff
   diff --git a/cpp/src/arrow/vendored/datetime/tz.cpp 
b/cpp/src/arrow/vendored/datetime/tz.cpp
   index 2cf6c62a84..27a64701a4 100644
   --- a/cpp/src/arrow/vendored/datetime/tz.cpp
   +++ b/cpp/src/arrow/vendored/datetime/tz.cpp
   @@ -476,16 +475,19 @@ CONSTDATA auto max_day = date::December/31;
   
    CONSTCD14 const sys_seconds min_seconds = sys_days(min_year/min_day);
   
   -#endif  // USE_OS_TZDB
   -
   -#ifndef _WIN32
   -
    static
    std::string
    discover_tz_dir()
    {
        struct stat sb;
        using namespace std;
   +    // this is present if we're in an activated conda environment
   +    const char* condaPrefix = getenv("CONDA_PREFIX");
   +    if (condaPrefix) {
   +      string condaDir(condaPrefix);
   +      condaDir += "/share/zoneinfo";
   +      return condaDir;
   +    }
    #  if defined(ANDROID) || defined(__ANDROID__)
        CONSTDATA auto tz_dir_default = "/apex/com.android.tzdata/etc/tz";
        CONSTDATA auto tz_dir_fallback = "/system/usr/share/zoneinfo";
   diff --git a/cpp/src/arrow/vendored/datetime/tz.h 
b/cpp/src/arrow/vendored/datetime/tz.h
   index 61ab3df106..cd5fa70d29 100644
   --- a/cpp/src/arrow/vendored/datetime/tz.h
   +++ b/cpp/src/arrow/vendored/datetime/tz.h
   @@ -82,12 +82,6 @@ static_assert(HAS_REMOTE_API == 0 ? AUTO_DOWNLOAD == 0 : 
true,
    #  define USE_SHELL_API 1
    #endif
   
   -#if USE_OS_TZDB
   -#  ifdef _WIN32
   -#    error "USE_OS_TZDB can not be used on Windows"
   -#  endif
   -#endif
   -
    #ifndef HAS_DEDUCTION_GUIDES
    #  if __cplusplus >= 201703
    #    define HAS_DEDUCTION_GUIDES 1
   diff --git a/cpp/src/arrow/vendored/datetime/visibility.h 
b/cpp/src/arrow/vendored/datetime/visibility.h
   index 780c00d70b..cd182bdf70 100644
   --- a/cpp/src/arrow/vendored/datetime/visibility.h
   +++ b/cpp/src/arrow/vendored/datetime/visibility.h
   @@ -17,9 +17,7 @@
   
    #pragma once
   
   -#ifndef _WIN32
   -#  define USE_OS_TZDB 1
   -#endif
   +#define USE_OS_TZDB 1
   
    #if defined(ARROW_STATIC)
    // intentially empty
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to