Hi,
the current test code causes two test failures on my machine (Windows,
python 64-bit, drives G-J HDDs, drive K dvd drive - tested with SVN
1.9.4 and trunk).
The issue seems to be that the fallback detection code incorrectly
concludes that drive K is a free drive letter, if there's no disc in the
drive. This then results in two test failures for me:
- checkout #14
- update #31
Full details available here [1].
The attached patch resolves the issue by replacing the current code
detecting free drive letters by using the ctypes library instead of the
win32api library.
As far as I understand things, this is backwards compatible with Python
>= 2.5 [2]. Since SVN 1.9/trunk require Python >= 2.7, I don't see any
compatibility concern for this change.
[[[
Resolve test failures on Windows when running with Python 64-bit.
* subversion/tests/cmdline/checkout_tests.py
(checkout_wc_from_drive): replace the win32api-dependent drive letter
detection code with the an approach using
the more
portable ctypes library and direct call to the
kernel32's GetLogicalDrives() function
* subversion/tests/cmdline/update_tests.py
(update_wc_on_windows_drive): the same
]]]
[1] http://www.luke1410.de:8090/browse/MAXSVN-65
[2] http://python.net/crew/theller/ctypes/
Regards,
Stefan
Index: subversion/tests/cmdline/checkout_tests.py
===
--- subversion/tests/cmdline/checkout_tests.py (revision 1743999)
+++ subversion/tests/cmdline/checkout_tests.py (working copy)
@@ -1052,23 +1052,22 @@
"find the first available drive"
# get the list of used drive letters, use some Windows specific function.
-try:
- import win32api
+import ctypes
+import string
+drives = []
+# compile a list of used drive letters
+drive_bitmask = ctypes.windll.kernel32.GetLogicalDrives()
+for drive in string.uppercase:
+ if drive_bitmask & 1:
+drives.append(drive)
+ drive_bitmask >>= 1
- drives=win32api.GetLogicalDriveStrings()
- drives=drives.split('\000')
+# find the first unused drive letter
+for d in range(ord('G'), ord('Z')+1):
+ drive = chr(d)
+ if not drive in drives:
+return drive
- for d in range(ord('G'), ord('Z')+1):
-drive = chr(d)
-if not drive + ':\\' in drives:
- return drive
-except ImportError:
- # In ActiveState python x64 win32api is not available
- for d in range(ord('G'), ord('Z')+1):
-drive = chr(d)
-if not os.path.isdir(drive + ':\\'):
- return drive
-
return None
# just create an empty folder, we'll checkout later.
Index: subversion/tests/cmdline/update_tests.py
===
--- subversion/tests/cmdline/update_tests.py (revision 1743999)
+++ subversion/tests/cmdline/update_tests.py (working copy)
@@ -2245,23 +2245,22 @@
"find the first available drive"
# get the list of used drive letters, use some Windows specific function.
-try:
- import win32api
+import ctypes
+import string
+drives = []
+# compile a list of used drive letters
+drive_bitmask = ctypes.windll.kernel32.GetLogicalDrives()
+for drive in string.uppercase:
+ if drive_bitmask & 1:
+drives.append(drive)
+ drive_bitmask >>= 1
- drives=win32api.GetLogicalDriveStrings()
- drives=drives.split('\000')
+# find the first unused drive letter
+for d in range(ord('G'), ord('Z')+1):
+ drive = chr(d)
+ if not drive in drives:
+return drive
- for d in range(ord('G'), ord('Z')+1):
-drive = chr(d)
-if not drive + ':\\' in drives:
- return drive
-except ImportError:
- # In ActiveState python x64 win32api is not available
- for d in range(ord('G'), ord('Z')+1):
-drive = chr(d)
-if not os.path.isdir(drive + ':\\'):
- return drive
-
return None
# just create an empty folder, we'll checkout later.
smime.p7s
Description: S/MIME Cryptographic Signature