diff --git a/msys2_autobuild/build.py b/msys2_autobuild/build.py index 0407bb2..e0dc8b0 100644 --- a/msys2_autobuild/build.py +++ b/msys2_autobuild/build.py @@ -132,8 +132,7 @@ def make_tree_writable(topdir: PathLike) -> None: chmod(os.path.join(root, d)) # Work around Python bug following junctions # https://github.com/python/cpython/issues/67596#issuecomment-1918112817 - if hasattr(os.path, 'isjunction'): # Python 3.12 only - dirs[:] = [d for d in dirs if not os.path.isjunction(os.path.join(root, d))] + dirs[:] = [d for d in dirs if not os.path.isjunction(os.path.join(root, d))] for fname in files: fpath = os.path.join(root, fname) if os.path.isfile(fpath): @@ -143,8 +142,6 @@ def make_tree_writable(topdir: PathLike) -> None: def remove_junctions(topdir: PathLike) -> None: # work around a git issue where it can't handle junctions # https://github.com/git-for-windows/git/issues/5320 - if not hasattr(os.path, 'isjunction'): # Python 3.12 only - return for root, dirs, _ in os.walk(topdir): no_junctions = [] for d in dirs: diff --git a/tests/main_test.py b/tests/main_test.py index 7c79527..c4080eb 100644 --- a/tests/main_test.py +++ b/tests/main_test.py @@ -19,7 +19,7 @@ def test_make_tree_writable(): file_path.write_text("content") # Create a junction loop if possible, to make sure we ignore it - if hasattr(os.path, 'isjunction') and os.name == 'nt': + if os.name == 'nt': import _winapi _winapi.CreateJunction(str(nested_dir), str(nested_junction)) else: @@ -44,7 +44,7 @@ def test_remove_junctions(): nested_dir.mkdir() # Create a junction loop if possible, to make sure we ignore it - if hasattr(os.path, 'isjunction') and os.name == 'nt': + if os.name == 'nt': import _winapi _winapi.CreateJunction(str(nested_dir), str(nested_junction)) assert nested_junction.exists()