amoeba commented on code in PR #45425:
URL: https://github.com/apache/arrow/pull/45425#discussion_r1942205440


##########
ci/scripts/python_wheel_windows_test.bat:
##########
@@ -58,11 +58,14 @@ py -0p
 @REM Validate wheel contents
 %PYTHON_CMD% C:\arrow\ci\scripts\python_wheel_validate_contents.py --path 
C:\arrow\python\repaired_wheels || exit /B 1
 
-@rem Download IANA Timezone Database for ORC C++
-curl https://cygwin.osuosl.org/noarch/release/tzdata/tzdata-2024a-1.tar.xz 
--output tzdata.tar.xz || exit /B
-mkdir %USERPROFILE%\Downloads\test\tzdata
-arc unarchive tzdata.tar.xz %USERPROFILE%\Downloads\test\tzdata || exit /B
-set TZDIR=%USERPROFILE%\Downloads\test\tzdata\usr\share\zoneinfo
+@rem Install tzdata python package and set TZDIR to tzdata database defined 
inside
+%PYTHON_CMD% -m pip install tzdata || exit /B 1
+@echo off
+setlocal EnableDelayedExpansion
+set PYTHON_PROGRAM=!PYTHON_CMD! -c "import os; from importlib import 
resources; print(os.path.join(resources.files('tzdata'), 'zoneinfo'));"
+for /f "delims=" %%i in ('!PYTHON_PROGRAM!') do set "TZDIR=%%i"
+setlocal DisabledDelayedExpansion
+@echo on

Review Comment:
   This bit is kind of a lot to digest. I used a combination of StackOverflow 
and LLMs to come up with a few of the pieces.
   
   - The `EnableDelayedExpansion`/`DisabledDelayedExpansion` bit is to work 
around some apparently variable expansion rules in batch scripts. Without that, 
%PYTHON_PROGRAM% ends up truncated
   - Re: `for /f`... Yes, I think this is how you're supposed to capture 
command output in batch scripts.



##########
ci/scripts/python_wheel_windows_test.bat:
##########
@@ -58,11 +58,14 @@ py -0p
 @REM Validate wheel contents
 %PYTHON_CMD% C:\arrow\ci\scripts\python_wheel_validate_contents.py --path 
C:\arrow\python\repaired_wheels || exit /B 1
 
-@rem Download IANA Timezone Database for ORC C++
-curl https://cygwin.osuosl.org/noarch/release/tzdata/tzdata-2024a-1.tar.xz 
--output tzdata.tar.xz || exit /B
-mkdir %USERPROFILE%\Downloads\test\tzdata
-arc unarchive tzdata.tar.xz %USERPROFILE%\Downloads\test\tzdata || exit /B
-set TZDIR=%USERPROFILE%\Downloads\test\tzdata\usr\share\zoneinfo
+@rem Install tzdata python package and set TZDIR to tzdata database defined 
inside
+%PYTHON_CMD% -m pip install tzdata || exit /B 1
+@echo off
+setlocal EnableDelayedExpansion
+set PYTHON_PROGRAM=!PYTHON_CMD! -c "import os; from importlib import 
resources; print(os.path.join(resources.files('tzdata'), 'zoneinfo'));"
+for /f "delims=" %%i in ('!PYTHON_PROGRAM!') do set "TZDIR=%%i"
+setlocal DisabledDelayedExpansion
+@echo on

Review Comment:
   This bit is kind of a lot to digest. I used a combination of StackOverflow 
and LLMs to come up with a few of the pieces:
   
   - The `EnableDelayedExpansion`/`DisabledDelayedExpansion` bit is to work 
around some apparently variable expansion rules in batch scripts. Without that, 
%PYTHON_PROGRAM% ends up truncated
   - Re: `for /f`... Yes, I think this is how you're supposed to capture 
command output in batch scripts.



-- 
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