diff options
author | Dmitry Kopylov <kopylovd@gmail.com> | 2022-02-10 16:48:18 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:18 +0300 |
commit | b2f5101486cc0de2e979c8ba9ada2109785bf5fd (patch) | |
tree | affe28b840816b505db0467f2285b01c89c04247 /library/python/fs | |
parent | e9b28b5aad71453a4637b70dde02e801e4147a2a (diff) | |
download | ydb-b2f5101486cc0de2e979c8ba9ada2109785bf5fd.tar.gz |
Restoring authorship annotation for Dmitry Kopylov <kopylovd@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'library/python/fs')
-rw-r--r-- | library/python/fs/__init__.py | 94 | ||||
-rw-r--r-- | library/python/fs/test/test_fs.py | 350 | ||||
-rw-r--r-- | library/python/fs/test/ya.make | 26 | ||||
-rw-r--r-- | library/python/fs/ya.make | 28 |
4 files changed, 249 insertions, 249 deletions
diff --git a/library/python/fs/__init__.py b/library/python/fs/__init__.py index b1b7cde079..06dced90d8 100644 --- a/library/python/fs/__init__.py +++ b/library/python/fs/__init__.py @@ -14,15 +14,15 @@ import library.python.func import library.python.strings import library.python.windows -logger = logging.getLogger(__name__) - - -try: - WindowsError -except NameError: - WindowsError = None - - +logger = logging.getLogger(__name__) + + +try: + WindowsError +except NameError: + WindowsError = None + + _diehard_win_tries = 10 errorfix_win = library.python.windows.errorfix @@ -127,10 +127,10 @@ def remove_dir(path): os.rmdir(path) -def fix_path_encoding(path): +def fix_path_encoding(path): return library.python.strings.to_str(path, library.python.strings.fs_encoding()) - - + + # File/directory remove # Non-atomic # Throws OSError, AssertionError @@ -140,8 +140,8 @@ def remove_tree(path): def rmtree(path): if library.python.windows.on_win(): library.python.windows.rmtree(path) - else: - shutil.rmtree(fix_path_encoding(path)) + else: + shutil.rmtree(fix_path_encoding(path)) st = os.lstat(path) if stat.S_ISLNK(st.st_mode) or stat.S_ISREG(st.st_mode): @@ -161,7 +161,7 @@ def remove_tree_safe(path): if stat.S_ISLNK(st.st_mode) or stat.S_ISREG(st.st_mode): os.remove(path) elif stat.S_ISDIR(st.st_mode): - shutil.rmtree(fix_path_encoding(path), ignore_errors=True) + shutil.rmtree(fix_path_encoding(path), ignore_errors=True) # XXX except UnicodeDecodeError as e: logging.exception(u'remove_tree_safe with argument %s raise exception: %s', path, e) @@ -196,11 +196,11 @@ def hardlink(src, lnk): os.link(src, lnk) -@errorfix_win -def hardlink_or_copy(src, lnk): - def should_fallback_to_copy(exc): - if WindowsError is not None and isinstance(exc, WindowsError) and exc.winerror == 1142: # too many hardlinks - return True +@errorfix_win +def hardlink_or_copy(src, lnk): + def should_fallback_to_copy(exc): + if WindowsError is not None and isinstance(exc, WindowsError) and exc.winerror == 1142: # too many hardlinks + return True # cross-device hardlink or too many hardlinks, or some known WSL error if isinstance(exc, OSError) and exc.errno in ( errno.EXDEV, @@ -209,19 +209,19 @@ def hardlink_or_copy(src, lnk): errno.EACCES, errno.EPERM, ): - return True - return False - - try: - hardlink(src, lnk) - except Exception as e: + return True + return False + + try: + hardlink(src, lnk) + except Exception as e: logger.debug('Failed to hardlink %s to %s with error %s, will copy it', src, lnk, repr(e)) - if should_fallback_to_copy(e): + if should_fallback_to_copy(e): copy2(src, lnk, follow_symlinks=False) - else: - raise - - + else: + raise + + # Atomic file/directory symlink (Unix only) # Dst must not exist # Throws OSError @@ -259,7 +259,7 @@ def hardlink_tree(src, dst): if os.path.isfile(src): hardlink(src, dst) return - for dirpath, _, filenames in walk_relative(src): + for dirpath, _, filenames in walk_relative(src): src_dirpath = os.path.join(src, dirpath) if dirpath != '.' else src dst_dirpath = os.path.join(dst, dirpath) if dirpath != '.' else dst os.mkdir(dst_dirpath) @@ -270,20 +270,20 @@ def hardlink_tree(src, dst): # File copy # throws EnvironmentError (OSError, IOError) @errorfix_win -def copy_file(src, dst, copy_function=shutil.copy2): +def copy_file(src, dst, copy_function=shutil.copy2): if os.path.isdir(dst): raise CustomFsError(errno.EISDIR, filename=dst) - copy_function(src, dst) + copy_function(src, dst) # File/directory copy # throws EnvironmentError (OSError, IOError, shutil.Error) @errorfix_win -def copy_tree(src, dst, copy_function=shutil.copy2): +def copy_tree(src, dst, copy_function=shutil.copy2): if os.path.isfile(src): - copy_file(src, dst, copy_function=copy_function) + copy_file(src, dst, copy_function=copy_function) return - copytree3(src, dst, copy_function=copy_function) + copytree3(src, dst, copy_function=copy_function) # File read @@ -356,7 +356,7 @@ def get_tree_size(path, recursive=False, raise_all_errors=False): except OSError as e: if raise_all_errors: raise - logger.debug("Cannot calculate file size: %s", e) + logger.debug("Cannot calculate file size: %s", e) if not recursive: break return total_size @@ -447,25 +447,25 @@ def copytree3( copy_function(srcname, dstname) # catch the Error from the recursive copytree3 so that we can # continue with other files - except shutil.Error as err: + except shutil.Error as err: errors.extend(err.args[0]) - except EnvironmentError as why: + except EnvironmentError as why: errors.append((srcname, dstname, str(why))) try: shutil.copystat(src, dst) - except OSError as why: + except OSError as why: if WindowsError is not None and isinstance(why, WindowsError): # Copying file access times may fail on Windows pass else: errors.extend((src, dst, str(why))) if errors: - raise shutil.Error(errors) - - -def walk_relative(path, topdown=True, onerror=None, followlinks=False): - for dirpath, dirnames, filenames in os.walk(path, topdown=topdown, onerror=onerror, followlinks=followlinks): - yield os.path.relpath(dirpath, path), dirnames, filenames + raise shutil.Error(errors) + + +def walk_relative(path, topdown=True, onerror=None, followlinks=False): + for dirpath, dirnames, filenames in os.walk(path, topdown=topdown, onerror=onerror, followlinks=followlinks): + yield os.path.relpath(dirpath, path), dirnames, filenames def supports_clone(): diff --git a/library/python/fs/test/test_fs.py b/library/python/fs/test/test_fs.py index 9e2c70c069..6bbd761c04 100644 --- a/library/python/fs/test/test_fs.py +++ b/library/python/fs/test/test_fs.py @@ -3,20 +3,20 @@ import errno import os import pytest -import shutil +import shutil import six -import library.python.fs +import library.python.fs import library.python.strings -import library.python.tmp +import library.python.tmp import library.python.windows -import yatest.common - +import yatest.common + def in_env(case): def wrapped_case(*args, **kwargs): - with library.python.tmp.temp_dir() as temp_dir: + with library.python.tmp.temp_dir() as temp_dir: case(lambda path: os.path.join(temp_dir, path)) return wrapped_case @@ -84,7 +84,7 @@ def gen_error_access_denied(): def test_errorfix_win(): - @library.python.fs.errorfix_win + @library.python.fs.errorfix_win def erroneous_func(): gen_error_access_denied() @@ -99,7 +99,7 @@ def test_errorfix_win(): def test_custom_fs_error(): with pytest.raises(OSError) as errinfo: - raise library.python.fs.CustomFsError(errno.EACCES, filename='some/file') + raise library.python.fs.CustomFsError(errno.EACCES, filename='some/file') assert errinfo.value.errno == errno.EACCES # See transcode_error, which encodes strerror, in library/python/windows/__init__.py assert isinstance(errinfo.value.strerror, (six.binary_type, six.text_type)) @@ -108,7 +108,7 @@ def test_custom_fs_error(): @in_env def test_ensure_dir(path): - library.python.fs.ensure_dir(path('dir/subdir')) + library.python.fs.ensure_dir(path('dir/subdir')) assert os.path.isdir(path('dir')) assert os.path.isdir(path('dir/subdir')) @@ -116,7 +116,7 @@ def test_ensure_dir(path): @in_env def test_ensure_dir_exists(path): os.makedirs(path('dir/subdir')) - library.python.fs.ensure_dir(path('dir/subdir')) + library.python.fs.ensure_dir(path('dir/subdir')) assert os.path.isdir(path('dir')) assert os.path.isdir(path('dir/subdir')) @@ -124,7 +124,7 @@ def test_ensure_dir_exists(path): @in_env def test_ensure_dir_exists_partly(path): os.mkdir(path('dir')) - library.python.fs.ensure_dir(path('dir/subdir')) + library.python.fs.ensure_dir(path('dir/subdir')) assert os.path.isdir(path('dir')) assert os.path.isdir(path('dir/subdir')) @@ -133,7 +133,7 @@ def test_ensure_dir_exists_partly(path): def test_ensure_dir_exists_file(path): mkfile(path('dir')) with pytest.raises(OSError) as errinfo: - library.python.fs.ensure_dir(path('dir/subdir')) + library.python.fs.ensure_dir(path('dir/subdir')) # ENOENT on Windows! assert errinfo.value.errno in (errno.ENOTDIR, errno.ENOENT) assert os.path.isfile(path('dir')) @@ -141,7 +141,7 @@ def test_ensure_dir_exists_file(path): @in_env def test_create_dirs(path): - assert library.python.fs.create_dirs(path('dir/subdir')) == path('dir/subdir') + assert library.python.fs.create_dirs(path('dir/subdir')) == path('dir/subdir') assert os.path.isdir(path('dir')) assert os.path.isdir(path('dir/subdir')) @@ -149,7 +149,7 @@ def test_create_dirs(path): @in_env def test_move_file(path): mkfile(path('src'), 'SRC') - library.python.fs.move(path('src'), path('dst')) + library.python.fs.move(path('src'), path('dst')) assert not os.path.isfile(path('src')) assert os.path.isfile(path('dst')) assert file_data(path('dst')) == 'SRC' @@ -158,7 +158,7 @@ def test_move_file(path): @in_env def test_move_file_no_src(path): with pytest.raises(OSError) as errinfo: - library.python.fs.move(path('src'), path('dst')) + library.python.fs.move(path('src'), path('dst')) assert errinfo.value.errno == errno.ENOENT @@ -169,13 +169,13 @@ def test_move_file_exists(path): if library.python.windows.on_win(): # move is platform-dependent, use replace_file for dst replacement on all platforms with pytest.raises(OSError) as errinfo: - library.python.fs.move(path('src'), path('dst')) + library.python.fs.move(path('src'), path('dst')) assert errinfo.value.errno == errno.EEXIST assert os.path.isfile(path('src')) assert os.path.isfile(path('dst')) assert file_data(path('dst')) == 'DST' else: - library.python.fs.move(path('src'), path('dst')) + library.python.fs.move(path('src'), path('dst')) assert not os.path.isfile(path('src')) assert os.path.isfile(path('dst')) assert file_data(path('dst')) == 'SRC' @@ -186,7 +186,7 @@ def test_move_file_exists_dir_empty(path): mkfile(path('src'), 'SRC') os.mkdir(path('dst')) with pytest.raises(OSError) as errinfo: - library.python.fs.move(path('src'), path('dst')) + library.python.fs.move(path('src'), path('dst')) assert errinfo.value.errno in (errno.EEXIST, errno.EISDIR) assert os.path.isfile(path('src')) assert os.path.isdir(path('dst')) @@ -199,7 +199,7 @@ def test_move_file_exists_dir_nonempty(path): os.mkdir(path('dst')) mkfile(path('dst/dst_file')) with pytest.raises(OSError) as errinfo: - library.python.fs.move(path('src'), path('dst')) + library.python.fs.move(path('src'), path('dst')) assert errinfo.value.errno in (errno.EEXIST, errno.EISDIR) assert os.path.isfile(path('src')) assert os.path.isdir(path('dst')) @@ -211,7 +211,7 @@ def test_move_file_exists_dir_nonempty(path): def test_move_dir(path): os.mkdir(path('src')) mkfile(path('src/src_file')) - library.python.fs.move(path('src'), path('dst')) + library.python.fs.move(path('src'), path('dst')) assert not os.path.isdir(path('src')) assert os.path.isdir(path('dst')) assert os.path.isfile(path('dst/src_file')) @@ -225,13 +225,13 @@ def test_move_dir_exists_empty(path): if library.python.windows.on_win(): # move is platform-dependent, use non-atomic replace for directory replacement with pytest.raises(OSError) as errinfo: - library.python.fs.move(path('src'), path('dst')) + library.python.fs.move(path('src'), path('dst')) assert errinfo.value.errno == errno.EEXIST assert os.path.isdir(path('src')) assert os.path.isdir(path('dst')) assert not os.path.isfile(path('dst/src_file')) else: - library.python.fs.move(path('src'), path('dst')) + library.python.fs.move(path('src'), path('dst')) assert not os.path.isdir(path('src')) assert os.path.isdir(path('dst')) assert os.path.isfile(path('dst/src_file')) @@ -244,7 +244,7 @@ def test_move_dir_exists_nonempty(path): os.mkdir(path('dst')) mkfile(path('dst/dst_file')) with pytest.raises(OSError) as errinfo: - library.python.fs.move(path('src'), path('dst')) + library.python.fs.move(path('src'), path('dst')) assert errinfo.value.errno in (errno.EEXIST, errno.ENOTEMPTY) assert os.path.isdir(path('src')) assert os.path.isfile(path('src/src_file')) @@ -259,7 +259,7 @@ def test_move_dir_exists_file(path): mkfile(path('src/src_file')) mkfile(path('dst'), 'DST') with pytest.raises(OSError) as errinfo: - library.python.fs.move(path('src'), path('dst')) + library.python.fs.move(path('src'), path('dst')) assert errinfo.value.errno in (errno.EEXIST, errno.ENOTDIR) assert os.path.isdir(path('src')) assert os.path.isfile(path('dst')) @@ -269,13 +269,13 @@ def test_move_dir_exists_file(path): @in_env def test_replace_file(path): mkfile(path('src'), 'SRC') - library.python.fs.replace_file(path('src'), path('dst')) + library.python.fs.replace_file(path('src'), path('dst')) assert not os.path.isfile(path('src')) assert os.path.isfile(path('dst')) assert file_data(path('dst')) == 'SRC' mkfile(path('src'), 'SRC') - library.python.fs.replace(path('src'), path('dst2')) + library.python.fs.replace(path('src'), path('dst2')) assert not os.path.isfile(path('src')) assert os.path.isfile(path('dst2')) assert file_data(path('dst2')) == 'SRC' @@ -284,11 +284,11 @@ def test_replace_file(path): @in_env def test_replace_file_no_src(path): with pytest.raises(OSError) as errinfo: - library.python.fs.replace_file(path('src'), path('dst')) + library.python.fs.replace_file(path('src'), path('dst')) assert errinfo.value.errno == errno.ENOENT with pytest.raises(OSError) as errinfo2: - library.python.fs.replace(path('src'), path('dst2')) + library.python.fs.replace(path('src'), path('dst2')) assert errinfo2.value.errno == errno.ENOENT @@ -296,14 +296,14 @@ def test_replace_file_no_src(path): def test_replace_file_exists(path): mkfile(path('src'), 'SRC') mkfile(path('dst'), 'DST') - library.python.fs.replace_file(path('src'), path('dst')) + library.python.fs.replace_file(path('src'), path('dst')) assert not os.path.isfile(path('src')) assert os.path.isfile(path('dst')) assert file_data(path('dst')) == 'SRC' mkfile(path('src'), 'SRC') mkfile(path('dst2'), 'DST') - library.python.fs.replace(path('src'), path('dst2')) + library.python.fs.replace(path('src'), path('dst2')) assert not os.path.isfile(path('src')) assert os.path.isfile(path('dst2')) assert file_data(path('dst2')) == 'SRC' @@ -314,7 +314,7 @@ def test_replace_file_exists_dir_empty(path): mkfile(path('src'), 'SRC') os.mkdir(path('dst')) with pytest.raises(OSError) as errinfo: - library.python.fs.replace_file(path('src'), path('dst')) + library.python.fs.replace_file(path('src'), path('dst')) assert errinfo.value.errno in (errno.EISDIR, errno.EACCES) assert os.path.isfile(path('src')) assert os.path.isdir(path('dst')) @@ -325,7 +325,7 @@ def test_replace_file_exists_dir_empty(path): def test_replace_file_exists_dir_empty_overwrite(path): mkfile(path('src'), 'SRC') os.mkdir(path('dst')) - library.python.fs.replace(path('src'), path('dst')) + library.python.fs.replace(path('src'), path('dst')) assert not os.path.isfile(path('src')) assert os.path.isfile(path('dst')) assert file_data(path('dst')) == 'SRC' @@ -337,20 +337,20 @@ def test_replace_file_exists_dir_nonempty(path): os.mkdir(path('dst')) mkfile(path('dst/dst_file')) with pytest.raises(OSError) as errinfo: - library.python.fs.replace_file(path('src'), path('dst')) + library.python.fs.replace_file(path('src'), path('dst')) assert errinfo.value.errno in (errno.EISDIR, errno.EACCES) assert os.path.isfile(path('src')) assert os.path.isdir(path('dst')) assert os.path.isfile(path('dst/dst_file')) assert not os.path.isfile(path('dst/src')) - - + + @in_env def test_replace_file_exists_dir_nonempty_overwrite(path): mkfile(path('src'), 'SRC') os.mkdir(path('dst')) mkfile(path('dst/dst_file')) - library.python.fs.replace(path('src'), path('dst')) + library.python.fs.replace(path('src'), path('dst')) assert not os.path.isfile(path('src')) assert os.path.isfile(path('dst')) assert file_data(path('dst')) == 'SRC' @@ -360,7 +360,7 @@ def test_replace_file_exists_dir_nonempty_overwrite(path): def test_replace_dir(path): os.mkdir(path('src')) mkfile(path('src/src_file')) - library.python.fs.replace(path('src'), path('dst')) + library.python.fs.replace(path('src'), path('dst')) assert not os.path.isdir(path('src')) assert os.path.isdir(path('dst')) assert os.path.isfile(path('dst/src_file')) @@ -371,7 +371,7 @@ def test_replace_dir_exists_empty(path): os.mkdir(path('src')) mkfile(path('src/src_file')) os.mkdir(path('dst')) - library.python.fs.replace(path('src'), path('dst')) + library.python.fs.replace(path('src'), path('dst')) assert not os.path.isdir(path('src')) assert os.path.isdir(path('dst')) assert os.path.isfile(path('dst/src_file')) @@ -383,7 +383,7 @@ def test_replace_dir_exists_nonempty(path): mkfile(path('src/src_file')) os.mkdir(path('dst')) mkfile(path('dst/dst_file')) - library.python.fs.replace(path('src'), path('dst')) + library.python.fs.replace(path('src'), path('dst')) assert not os.path.isdir(path('src')) assert os.path.isdir(path('dst')) assert os.path.isfile(path('dst/src_file')) @@ -395,7 +395,7 @@ def test_replace_dir_exists_file(path): os.mkdir(path('src')) mkfile(path('src/src_file')) mkfile(path('dst'), 'DST') - library.python.fs.replace(path('src'), path('dst')) + library.python.fs.replace(path('src'), path('dst')) assert not os.path.isdir(path('src')) assert os.path.isdir(path('dst')) assert os.path.isfile(path('dst/src_file')) @@ -404,14 +404,14 @@ def test_replace_dir_exists_file(path): @in_env def test_remove_file(path): mkfile(path('path')) - library.python.fs.remove_file(path('path')) + library.python.fs.remove_file(path('path')) assert not os.path.exists(path('path')) @in_env def test_remove_file_no(path): with pytest.raises(OSError) as errinfo: - library.python.fs.remove_file(path('path')) + library.python.fs.remove_file(path('path')) assert errinfo.value.errno == errno.ENOENT @@ -419,7 +419,7 @@ def test_remove_file_no(path): def test_remove_file_exists_dir(path): os.mkdir(path('path')) with pytest.raises(OSError) as errinfo: - library.python.fs.remove_file(path('path')) + library.python.fs.remove_file(path('path')) assert errinfo.value.errno in (errno.EISDIR, errno.EACCES) assert os.path.isdir(path('path')) @@ -427,14 +427,14 @@ def test_remove_file_exists_dir(path): @in_env def test_remove_dir(path): os.mkdir(path('path')) - library.python.fs.remove_dir(path('path')) + library.python.fs.remove_dir(path('path')) assert not os.path.exists(path('path')) @in_env def test_remove_dir_no(path): with pytest.raises(OSError) as errinfo: - library.python.fs.remove_dir(path('path')) + library.python.fs.remove_dir(path('path')) assert errinfo.value.errno == errno.ENOENT @@ -442,7 +442,7 @@ def test_remove_dir_no(path): def test_remove_dir_exists_file(path): mkfile(path('path')) with pytest.raises(OSError) as errinfo: - library.python.fs.remove_dir(path('path')) + library.python.fs.remove_dir(path('path')) assert errinfo.value.errno in (errno.ENOTDIR, errno.EINVAL) assert os.path.isfile(path('path')) @@ -450,52 +450,52 @@ def test_remove_dir_exists_file(path): @in_env def test_remove_tree(path): mktree_example(path, 'path') - library.python.fs.remove_tree(path('path')) + library.python.fs.remove_tree(path('path')) assert not os.path.exists(path('path')) @in_env def test_remove_tree_empty(path): os.mkdir(path('path')) - library.python.fs.remove_tree(path('path')) + library.python.fs.remove_tree(path('path')) assert not os.path.exists(path('path')) @in_env def test_remove_tree_file(path): mkfile(path('path')) - library.python.fs.remove_tree(path('path')) + library.python.fs.remove_tree(path('path')) assert not os.path.exists(path('path')) @in_env def test_remove_tree_no(path): with pytest.raises(OSError) as errinfo: - library.python.fs.remove_tree(path('path')) + library.python.fs.remove_tree(path('path')) assert errinfo.value.errno == errno.ENOENT @in_env def test_remove_tree_safe(path): - library.python.fs.remove_tree_safe(path('path')) + library.python.fs.remove_tree_safe(path('path')) @in_env def test_ensure_removed(path): - library.python.fs.ensure_removed(path('path')) + library.python.fs.ensure_removed(path('path')) @in_env def test_ensure_removed_exists(path): os.makedirs(path('dir/subdir')) - library.python.fs.ensure_removed(path('dir')) + library.python.fs.ensure_removed(path('dir')) assert not os.path.exists(path('dir')) @in_env def test_ensure_removed_exists_precise(path): os.makedirs(path('dir/subdir')) - library.python.fs.ensure_removed(path('dir/subdir')) + library.python.fs.ensure_removed(path('dir/subdir')) assert os.path.exists(path('dir')) assert not os.path.exists(path('dir/subdir')) @@ -503,7 +503,7 @@ def test_ensure_removed_exists_precise(path): @in_env def test_hardlink_file(path): mkfile(path('src'), 'SRC') - library.python.fs.hardlink(path('src'), path('dst')) + library.python.fs.hardlink(path('src'), path('dst')) assert os.path.isfile(path('src')) assert os.path.isfile(path('dst')) assert file_data(path('dst')) == 'SRC' @@ -513,7 +513,7 @@ def test_hardlink_file(path): @in_env def test_hardlink_file_no_src(path): with pytest.raises(OSError) as errinfo: - library.python.fs.hardlink(path('src'), path('dst')) + library.python.fs.hardlink(path('src'), path('dst')) assert errinfo.value.errno == errno.ENOENT @@ -522,7 +522,7 @@ def test_hardlink_file_exists(path): mkfile(path('src'), 'SRC') mkfile(path('dst'), 'DST') with pytest.raises(OSError) as errinfo: - library.python.fs.hardlink(path('src'), path('dst')) + library.python.fs.hardlink(path('src'), path('dst')) assert errinfo.value.errno == errno.EEXIST assert os.path.isfile(path('src')) assert os.path.isfile(path('dst')) @@ -535,7 +535,7 @@ def test_hardlink_file_exists_dir(path): mkfile(path('src'), 'SRC') os.mkdir(path('dst')) with pytest.raises(OSError) as errinfo: - library.python.fs.hardlink(path('src'), path('dst')) + library.python.fs.hardlink(path('src'), path('dst')) assert errinfo.value.errno == errno.EEXIST assert os.path.isfile(path('src')) assert os.path.isdir(path('dst')) @@ -547,7 +547,7 @@ def test_hardlink_dir(path): os.mkdir(path('src')) mkfile(path('src/src_file')) with pytest.raises(OSError) as errinfo: - library.python.fs.hardlink(path('src'), path('dst')) + library.python.fs.hardlink(path('src'), path('dst')) assert errinfo.value.errno in (errno.EPERM, errno.EACCES) assert os.path.isdir(path('src')) assert not os.path.isdir(path('dst')) @@ -557,7 +557,7 @@ def test_hardlink_dir(path): @in_env def test_symlink_file(path): mkfile(path('src'), 'SRC') - library.python.fs.symlink(path('src'), path('dst')) + library.python.fs.symlink(path('src'), path('dst')) assert os.path.isfile(path('src')) assert os.path.isfile(path('dst')) assert os.path.islink(path('dst')) @@ -567,7 +567,7 @@ def test_symlink_file(path): @pytest.mark.skipif(library.python.windows.on_win(), reason='Symlinks disabled on Windows') @in_env def test_symlink_file_no_src(path): - library.python.fs.symlink(path('src'), path('dst')) + library.python.fs.symlink(path('src'), path('dst')) assert not os.path.isfile(path('src')) assert not os.path.isfile(path('dst')) assert os.path.islink(path('dst')) @@ -579,7 +579,7 @@ def test_symlink_file_exists(path): mkfile(path('src'), 'SRC') mkfile(path('dst'), 'DST') with pytest.raises(OSError) as errinfo: - library.python.fs.symlink(path('src'), path('dst')) + library.python.fs.symlink(path('src'), path('dst')) assert errinfo.value.errno == errno.EEXIST assert os.path.isfile(path('src')) assert os.path.isfile(path('dst')) @@ -593,7 +593,7 @@ def test_symlink_file_exists_dir(path): mkfile(path('src'), 'SRC') os.mkdir(path('dst')) with pytest.raises(OSError) as errinfo: - library.python.fs.symlink(path('src'), path('dst')) + library.python.fs.symlink(path('src'), path('dst')) assert errinfo.value.errno == errno.EEXIST assert os.path.isfile(path('src')) assert os.path.isdir(path('dst')) @@ -606,7 +606,7 @@ def test_symlink_file_exists_dir(path): def test_symlink_dir(path): os.mkdir(path('src')) mkfile(path('src/src_file')) - library.python.fs.symlink(path('src'), path('dst')) + library.python.fs.symlink(path('src'), path('dst')) assert os.path.isdir(path('src')) assert os.path.isdir(path('dst')) assert os.path.islink(path('dst')) @@ -616,7 +616,7 @@ def test_symlink_dir(path): @pytest.mark.skipif(library.python.windows.on_win(), reason='Symlinks disabled on Windows') @in_env def test_symlink_dir_no_src(path): - library.python.fs.symlink(path('src'), path('dst')) + library.python.fs.symlink(path('src'), path('dst')) assert not os.path.isdir(path('src')) assert not os.path.isdir(path('dst')) assert os.path.islink(path('dst')) @@ -629,7 +629,7 @@ def test_symlink_dir_exists(path): mkfile(path('src/src_file')) os.mkdir(path('dst')) with pytest.raises(OSError) as errinfo: - library.python.fs.symlink(path('src'), path('dst')) + library.python.fs.symlink(path('src'), path('dst')) assert errinfo.value.errno == errno.EEXIST assert os.path.isdir(path('src')) assert os.path.isdir(path('dst')) @@ -644,7 +644,7 @@ def test_symlink_dir_exists_file(path): mkfile(path('src/src_file')) mkfile(path('dst'), 'DST') with pytest.raises(OSError) as errinfo: - library.python.fs.symlink(path('src'), path('dst')) + library.python.fs.symlink(path('src'), path('dst')) assert errinfo.value.errno == errno.EEXIST assert os.path.isdir(path('src')) assert os.path.isfile(path('dst')) @@ -654,28 +654,28 @@ def test_symlink_dir_exists_file(path): @in_env def test_hardlink_tree(path): mktree_example(path, 'src') - library.python.fs.hardlink_tree(path('src'), path('dst')) + library.python.fs.hardlink_tree(path('src'), path('dst')) assert trees_equal(path('src'), path('dst')) @in_env def test_hardlink_tree_empty(path): os.mkdir(path('src')) - library.python.fs.hardlink_tree(path('src'), path('dst')) + library.python.fs.hardlink_tree(path('src'), path('dst')) assert trees_equal(path('src'), path('dst')) @in_env def test_hardlink_tree_file(path): mkfile(path('src'), 'SRC') - library.python.fs.hardlink_tree(path('src'), path('dst')) + library.python.fs.hardlink_tree(path('src'), path('dst')) assert trees_equal(path('src'), path('dst')) @in_env def test_hardlink_tree_no_src(path): with pytest.raises(OSError) as errinfo: - library.python.fs.hardlink_tree(path('src'), path('dst')) + library.python.fs.hardlink_tree(path('src'), path('dst')) assert errinfo.value.errno == errno.ENOENT @@ -684,11 +684,11 @@ def test_hardlink_tree_exists(path): mktree_example(path, 'src') os.mkdir(path('dst_dir')) with pytest.raises(OSError) as errinfo: - library.python.fs.hardlink_tree(path('src'), path('dst_dir')) + library.python.fs.hardlink_tree(path('src'), path('dst_dir')) assert errinfo.value.errno == errno.EEXIST mkfile(path('dst_file'), 'DST') with pytest.raises(OSError) as errinfo: - library.python.fs.hardlink_tree(path('src'), path('dst_file')) + library.python.fs.hardlink_tree(path('src'), path('dst_file')) assert errinfo.value.errno == errno.EEXIST @@ -697,18 +697,18 @@ def test_hardlink_tree_file_exists(path): mkfile(path('src'), 'SRC') os.mkdir(path('dst_dir')) with pytest.raises(OSError) as errinfo: - library.python.fs.hardlink_tree(path('src'), path('dst_dir')) + library.python.fs.hardlink_tree(path('src'), path('dst_dir')) assert errinfo.value.errno == errno.EEXIST mkfile(path('dst_file'), 'DST') with pytest.raises(OSError) as errinfo: - library.python.fs.hardlink_tree(path('src'), path('dst_file')) + library.python.fs.hardlink_tree(path('src'), path('dst_file')) assert errinfo.value.errno == errno.EEXIST @in_env def test_copy_file(path): mkfile(path('src'), 'SRC') - library.python.fs.copy_file(path('src'), path('dst')) + library.python.fs.copy_file(path('src'), path('dst')) assert os.path.isfile(path('src')) assert os.path.isfile(path('dst')) assert file_data(path('dst')) == 'SRC' @@ -717,14 +717,14 @@ def test_copy_file(path): @in_env def test_copy_file_no_src(path): with pytest.raises(EnvironmentError): - library.python.fs.copy_file(path('src'), path('dst')) + library.python.fs.copy_file(path('src'), path('dst')) @in_env def test_copy_file_exists(path): mkfile(path('src'), 'SRC') mkfile(path('dst'), 'DST') - library.python.fs.copy_file(path('src'), path('dst')) + library.python.fs.copy_file(path('src'), path('dst')) assert os.path.isfile(path('src')) assert os.path.isfile(path('dst')) assert file_data(path('dst')) == 'SRC' @@ -735,7 +735,7 @@ def test_copy_file_exists_dir_empty(path): mkfile(path('src'), 'SRC') os.mkdir(path('dst')) with pytest.raises(EnvironmentError): - library.python.fs.copy_file(path('src'), path('dst')) + library.python.fs.copy_file(path('src'), path('dst')) assert os.path.isfile(path('src')) assert os.path.isdir(path('dst')) assert not os.path.isfile(path('dst/src')) @@ -747,7 +747,7 @@ def test_copy_file_exists_dir_nonempty(path): os.mkdir(path('dst')) mkfile(path('dst/dst_file')) with pytest.raises(EnvironmentError): - library.python.fs.copy_file(path('src'), path('dst')) + library.python.fs.copy_file(path('src'), path('dst')) assert os.path.isfile(path('src')) assert os.path.isdir(path('dst')) assert os.path.isfile(path('dst/dst_file')) @@ -757,28 +757,28 @@ def test_copy_file_exists_dir_nonempty(path): @in_env def test_copy_tree(path): mktree_example(path, 'src') - library.python.fs.copy_tree(path('src'), path('dst')) + library.python.fs.copy_tree(path('src'), path('dst')) assert trees_equal(path('src'), path('dst')) @in_env def test_copy_tree_empty(path): os.mkdir(path('src')) - library.python.fs.copy_tree(path('src'), path('dst')) + library.python.fs.copy_tree(path('src'), path('dst')) assert trees_equal(path('src'), path('dst')) @in_env def test_copy_tree_file(path): mkfile(path('src'), 'SRC') - library.python.fs.copy_tree(path('src'), path('dst')) + library.python.fs.copy_tree(path('src'), path('dst')) assert trees_equal(path('src'), path('dst')) @in_env def test_copy_tree_no_src(path): with pytest.raises(EnvironmentError): - library.python.fs.copy_tree(path('src'), path('dst')) + library.python.fs.copy_tree(path('src'), path('dst')) @in_env @@ -786,10 +786,10 @@ def test_copy_tree_exists(path): mktree_example(path, 'src') os.mkdir(path('dst_dir')) with pytest.raises(EnvironmentError): - library.python.fs.copy_tree(path('src'), path('dst_dir')) + library.python.fs.copy_tree(path('src'), path('dst_dir')) mkfile(path('dst_file'), 'DST') with pytest.raises(EnvironmentError): - library.python.fs.copy_tree(path('src'), path('dst_file')) + library.python.fs.copy_tree(path('src'), path('dst_file')) @in_env @@ -797,9 +797,9 @@ def test_copy_tree_file_exists(path): mkfile(path('src'), 'SRC') os.mkdir(path('dst_dir')) with pytest.raises(EnvironmentError): - library.python.fs.copy_tree(path('src'), path('dst_dir')) + library.python.fs.copy_tree(path('src'), path('dst_dir')) mkfile(path('dst_file'), 'DST') - library.python.fs.copy_tree(path('src'), path('dst_file')) + library.python.fs.copy_tree(path('src'), path('dst_file')) assert trees_equal(path('src'), path('dst_file')) @@ -807,14 +807,14 @@ def test_copy_tree_file_exists(path): def test_read_file(path): mkfile(path('src'), 'SRC') assert library.python.fs.read_file(path('src')).decode(library.python.strings.fs_encoding()) == 'SRC' - assert library.python.fs.read_file(path('src'), binary=False) == 'SRC' + assert library.python.fs.read_file(path('src'), binary=False) == 'SRC' @in_env def test_read_file_empty(path): mkfile(path('src')) assert library.python.fs.read_file(path('src')).decode(library.python.strings.fs_encoding()) == '' - assert library.python.fs.read_file(path('src'), binary=False) == '' + assert library.python.fs.read_file(path('src'), binary=False) == '' @in_env @@ -824,7 +824,7 @@ def test_read_file_multiline(path): library.python.fs.read_file(path('src')).decode(library.python.strings.fs_encoding()) == 'SRC line 1\nSRC line 2\n' ) - assert library.python.fs.read_file(path('src'), binary=False) == 'SRC line 1\nSRC line 2\n' + assert library.python.fs.read_file(path('src'), binary=False) == 'SRC line 1\nSRC line 2\n' @in_env @@ -835,9 +835,9 @@ def test_read_file_multiline_crlf(path): == 'SRC line 1\r\nSRC line 2\r\n' ) if library.python.windows.on_win() or six.PY3: # universal newlines are by default in text mode in python3 - assert library.python.fs.read_file(path('src'), binary=False) == 'SRC line 1\nSRC line 2\n' + assert library.python.fs.read_file(path('src'), binary=False) == 'SRC line 1\nSRC line 2\n' else: - assert library.python.fs.read_file(path('src'), binary=False) == 'SRC line 1\r\nSRC line 2\r\n' + assert library.python.fs.read_file(path('src'), binary=False) == 'SRC line 1\r\nSRC line 2\r\n' @in_env @@ -845,20 +845,20 @@ def test_read_file_unicode(path): s = u'АБВ' mkfile(path('src'), s.encode('utf-8')) mkfile(path('src_cp1251'), s.encode('cp1251')) - assert library.python.fs.read_file_unicode(path('src')) == s - assert library.python.fs.read_file_unicode(path('src_cp1251'), enc='cp1251') == s - assert library.python.fs.read_file_unicode(path('src'), binary=False) == s - assert library.python.fs.read_file_unicode(path('src_cp1251'), binary=False, enc='cp1251') == s + assert library.python.fs.read_file_unicode(path('src')) == s + assert library.python.fs.read_file_unicode(path('src_cp1251'), enc='cp1251') == s + assert library.python.fs.read_file_unicode(path('src'), binary=False) == s + assert library.python.fs.read_file_unicode(path('src_cp1251'), binary=False, enc='cp1251') == s @in_env def test_read_file_unicode_empty(path): mkfile(path('src')) mkfile(path('src_cp1251')) - assert library.python.fs.read_file_unicode(path('src')) == '' - assert library.python.fs.read_file_unicode(path('src_cp1251'), enc='cp1251') == '' - assert library.python.fs.read_file_unicode(path('src'), binary=False) == '' - assert library.python.fs.read_file_unicode(path('src_cp1251'), binary=False, enc='cp1251') == '' + assert library.python.fs.read_file_unicode(path('src')) == '' + assert library.python.fs.read_file_unicode(path('src_cp1251'), enc='cp1251') == '' + assert library.python.fs.read_file_unicode(path('src'), binary=False) == '' + assert library.python.fs.read_file_unicode(path('src_cp1251'), binary=False, enc='cp1251') == '' @in_env @@ -866,10 +866,10 @@ def test_read_file_unicode_multiline(path): s = u'АБВ\nИ еще\n' mkfile(path('src'), s.encode('utf-8')) mkfile(path('src_cp1251'), s.encode('cp1251')) - assert library.python.fs.read_file_unicode(path('src')) == s - assert library.python.fs.read_file_unicode(path('src_cp1251'), enc='cp1251') == s - assert library.python.fs.read_file_unicode(path('src'), binary=False) == s - assert library.python.fs.read_file_unicode(path('src_cp1251'), binary=False, enc='cp1251') == s + assert library.python.fs.read_file_unicode(path('src')) == s + assert library.python.fs.read_file_unicode(path('src_cp1251'), enc='cp1251') == s + assert library.python.fs.read_file_unicode(path('src'), binary=False) == s + assert library.python.fs.read_file_unicode(path('src_cp1251'), binary=False, enc='cp1251') == s @in_env @@ -877,37 +877,37 @@ def test_read_file_unicode_multiline_crlf(path): s = u'АБВ\r\nИ еще\r\n' mkfile(path('src'), s.encode('utf-8')) mkfile(path('src_cp1251'), s.encode('cp1251')) - assert library.python.fs.read_file_unicode(path('src')) == s - assert library.python.fs.read_file_unicode(path('src_cp1251'), enc='cp1251') == s + assert library.python.fs.read_file_unicode(path('src')) == s + assert library.python.fs.read_file_unicode(path('src_cp1251'), enc='cp1251') == s if library.python.windows.on_win() or six.PY3: # universal newlines are by default in text mode in python3 - assert library.python.fs.read_file_unicode(path('src'), binary=False) == u'АБВ\nИ еще\n' - assert library.python.fs.read_file_unicode(path('src_cp1251'), binary=False, enc='cp1251') == u'АБВ\nИ еще\n' + assert library.python.fs.read_file_unicode(path('src'), binary=False) == u'АБВ\nИ еще\n' + assert library.python.fs.read_file_unicode(path('src_cp1251'), binary=False, enc='cp1251') == u'АБВ\nИ еще\n' else: - assert library.python.fs.read_file_unicode(path('src'), binary=False) == s - assert library.python.fs.read_file_unicode(path('src_cp1251'), binary=False, enc='cp1251') == s + assert library.python.fs.read_file_unicode(path('src'), binary=False) == s + assert library.python.fs.read_file_unicode(path('src_cp1251'), binary=False, enc='cp1251') == s @in_env def test_write_file(path): - library.python.fs.write_file(path('src'), 'SRC') + library.python.fs.write_file(path('src'), 'SRC') assert file_data(path('src')) == 'SRC' - library.python.fs.write_file(path('src2'), 'SRC', binary=False) + library.python.fs.write_file(path('src2'), 'SRC', binary=False) assert file_data(path('src2')) == 'SRC' @in_env def test_write_file_empty(path): - library.python.fs.write_file(path('src'), '') + library.python.fs.write_file(path('src'), '') assert file_data(path('src')) == '' - library.python.fs.write_file(path('src2'), '', binary=False) + library.python.fs.write_file(path('src2'), '', binary=False) assert file_data(path('src2')) == '' @in_env def test_write_file_multiline(path): - library.python.fs.write_file(path('src'), 'SRC line 1\nSRC line 2\n') + library.python.fs.write_file(path('src'), 'SRC line 1\nSRC line 2\n') assert file_data(path('src')) == 'SRC line 1\nSRC line 2\n' - library.python.fs.write_file(path('src2'), 'SRC line 1\nSRC line 2\n', binary=False) + library.python.fs.write_file(path('src2'), 'SRC line 1\nSRC line 2\n', binary=False) if library.python.windows.on_win(): assert file_data(path('src2')) == 'SRC line 1\r\nSRC line 2\r\n' else: @@ -916,9 +916,9 @@ def test_write_file_multiline(path): @in_env def test_write_file_multiline_crlf(path): - library.python.fs.write_file(path('src'), 'SRC line 1\r\nSRC line 2\r\n') + library.python.fs.write_file(path('src'), 'SRC line 1\r\nSRC line 2\r\n') assert file_data(path('src')) == 'SRC line 1\r\nSRC line 2\r\n' - library.python.fs.write_file(path('src2'), 'SRC line 1\r\nSRC line 2\r\n', binary=False) + library.python.fs.write_file(path('src2'), 'SRC line 1\r\nSRC line 2\r\n', binary=False) if library.python.windows.on_win(): assert file_data(path('src2')) == 'SRC line 1\r\r\nSRC line 2\r\r\n' else: @@ -928,13 +928,13 @@ def test_write_file_multiline_crlf(path): @in_env def test_get_file_size(path): mkfile(path('one.txt'), '22') - assert library.python.fs.get_file_size(path('one.txt')) == 2 - - + assert library.python.fs.get_file_size(path('one.txt')) == 2 + + @in_env def test_get_file_size_empty(path): mkfile(path('one.txt')) - assert library.python.fs.get_file_size(path('one.txt')) == 0 + assert library.python.fs.get_file_size(path('one.txt')) == 0 @in_env @@ -942,9 +942,9 @@ def test_get_tree_size(path): os.makedirs(path('deeper')) mkfile(path('one.txt'), '1') mkfile(path('deeper/two.txt'), '22') - assert library.python.fs.get_tree_size(path('one.txt')) == 1 - assert library.python.fs.get_tree_size(path('')) == 1 - assert library.python.fs.get_tree_size(path(''), recursive=True) == 3 + assert library.python.fs.get_tree_size(path('one.txt')) == 1 + assert library.python.fs.get_tree_size(path('')) == 1 + assert library.python.fs.get_tree_size(path(''), recursive=True) == 3 @pytest.mark.skipif(library.python.windows.on_win(), reason='Symlinks disabled on Windows') @@ -956,61 +956,61 @@ def test_get_tree_size_dangling_symlink(path): os.symlink(path('deeper/two.txt'), path("deeper/link.txt")) os.remove(path('deeper/two.txt')) # does not fail - assert library.python.fs.get_tree_size(path(''), recursive=True) == 1 - - + assert library.python.fs.get_tree_size(path(''), recursive=True) == 1 + + @pytest.mark.skipif(not library.python.windows.on_win(), reason='Test hardlinks on windows') -def test_hardlink_or_copy(): - max_allowed_hard_links = 1023 - - def run(hardlink_function, dir): - src = r"test.txt" - with open(src, "w") as f: - f.write("test") - for i in range(max_allowed_hard_links + 1): - hardlink_function(src, os.path.join(dir, "{}.txt".format(i))) - - dir1 = library.python.fs.create_dirs("one") - with pytest.raises(WindowsError) as e: - run(library.python.fs.hardlink, dir1) - assert e.value.winerror == 1142 - assert len(os.listdir(dir1)) == max_allowed_hard_links - - dir2 = library.python.fs.create_dirs("two") - run(library.python.fs.hardlink_or_copy, dir2) - assert len(os.listdir(dir2)) == max_allowed_hard_links + 1 - - -def test_remove_tree_unicode(): - path = u"test_remove_tree_unicode/русский".encode("utf-8") - os.makedirs(path) +def test_hardlink_or_copy(): + max_allowed_hard_links = 1023 + + def run(hardlink_function, dir): + src = r"test.txt" + with open(src, "w") as f: + f.write("test") + for i in range(max_allowed_hard_links + 1): + hardlink_function(src, os.path.join(dir, "{}.txt".format(i))) + + dir1 = library.python.fs.create_dirs("one") + with pytest.raises(WindowsError) as e: + run(library.python.fs.hardlink, dir1) + assert e.value.winerror == 1142 + assert len(os.listdir(dir1)) == max_allowed_hard_links + + dir2 = library.python.fs.create_dirs("two") + run(library.python.fs.hardlink_or_copy, dir2) + assert len(os.listdir(dir2)) == max_allowed_hard_links + 1 + + +def test_remove_tree_unicode(): + path = u"test_remove_tree_unicode/русский".encode("utf-8") + os.makedirs(path) library.python.fs.remove_tree(six.text_type("test_remove_tree_unicode")) - assert not os.path.exists("test_remove_tree_unicode") - - -def test_remove_tree_safe_unicode(): - path = u"test_remove_tree_safe_unicode/русский".encode("utf-8") - os.makedirs(path) + assert not os.path.exists("test_remove_tree_unicode") + + +def test_remove_tree_safe_unicode(): + path = u"test_remove_tree_safe_unicode/русский".encode("utf-8") + os.makedirs(path) library.python.fs.remove_tree_safe(six.text_type("test_remove_tree_safe_unicode")) - assert not os.path.exists("test_remove_tree_safe_unicode") - - -def test_copy_tree_custom_copy_function(): - library.python.fs.create_dirs("test_copy_tree_src/deepper/inner") - library.python.fs.write_file("test_copy_tree_src/deepper/deepper.txt", "deepper.txt") - library.python.fs.write_file("test_copy_tree_src/deepper/inner/inner.txt", "inner.txt") - copied = [] - - def copy_function(src, dst): - shutil.copy2(src, dst) - copied.append(dst) - + assert not os.path.exists("test_remove_tree_safe_unicode") + + +def test_copy_tree_custom_copy_function(): + library.python.fs.create_dirs("test_copy_tree_src/deepper/inner") + library.python.fs.write_file("test_copy_tree_src/deepper/deepper.txt", "deepper.txt") + library.python.fs.write_file("test_copy_tree_src/deepper/inner/inner.txt", "inner.txt") + copied = [] + + def copy_function(src, dst): + shutil.copy2(src, dst) + copied.append(dst) + library.python.fs.copy_tree( "test_copy_tree_src", yatest.common.work_path("test_copy_tree_dst"), copy_function=copy_function ) - assert len(copied) == 2 - assert yatest.common.work_path("test_copy_tree_dst/deepper/deepper.txt") in copied - assert yatest.common.work_path("test_copy_tree_dst/deepper/inner/inner.txt") in copied + assert len(copied) == 2 + assert yatest.common.work_path("test_copy_tree_dst/deepper/deepper.txt") in copied + assert yatest.common.work_path("test_copy_tree_dst/deepper/inner/inner.txt") in copied def test_copy2(): diff --git a/library/python/fs/test/ya.make b/library/python/fs/test/ya.make index 33e3f5b4ff..c58182bfba 100644 --- a/library/python/fs/test/ya.make +++ b/library/python/fs/test/ya.make @@ -1,14 +1,14 @@ -OWNER(g:yatool) - +OWNER(g:yatool) + PY23_TEST() - -TEST_SRCS( - test_fs.py -) - -PEERDIR( - library/python/fs - library/python/tmp -) - -END() + +TEST_SRCS( + test_fs.py +) + +PEERDIR( + library/python/fs + library/python/tmp +) + +END() diff --git a/library/python/fs/ya.make b/library/python/fs/ya.make index b3c5092c71..2597e4fb8e 100644 --- a/library/python/fs/ya.make +++ b/library/python/fs/ya.make @@ -1,23 +1,23 @@ -OWNER(g:yatool) - -PY23_LIBRARY() - +OWNER(g:yatool) + +PY23_LIBRARY() + PY_SRCS( __init__.py ) - + IF (OS_DARWIN) PY_SRCS( clonefile.pyx ) ENDIF() -PEERDIR( - library/python/func - library/python/strings - library/python/windows -) - -END() - -RECURSE_FOR_TESTS(test) +PEERDIR( + library/python/func + library/python/strings + library/python/windows +) + +END() + +RECURSE_FOR_TESTS(test) |