flyshell 1.4.9__tar.gz → 1.4.10__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. {flyshell-1.4.9/src/flyshell.egg-info → flyshell-1.4.10}/PKG-INFO +9 -4
  2. {flyshell-1.4.9 → flyshell-1.4.10}/README.md +8 -3
  3. {flyshell-1.4.9 → flyshell-1.4.10}/c_src/diskops/diskops.c +15 -0
  4. flyshell-1.4.10/c_src/diskops/posix/cp.c +247 -0
  5. flyshell-1.4.10/c_src/diskops/win32/cp.c +298 -0
  6. {flyshell-1.4.9 → flyshell-1.4.10}/pyproject.toml +0 -3
  7. flyshell-1.4.10/setup.py +47 -0
  8. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/constants.py +2 -2
  9. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/core/directory.py +2 -2
  10. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/native/diskops_handler.py +54 -0
  11. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/native/legacy/diskops.py +25 -0
  12. {flyshell-1.4.9 → flyshell-1.4.10/src/flyshell.egg-info}/PKG-INFO +9 -4
  13. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell.egg-info/SOURCES.txt +2 -0
  14. {flyshell-1.4.9 → flyshell-1.4.10}/tests/test_diskops_ext.py +40 -0
  15. {flyshell-1.4.9 → flyshell-1.4.10}/tests/test_diskops_lgc.py +19 -0
  16. {flyshell-1.4.9 → flyshell-1.4.10}/tests/test_diskops_old.py +4 -0
  17. flyshell-1.4.9/setup.py +0 -36
  18. {flyshell-1.4.9 → flyshell-1.4.10}/LICENSE +0 -0
  19. {flyshell-1.4.9 → flyshell-1.4.10}/MANIFEST.in +0 -0
  20. {flyshell-1.4.9 → flyshell-1.4.10}/c_src/diskops/posix/cat.c +0 -0
  21. {flyshell-1.4.9 → flyshell-1.4.10}/c_src/diskops/posix/dir.c +0 -0
  22. {flyshell-1.4.9 → flyshell-1.4.10}/c_src/diskops/posix/mkdir.c +0 -0
  23. {flyshell-1.4.9 → flyshell-1.4.10}/c_src/diskops/posix/rename.c +0 -0
  24. {flyshell-1.4.9 → flyshell-1.4.10}/c_src/diskops/posix/rm.c +0 -0
  25. {flyshell-1.4.9 → flyshell-1.4.10}/c_src/diskops/posix/rmdir.c +0 -0
  26. {flyshell-1.4.9 → flyshell-1.4.10}/c_src/diskops/posix/touch.c +0 -0
  27. {flyshell-1.4.9 → flyshell-1.4.10}/c_src/diskops/shared/dir_types.c +0 -0
  28. {flyshell-1.4.9 → flyshell-1.4.10}/c_src/diskops/shared/dir_types.h +0 -0
  29. {flyshell-1.4.9 → flyshell-1.4.10}/c_src/diskops/shared/native_errors.h +0 -0
  30. {flyshell-1.4.9 → flyshell-1.4.10}/c_src/diskops/shared/win32_utf.h +0 -0
  31. {flyshell-1.4.9 → flyshell-1.4.10}/c_src/diskops/win32/cat.c +0 -0
  32. {flyshell-1.4.9 → flyshell-1.4.10}/c_src/diskops/win32/dir.c +0 -0
  33. {flyshell-1.4.9 → flyshell-1.4.10}/c_src/diskops/win32/mkdir.c +0 -0
  34. {flyshell-1.4.9 → flyshell-1.4.10}/c_src/diskops/win32/rename.c +0 -0
  35. {flyshell-1.4.9 → flyshell-1.4.10}/c_src/diskops/win32/rm.c +0 -0
  36. {flyshell-1.4.9 → flyshell-1.4.10}/c_src/diskops/win32/rmdir.c +0 -0
  37. {flyshell-1.4.9 → flyshell-1.4.10}/c_src/diskops/win32/touch.c +0 -0
  38. {flyshell-1.4.9 → flyshell-1.4.10}/setup.cfg +0 -0
  39. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/__init__.py +0 -0
  40. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/abstract/__init__.py +0 -0
  41. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/abstract/base_cmd.py +0 -0
  42. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/abstract/base_plugin.py +0 -0
  43. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/abstract/parent_cmd.py +0 -0
  44. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/accounts/__init__.py +0 -0
  45. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/accounts/auth.py +0 -0
  46. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/bin/__init__.py +0 -0
  47. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/builtin/__init__.py +0 -0
  48. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/builtin/diskops.py +0 -0
  49. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/builtin/fs.py +0 -0
  50. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/builtin/pkg.py +0 -0
  51. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/builtin/system.py +0 -0
  52. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/builtin/utils.py +0 -0
  53. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/core/__init__.py +0 -0
  54. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/core/console.py +0 -0
  55. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/core/data.py +0 -0
  56. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/main.py +0 -0
  57. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/native/__init__.py +0 -0
  58. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/native/diskops_bridge.py +0 -0
  59. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/native/legacy/__init__.py +0 -0
  60. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/startup/__init__.py +0 -0
  61. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/startup/deps.py +0 -0
  62. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/startup/env.py +0 -0
  63. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell/startup/loader.py +0 -0
  64. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell.egg-info/dependency_links.txt +0 -0
  65. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell.egg-info/entry_points.txt +0 -0
  66. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell.egg-info/requires.txt +0 -0
  67. {flyshell-1.4.9 → flyshell-1.4.10}/src/flyshell.egg-info/top_level.txt +0 -0
  68. {flyshell-1.4.9 → flyshell-1.4.10}/tests/test_auth.py +0 -0
  69. {flyshell-1.4.9 → flyshell-1.4.10}/tests/test_data.py +0 -0
  70. {flyshell-1.4.9 → flyshell-1.4.10}/tests/test_deps.py +0 -0
  71. {flyshell-1.4.9 → flyshell-1.4.10}/tests/test_directory.py +0 -0
  72. {flyshell-1.4.9 → flyshell-1.4.10}/tests/test_env.py +0 -0
  73. {flyshell-1.4.9 → flyshell-1.4.10}/tests/test_fs.py +0 -0
  74. {flyshell-1.4.9 → flyshell-1.4.10}/tests/test_loader.py +0 -0
  75. {flyshell-1.4.9 → flyshell-1.4.10}/tests/test_pkg.py +0 -0
  76. {flyshell-1.4.9 → flyshell-1.4.10}/tests/test_security.py +0 -0
  77. {flyshell-1.4.9 → flyshell-1.4.10}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyshell
3
- Version: 1.4.9
3
+ Version: 1.4.10
4
4
  Summary: A modular, zero-dependency command-line environment in Python.
5
5
  License-Expression: MIT
6
6
  Requires-Python: >=3.10
@@ -19,11 +19,11 @@ Dynamic: license-file
19
19
 
20
20
  ![Python Version](https://img.shields.io/badge/python-3.10%2B-blue.svg)
21
21
  ![Licence](https://img.shields.io/badge/license-MIT-green.svg)
22
- ![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20macOS%20%7C%20Linux-lightgrey.svg)
22
+ ![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20(macOS%20source)-lightgrey.svg)
23
23
  ![Dependencies](https://img.shields.io/badge/dependencies-zero-brightgreen.svg)
24
- ![Tests](https://github.com/kianodev/flyshell/actions/workflows/build.yml/badge.svg)
24
+ ![Tests](https://github.com/kianodev/flyshell/actions/workflows/publish.yml/badge.svg)
25
25
 
26
- > Documentation last updated: v1.4.5
26
+ > Documentation last updated: v1.4.10
27
27
 
28
28
  A modular, zero-dependency command-line environment and extensible runtime interface built in Python with compiled C-extensions.
29
29
 
@@ -97,6 +97,11 @@ There are two methods to install Flyshell.
97
97
 
98
98
  ### Method 1: Install via `pip` (Best for General Use)
99
99
 
100
+ If you are using macOS, install Xcode Command Line Tools first:
101
+ ```bash
102
+ xcode-select --install
103
+ ```
104
+
100
105
  Install Flyshell through `pip`:
101
106
  ```bash
102
107
  pip install flyshell
@@ -2,11 +2,11 @@
2
2
 
3
3
  ![Python Version](https://img.shields.io/badge/python-3.10%2B-blue.svg)
4
4
  ![Licence](https://img.shields.io/badge/license-MIT-green.svg)
5
- ![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20macOS%20%7C%20Linux-lightgrey.svg)
5
+ ![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20(macOS%20source)-lightgrey.svg)
6
6
  ![Dependencies](https://img.shields.io/badge/dependencies-zero-brightgreen.svg)
7
- ![Tests](https://github.com/kianodev/flyshell/actions/workflows/build.yml/badge.svg)
7
+ ![Tests](https://github.com/kianodev/flyshell/actions/workflows/publish.yml/badge.svg)
8
8
 
9
- > Documentation last updated: v1.4.5
9
+ > Documentation last updated: v1.4.10
10
10
 
11
11
  A modular, zero-dependency command-line environment and extensible runtime interface built in Python with compiled C-extensions.
12
12
 
@@ -80,6 +80,11 @@ There are two methods to install Flyshell.
80
80
 
81
81
  ### Method 1: Install via `pip` (Best for General Use)
82
82
 
83
+ If you are using macOS, install Xcode Command Line Tools first:
84
+ ```bash
85
+ xcode-select --install
86
+ ```
87
+
83
88
  Install Flyshell through `pip`:
84
89
  ```bash
85
90
  pip install flyshell
@@ -19,6 +19,8 @@ Result remove_dir(const char *path, bool force);
19
19
 
20
20
  Result remove_item(const char *path, bool recursive);
21
21
 
22
+ Result copy_item(const char *src, const char *dst, bool force);
23
+
22
24
  static PyObject *method_ping(PyObject *self, PyObject *args) {
23
25
  return PyLong_FromLong(42);
24
26
  }
@@ -138,6 +140,18 @@ static PyObject *method_rm(PyObject *self, PyObject *args) {
138
140
  return Py_BuildValue("(is)", (int)res, "");
139
141
  }
140
142
 
143
+ static PyObject *method_cp(PyObject *self, PyObject *args) {
144
+ const char *src;
145
+ const char *dst;
146
+ int force = 0;
147
+ if (!PyArg_ParseTuple(args, "ss|p", &src, &dst, &force)) {
148
+ return NULL;
149
+ }
150
+
151
+ Result res = copy_item(src, dst, force != 0);
152
+ return Py_BuildValue("(is)", (int)res, "");
153
+ }
154
+
141
155
  static PyMethodDef DiskopsMethods[] = {
142
156
  {"ping", method_ping, METH_NOARGS, "Health check ping."},
143
157
  {"cat", method_cat, METH_VARARGS, "Read file content natively."},
@@ -147,6 +161,7 @@ static PyMethodDef DiskopsMethods[] = {
147
161
  {"rename", method_rename, METH_VARARGS, "Rename file or directory natively."},
148
162
  {"rmdir", method_rmdir, METH_VARARGS, "Remove directory natively."},
149
163
  {"rm", method_rm, METH_VARARGS, "Remove file or directory natively."},
164
+ {"cp", method_cp, METH_VARARGS, "Copy a file or directory natively."},
150
165
  {NULL, NULL, 0, NULL},
151
166
  };
152
167
 
@@ -0,0 +1,247 @@
1
+ // c_src/diskops/posix/cp.c
2
+
3
+ #define _POSIX_C_SOURCE 200809L
4
+ #define _GNU_SOURCE
5
+
6
+ #include "../shared/native_errors.h"
7
+ #include <dirent.h>
8
+ #include <errno.h>
9
+ #include <fcntl.h>
10
+ #include <stdbool.h>
11
+ #include <stdio.h>
12
+ #include <stdlib.h>
13
+ #include <string.h>
14
+ #include <sys/stat.h>
15
+ #include <unistd.h>
16
+
17
+ #define CP_CHUNK_SIZE 32768
18
+
19
+ static bool is_subpath_posix(const char *parent, const char *child) {
20
+ char *real_parent = realpath(parent, NULL);
21
+ if (!real_parent) {
22
+ return false;
23
+ }
24
+
25
+ char *child_copy = strdup(child);
26
+ if (!child_copy) {
27
+ free(real_parent);
28
+ return false;
29
+ }
30
+
31
+ char *slash = strrchr(child_copy, '/');
32
+ char *real_child_parent = NULL;
33
+ if (slash) {
34
+ if (slash == child_copy) {
35
+ real_child_parent = realpath("/", NULL);
36
+ } else {
37
+ *slash = '\0';
38
+ real_child_parent = realpath(child_copy, NULL);
39
+ }
40
+ } else {
41
+ real_child_parent = realpath(".", NULL);
42
+ }
43
+ free(child_copy);
44
+
45
+ if (!real_child_parent) {
46
+ free(real_parent);
47
+ return false;
48
+ }
49
+
50
+ size_t plen = strlen(real_parent);
51
+ bool sub = false;
52
+ if (strcmp(real_parent, "/") == 0) {
53
+ sub = true;
54
+ } else if (strncmp(real_parent, real_child_parent, plen) == 0 &&
55
+ (real_child_parent[plen] == '\0' || real_child_parent[plen] == '/')) {
56
+ sub = true;
57
+ }
58
+
59
+ free(real_parent);
60
+ free(real_child_parent);
61
+ return sub;
62
+ }
63
+
64
+ static Result copy_file_posix(const char *src, const char *dst, const struct stat *src_st,
65
+ bool force) {
66
+ struct stat dst_st;
67
+ if (lstat(dst, &dst_st) == 0) {
68
+ if (src_st->st_dev == dst_st.st_dev && src_st->st_ino == dst_st.st_ino) {
69
+ return ERR_SAME_FILE;
70
+ }
71
+ if (S_ISDIR(dst_st.st_mode)) {
72
+ return ERR_IS_DIR;
73
+ }
74
+ if (!force) {
75
+ return ERR_EXISTS;
76
+ }
77
+ }
78
+
79
+ int src_fd = open(src, O_RDONLY);
80
+ if (src_fd < 0) {
81
+ return map_posix_errno(errno);
82
+ }
83
+
84
+ int dst_fd = open(dst, O_WRONLY | O_CREAT | O_TRUNC, src_st->st_mode & 0777);
85
+ if (dst_fd < 0) {
86
+ int err = errno;
87
+ close(src_fd);
88
+ return map_posix_errno(err);
89
+ }
90
+
91
+ char *buf = (char *)malloc(CP_CHUNK_SIZE);
92
+ if (!buf) {
93
+ close(src_fd);
94
+ close(dst_fd);
95
+ return ERR_IO;
96
+ }
97
+
98
+ Result res = SUCCESS;
99
+ for (;;) {
100
+ ssize_t n_read = read(src_fd, buf, CP_CHUNK_SIZE);
101
+ if (n_read < 0) {
102
+ if (errno == EINTR) {
103
+ continue;
104
+ }
105
+ res = map_posix_errno(errno);
106
+ break;
107
+ }
108
+ if (n_read == 0) {
109
+ break;
110
+ }
111
+
112
+ size_t written = 0;
113
+ while (written < (size_t)n_read) {
114
+ ssize_t n_written = write(dst_fd, buf + written, (size_t)n_read - written);
115
+ if (n_written < 0) {
116
+ if (errno == EINTR) {
117
+ continue;
118
+ }
119
+ res = map_posix_errno(errno);
120
+ break;
121
+ }
122
+ written += (size_t)n_written;
123
+ }
124
+ if (res != SUCCESS) {
125
+ break;
126
+ }
127
+ }
128
+
129
+ free(buf);
130
+
131
+ if (res == SUCCESS) {
132
+ (void)fchmod(dst_fd, src_st->st_mode & 0777);
133
+ struct timespec times[2];
134
+ #ifdef __APPLE__
135
+ times[0] = src_st->st_atimespec;
136
+ times[1] = src_st->st_mtimespec;
137
+ #else
138
+ times[0] = src_st->st_atim;
139
+ times[1] = src_st->st_mtim;
140
+ #endif
141
+ (void)futimens(dst_fd, times);
142
+ }
143
+
144
+ close(src_fd);
145
+ if (close(dst_fd) != 0 && res == SUCCESS) {
146
+ res = map_posix_errno(errno);
147
+ }
148
+ return res;
149
+ }
150
+
151
+ static Result copy_dir_recursive_posix(const char *src, const char *dst, const struct stat *src_st,
152
+ bool force) {
153
+ struct stat dst_st;
154
+ if (lstat(dst, &dst_st) == 0) {
155
+ if (src_st->st_dev == dst_st.st_dev && src_st->st_ino == dst_st.st_ino) {
156
+ return ERR_SAME_FILE;
157
+ }
158
+ if (!S_ISDIR(dst_st.st_mode)) {
159
+ return ERR_NOT_DIR;
160
+ }
161
+ if (!force) {
162
+ return ERR_EXISTS;
163
+ }
164
+ } else if (mkdir(dst, src_st->st_mode & 0777) != 0) {
165
+ return map_posix_errno(errno);
166
+ }
167
+
168
+ DIR *dir = opendir(src);
169
+ if (!dir) {
170
+ return map_posix_errno(errno);
171
+ }
172
+
173
+ size_t src_len = strlen(src);
174
+ size_t dst_len = strlen(dst);
175
+ bool src_slash = (src_len > 0 && src[src_len - 1] == '/') != 0;
176
+ bool dst_slash = (dst_len > 0 && dst[dst_len - 1] == '/') != 0;
177
+
178
+ struct dirent *entry;
179
+ while ((entry = readdir(dir)) != NULL) {
180
+ if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) {
181
+ continue;
182
+ }
183
+
184
+ size_t name_len = strlen(entry->d_name);
185
+ size_t s_child_len = src_len + (src_slash ? 0 : 1) + name_len + 1;
186
+ size_t d_child_len = dst_len + (dst_slash ? 0 : 1) + name_len + 1;
187
+
188
+ char *s_child = (char *)malloc(s_child_len);
189
+ char *d_child = (char *)malloc(d_child_len);
190
+ if (!s_child || !d_child) {
191
+ free(s_child);
192
+ free(d_child);
193
+ closedir(dir);
194
+ return ERR_IO;
195
+ }
196
+
197
+ snprintf(s_child, s_child_len, src_slash ? "%s%s" : "%s/%s", src, entry->d_name);
198
+ snprintf(d_child, d_child_len, dst_slash ? "%s%s" : "%s/%s", dst, entry->d_name);
199
+
200
+ struct stat child_st;
201
+ if (stat(s_child, &child_st) != 0) {
202
+ int err = errno;
203
+ free(s_child);
204
+ free(d_child);
205
+ closedir(dir);
206
+ return map_posix_errno(err);
207
+ }
208
+
209
+ Result res;
210
+ if (S_ISDIR(child_st.st_mode)) {
211
+ res = copy_dir_recursive_posix(s_child, d_child, &child_st, force);
212
+ } else {
213
+ res = copy_file_posix(s_child, d_child, &child_st, force);
214
+ }
215
+
216
+ free(s_child);
217
+ free(d_child);
218
+
219
+ if (res != SUCCESS) {
220
+ closedir(dir);
221
+ return res;
222
+ }
223
+ }
224
+
225
+ closedir(dir);
226
+ return SUCCESS;
227
+ }
228
+
229
+ Result copy_item(const char *src, const char *dst, bool force) {
230
+ if (!src || src[0] == '\0' || !dst || dst[0] == '\0') {
231
+ return ERR_INVALID_PATH;
232
+ }
233
+
234
+ struct stat src_st;
235
+ if (stat(src, &src_st) != 0) {
236
+ return map_posix_errno(errno);
237
+ }
238
+
239
+ if (S_ISDIR(src_st.st_mode)) {
240
+ if (is_subpath_posix(src, dst)) {
241
+ return ERR_INVALID_PATH;
242
+ }
243
+ return copy_dir_recursive_posix(src, dst, &src_st, force);
244
+ }
245
+
246
+ return copy_file_posix(src, dst, &src_st, force);
247
+ }
@@ -0,0 +1,298 @@
1
+ // c_src/diskops/win32/cp.c
2
+
3
+ #include "../shared/native_errors.h"
4
+ #include "../shared/win32_utf.h"
5
+ #include <stdbool.h>
6
+ #include <stdlib.h>
7
+ #include <string.h>
8
+ #include <windows.h>
9
+
10
+ #define CP_CHUNK_SIZE 32768
11
+
12
+ static bool is_same_file_win32(const wchar_t *wsrc, const wchar_t *wdst) {
13
+ HANDLE h1 = CreateFileW(wsrc, 0, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL,
14
+ OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
15
+ if (h1 == INVALID_HANDLE_VALUE) {
16
+ return false;
17
+ }
18
+
19
+ HANDLE h2 = CreateFileW(wdst, 0, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL,
20
+ OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
21
+ if (h2 == INVALID_HANDLE_VALUE) {
22
+ CloseHandle(h1);
23
+ return false;
24
+ }
25
+
26
+ BY_HANDLE_FILE_INFORMATION info1;
27
+ BY_HANDLE_FILE_INFORMATION info2;
28
+ bool same = false;
29
+ if (GetFileInformationByHandle(h1, &info1) != 0 &&
30
+ GetFileInformationByHandle(h2, &info2) != 0) {
31
+ same = (info1.dwVolumeSerialNumber == info2.dwVolumeSerialNumber &&
32
+ info1.nFileIndexHigh == info2.nFileIndexHigh &&
33
+ info1.nFileIndexLow == info2.nFileIndexLow) != 0;
34
+ }
35
+
36
+ CloseHandle(h1);
37
+ CloseHandle(h2);
38
+ return same;
39
+ }
40
+
41
+ static bool is_subpath_win32(const wchar_t *wsrc, const wchar_t *wdst) {
42
+ DWORD src_len = GetFullPathNameW(wsrc, 0, NULL, NULL);
43
+ DWORD dst_len = GetFullPathNameW(wdst, 0, NULL, NULL);
44
+ if (src_len == 0 || dst_len == 0) {
45
+ return false;
46
+ }
47
+
48
+ wchar_t *full_src = (wchar_t *)malloc((size_t)src_len * sizeof(wchar_t));
49
+ wchar_t *full_dst = (wchar_t *)malloc((size_t)dst_len * sizeof(wchar_t));
50
+ if (!full_src || !full_dst) {
51
+ free(full_src);
52
+ free(full_dst);
53
+ return false;
54
+ }
55
+
56
+ GetFullPathNameW(wsrc, src_len, full_src, NULL);
57
+ GetFullPathNameW(wdst, dst_len, full_dst, NULL);
58
+
59
+ size_t slen = wcslen(full_src);
60
+ while (slen > 3 && (full_src[slen - 1] == L'\\' || full_src[slen - 1] == L'/')) {
61
+ full_src[--slen] = L'\0';
62
+ }
63
+
64
+ bool sub = false;
65
+ if (_wcsnicmp(full_src, full_dst, slen) == 0 &&
66
+ (full_dst[slen] == L'\0' || full_dst[slen] == L'\\' || full_dst[slen] == L'/')) {
67
+ sub = true;
68
+ }
69
+
70
+ free(full_src);
71
+ free(full_dst);
72
+ return sub;
73
+ }
74
+
75
+ static Result copy_file_win32(const wchar_t *wsrc, const wchar_t *wdst, DWORD src_attrs,
76
+ bool force) {
77
+ DWORD dst_attrs = GetFileAttributesW(wdst);
78
+ if (dst_attrs != INVALID_FILE_ATTRIBUTES) {
79
+ if (is_same_file_win32(wsrc, wdst)) {
80
+ return ERR_SAME_FILE;
81
+ }
82
+ if ((dst_attrs & FILE_ATTRIBUTE_DIRECTORY) != 0) {
83
+ return ERR_IS_DIR;
84
+ }
85
+ if (!force) {
86
+ return ERR_EXISTS;
87
+ }
88
+ if ((dst_attrs & FILE_ATTRIBUTE_READONLY) != 0) {
89
+ SetFileAttributesW(wdst, dst_attrs & ~FILE_ATTRIBUTE_READONLY);
90
+ }
91
+ }
92
+
93
+ HANDLE h_src =
94
+ CreateFileW(wsrc, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
95
+ NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
96
+ if (h_src == INVALID_HANDLE_VALUE) {
97
+ return map_win32_error(GetLastError());
98
+ }
99
+
100
+ HANDLE h_dst = CreateFileW(wdst, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
101
+ src_attrs & ~FILE_ATTRIBUTE_DIRECTORY, NULL);
102
+ if (h_dst == INVALID_HANDLE_VALUE) {
103
+ DWORD err = GetLastError();
104
+ CloseHandle(h_src);
105
+ return map_win32_error(err);
106
+ }
107
+
108
+ char *buf = (char *)malloc(CP_CHUNK_SIZE);
109
+ if (!buf) {
110
+ CloseHandle(h_src);
111
+ CloseHandle(h_dst);
112
+ return ERR_IO;
113
+ }
114
+
115
+ Result res = SUCCESS;
116
+ for (;;) {
117
+ DWORD bytes_read = 0;
118
+ if (ReadFile(h_src, buf, CP_CHUNK_SIZE, &bytes_read, NULL) == 0) {
119
+ res = map_win32_error(GetLastError());
120
+ break;
121
+ }
122
+ if (bytes_read == 0) {
123
+ break;
124
+ }
125
+
126
+ DWORD total_written = 0;
127
+ while (total_written < bytes_read) {
128
+ DWORD bytes_written = 0;
129
+ if (WriteFile(h_dst, buf + total_written, bytes_read - total_written, &bytes_written,
130
+ NULL) == 0) {
131
+ res = map_win32_error(GetLastError());
132
+ break;
133
+ }
134
+ total_written += bytes_written;
135
+ }
136
+ if (res != SUCCESS) {
137
+ break;
138
+ }
139
+ }
140
+
141
+ free(buf);
142
+
143
+ if (res == SUCCESS) {
144
+ FILETIME ft_create;
145
+ FILETIME ft_access;
146
+ FILETIME ft_write;
147
+ if (GetFileTime(h_src, &ft_create, &ft_access, &ft_write) != 0) {
148
+ SetFileTime(h_dst, &ft_create, &ft_access, &ft_write);
149
+ }
150
+ }
151
+
152
+ CloseHandle(h_src);
153
+ CloseHandle(h_dst);
154
+ return res;
155
+ }
156
+
157
+ static Result copy_dir_recursive_win32(const wchar_t *wsrc, const wchar_t *wdst, bool force) {
158
+ DWORD dst_attrs = GetFileAttributesW(wdst);
159
+ if (dst_attrs != INVALID_FILE_ATTRIBUTES) {
160
+ if (is_same_file_win32(wsrc, wdst)) {
161
+ return ERR_SAME_FILE;
162
+ }
163
+ if ((dst_attrs & FILE_ATTRIBUTE_DIRECTORY) == 0) {
164
+ return ERR_NOT_DIR;
165
+ }
166
+ if (!force) {
167
+ return ERR_EXISTS;
168
+ }
169
+ } else if (CreateDirectoryW(wdst, NULL) == 0) {
170
+ return map_win32_error(GetLastError());
171
+ }
172
+
173
+ size_t slen = wcslen(wsrc);
174
+ size_t dlen = wcslen(wdst);
175
+ bool s_sep = (slen > 0 && (wsrc[slen - 1] == L'\\' || wsrc[slen - 1] == L'/')) != 0;
176
+ bool d_sep = (dlen > 0 && (wdst[dlen - 1] == L'\\' || wdst[dlen - 1] == L'/')) != 0;
177
+
178
+ size_t pat_len = slen + (s_sep ? 1 : 2) + 1;
179
+ wchar_t *wpattern = (wchar_t *)malloc(pat_len * sizeof(wchar_t));
180
+ if (!wpattern) {
181
+ return ERR_IO;
182
+ }
183
+
184
+ memcpy(wpattern, wsrc, slen * sizeof(wchar_t));
185
+ size_t ppos = slen;
186
+ if (!s_sep) {
187
+ wpattern[ppos++] = L'\\';
188
+ }
189
+ wpattern[ppos++] = L'*';
190
+ wpattern[ppos] = L'\0';
191
+
192
+ WIN32_FIND_DATAW find_data;
193
+ HANDLE h_find = FindFirstFileW(wpattern, &find_data);
194
+ DWORD find_err = GetLastError();
195
+ free(wpattern);
196
+
197
+ if (h_find == INVALID_HANDLE_VALUE) {
198
+ return map_win32_error(find_err);
199
+ }
200
+
201
+ do {
202
+ if (wcscmp(find_data.cFileName, L".") == 0 || wcscmp(find_data.cFileName, L"..") == 0) {
203
+ continue;
204
+ }
205
+
206
+ size_t nlen = wcslen(find_data.cFileName);
207
+ size_t sc_len = slen + (s_sep ? 0 : 1) + nlen + 1;
208
+ size_t dc_len = dlen + (d_sep ? 0 : 1) + nlen + 1;
209
+
210
+ wchar_t *ws_child = (wchar_t *)malloc(sc_len * sizeof(wchar_t));
211
+ wchar_t *wd_child = (wchar_t *)malloc(dc_len * sizeof(wchar_t));
212
+ if (!ws_child || !wd_child) {
213
+ free(ws_child);
214
+ free(wd_child);
215
+ FindClose(h_find);
216
+ return ERR_IO;
217
+ }
218
+
219
+ memcpy(ws_child, wsrc, slen * sizeof(wchar_t));
220
+ size_t spos = slen;
221
+ if (!s_sep) {
222
+ ws_child[spos++] = L'\\';
223
+ }
224
+ memcpy(ws_child + spos, find_data.cFileName, (nlen + 1) * sizeof(wchar_t));
225
+
226
+ memcpy(wd_child, wdst, dlen * sizeof(wchar_t));
227
+ size_t dpos = dlen;
228
+ if (!d_sep) {
229
+ wd_child[dpos++] = L'\\';
230
+ }
231
+ memcpy(wd_child + dpos, find_data.cFileName, (nlen + 1) * sizeof(wchar_t));
232
+
233
+ Result res;
234
+ if ((find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) {
235
+ res = copy_dir_recursive_win32(ws_child, wd_child, force);
236
+ } else {
237
+ res = copy_file_win32(ws_child, wd_child, find_data.dwFileAttributes, force);
238
+ }
239
+
240
+ free(ws_child);
241
+ free(wd_child);
242
+
243
+ if (res != SUCCESS) {
244
+ FindClose(h_find);
245
+ return res;
246
+ }
247
+ } while (FindNextFileW(h_find, &find_data) != 0);
248
+
249
+ DWORD loop_err = GetLastError();
250
+ FindClose(h_find);
251
+
252
+ if (loop_err != ERROR_NO_MORE_FILES && loop_err != ERROR_SUCCESS) {
253
+ return map_win32_error(loop_err);
254
+ }
255
+
256
+ return SUCCESS;
257
+ }
258
+
259
+ Result copy_item(const char *src, const char *dst, bool force) {
260
+ if (!src || src[0] == '\0' || !dst || dst[0] == '\0') {
261
+ return ERR_INVALID_PATH;
262
+ }
263
+
264
+ wchar_t *wsrc = utf8_to_wide(src);
265
+ if (!wsrc) {
266
+ return ERR_INVALID_PATH;
267
+ }
268
+
269
+ wchar_t *wdst = utf8_to_wide(dst);
270
+ if (!wdst) {
271
+ free(wsrc);
272
+ return ERR_INVALID_PATH;
273
+ }
274
+
275
+ DWORD src_attrs = GetFileAttributesW(wsrc);
276
+ if (src_attrs == INVALID_FILE_ATTRIBUTES) {
277
+ DWORD err = GetLastError();
278
+ free(wsrc);
279
+ free(wdst);
280
+ return map_win32_error(err);
281
+ }
282
+
283
+ Result res;
284
+ if ((src_attrs & FILE_ATTRIBUTE_DIRECTORY) != 0) {
285
+ if (is_subpath_win32(wsrc, wdst)) {
286
+ free(wsrc);
287
+ free(wdst);
288
+ return ERR_INVALID_PATH;
289
+ }
290
+ res = copy_dir_recursive_win32(wsrc, wdst, force);
291
+ } else {
292
+ res = copy_file_win32(wsrc, wdst, src_attrs, force);
293
+ }
294
+
295
+ free(wsrc);
296
+ free(wdst);
297
+ return res;
298
+ }
@@ -7,9 +7,6 @@ build = "cp310-* cp311-* cp312-* cp313-* cp314-*"
7
7
  skip = "*-win32 *i686 *musllinux*"
8
8
  test-command = "python -c \"import flyshell; assert flyshell.check_native()\""
9
9
 
10
- [tool.cibuildwheel.macos]
11
- archs = ["x86_64", "arm64"]
12
-
13
10
  [tool.cibuildwheel.linux]
14
11
  archs = ["auto", "aarch64"]
15
12
 
@@ -0,0 +1,47 @@
1
+ # setup.py
2
+
3
+ from setuptools import Extension, setup
4
+ import sys
5
+
6
+ sources = [
7
+ "c_src/diskops/diskops.c",
8
+ "c_src/diskops/shared/dir_types.c",
9
+ ]
10
+
11
+ define_macros = []
12
+
13
+ if sys.platform == "win32":
14
+ sources.extend([
15
+ "c_src/diskops/win32/cat.c",
16
+ "c_src/diskops/win32/cp.c",
17
+ "c_src/diskops/win32/dir.c",
18
+ "c_src/diskops/win32/mkdir.c",
19
+ "c_src/diskops/win32/rename.c",
20
+ "c_src/diskops/win32/rm.c",
21
+ "c_src/diskops/win32/rmdir.c",
22
+ "c_src/diskops/win32/touch.c",
23
+ ])
24
+ else:
25
+ if sys.platform == "darwin":
26
+ define_macros.append(("_DARWIN_C_SOURCE", "1"))
27
+ sources.extend([
28
+ "c_src/diskops/posix/cat.c",
29
+ "c_src/diskops/posix/cp.c",
30
+ "c_src/diskops/posix/dir.c",
31
+ "c_src/diskops/posix/mkdir.c",
32
+ "c_src/diskops/posix/rename.c",
33
+ "c_src/diskops/posix/rm.c",
34
+ "c_src/diskops/posix/rmdir.c",
35
+ "c_src/diskops/posix/touch.c",
36
+ ])
37
+
38
+ native_diskops = Extension(
39
+ name="flyshell.bin._native_diskops",
40
+ sources=sources,
41
+ include_dirs=["c_src/diskops/shared"],
42
+ define_macros=define_macros,
43
+ )
44
+
45
+ setup(
46
+ ext_modules=[native_diskops],
47
+ )
@@ -5,8 +5,8 @@ import os
5
5
  import platform
6
6
  import time
7
7
 
8
- BUILD = 163
9
- VERSION = "1.4.9"
8
+ BUILD = 164
9
+ VERSION = "1.4.10"
10
10
 
11
11
 
12
12
  def _resolve_app_dir() -> Path:
@@ -58,7 +58,7 @@ INSTALLED_COMMANDS: list[BaseCmd] = [
58
58
  system.Cd(),
59
59
  Cmds(),
60
60
  utils.Clear(),
61
- diskops_legacy.Copy(),
61
+ diskops.Copy(),
62
62
  diskops.Dir(),
63
63
  utils.Echo(),
64
64
  fs.Fs(),
@@ -71,7 +71,7 @@ INSTALLED_COMMANDS: list[BaseCmd] = [
71
71
  pkg.Pkg(),
72
72
  utils.Reboot(),
73
73
  diskops.Rename(),
74
- diskops_legacy.Rm(),
74
+ diskops.Rm(),
75
75
  diskops.RmDir(),
76
76
  utils.Sleep(),
77
77
  system.SysExe(),
@@ -124,6 +124,60 @@ class Cat(BaseCmd):
124
124
  return (0, "\n".join(output_lines))
125
125
 
126
126
 
127
+ class Copy(BaseCmd):
128
+ name = "cp"
129
+ description = "Copy files or directories to a new destination"
130
+ min_args = 2
131
+ options = "Source, then destination"
132
+ aliases = ["copy"]
133
+
134
+ def execute(self, args):
135
+ force = ("-f" in args) or ("--force" in args)
136
+ flags = {"-f", "--force"}
137
+ path_tokens = [arg for arg in args if arg not in flags]
138
+ if len(path_tokens) < 2:
139
+ return (
140
+ 1,
141
+ "\nCommand Error: 'cp' requires both a source and destination path.\n",
142
+ )
143
+ raw_src = path_tokens[0].strip("\"'")
144
+ raw_dst = path_tokens[1].strip("\"'")
145
+ src_path = Path(raw_src).expanduser().resolve()
146
+ dst_path = Path(raw_dst).expanduser().resolve()
147
+ if not src_path.exists():
148
+ return (1, f"\nSystem Error: Source '{raw_src}' not found.\n")
149
+ if dst_path.exists() and dst_path.is_dir():
150
+ final_dst = dst_path / src_path.name
151
+ else:
152
+ final_dst = dst_path
153
+ if final_dst.exists() and not force:
154
+ try:
155
+ confirm = (
156
+ input(
157
+ f"\nDestination '{final_dst.name}' already exists. Overwrite? [y/n]: "
158
+ )
159
+ .strip()
160
+ .lower()
161
+ )
162
+ except (KeyboardInterrupt, EOFError):
163
+ return (1, "\nCopy cancelled by user.\n")
164
+ if confirm != "y":
165
+ return (0, "\nOperation cancelled. No files were copied.\n")
166
+ is_dir = src_path.is_dir()
167
+ if bridge.has_native_support() and hasattr(bridge._native, "cp"):
168
+ code, _ = bridge._native.cp(str(src_path), str(final_dst), force)
169
+ else:
170
+ code, _ = legacy.lgc_cp(src_path, final_dst, force)
171
+ if code != 0:
172
+ return bridge.translate_error(code, raw_src)
173
+ if is_dir:
174
+ return (
175
+ 0,
176
+ f"\nSUCCESS! Copied directory '{src_path.name}' -> '{final_dst}'\n",
177
+ )
178
+ return (0, f"\nSUCCESS! Copied file '{src_path.name}' -> '{final_dst}'\n")
179
+
180
+
127
181
  class Dir(BaseCmd):
128
182
  name = "dir"
129
183
  description = "List all files in the current working directory"
@@ -24,6 +24,31 @@ def lgc_cat(target_path: Path) -> tuple[int, str]:
24
24
  return (-13, "") # ERR_IO
25
25
 
26
26
 
27
+ def lgc_cp(src_path: Path, dst_path: Path, force: bool = False) -> tuple[int, str]:
28
+ if not src_path.exists():
29
+ return (-1, "") # ERR_NOT_FOUND
30
+ if src_path == dst_path:
31
+ return (-7, "") # ERR_SAME_FILE
32
+ if dst_path.exists() and not force:
33
+ return (-5, "") # ERR_EXISTS
34
+ try:
35
+ if src_path.is_dir():
36
+ shutil.copytree(src_path, dst_path, dirs_exist_ok=force)
37
+ else:
38
+ shutil.copy2(src_path, dst_path)
39
+ return (0, "") # SUCCESS
40
+ except shutil.SameFileError:
41
+ return (-7, "") # ERR_SAME_FILE
42
+ except PermissionError:
43
+ return (-2, "") # ERR_PERMISSION
44
+ except OSError as e:
45
+ if getattr(e, "errno", None) == 28:
46
+ return (-12, "") # ERR_NO_SPACE
47
+ return (-13, "") # ERR_IO
48
+ except Exception:
49
+ return (-99, "") # ERR_UNKNOWN
50
+
51
+
27
52
  def lgc_dir(target_path: Path) -> tuple[int, list[tuple[str, bool]]]:
28
53
  if not target_path.exists():
29
54
  return (-1, []) # ERR_NOT_FOUND
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyshell
3
- Version: 1.4.9
3
+ Version: 1.4.10
4
4
  Summary: A modular, zero-dependency command-line environment in Python.
5
5
  License-Expression: MIT
6
6
  Requires-Python: >=3.10
@@ -19,11 +19,11 @@ Dynamic: license-file
19
19
 
20
20
  ![Python Version](https://img.shields.io/badge/python-3.10%2B-blue.svg)
21
21
  ![Licence](https://img.shields.io/badge/license-MIT-green.svg)
22
- ![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20macOS%20%7C%20Linux-lightgrey.svg)
22
+ ![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20(macOS%20source)-lightgrey.svg)
23
23
  ![Dependencies](https://img.shields.io/badge/dependencies-zero-brightgreen.svg)
24
- ![Tests](https://github.com/kianodev/flyshell/actions/workflows/build.yml/badge.svg)
24
+ ![Tests](https://github.com/kianodev/flyshell/actions/workflows/publish.yml/badge.svg)
25
25
 
26
- > Documentation last updated: v1.4.5
26
+ > Documentation last updated: v1.4.10
27
27
 
28
28
  A modular, zero-dependency command-line environment and extensible runtime interface built in Python with compiled C-extensions.
29
29
 
@@ -97,6 +97,11 @@ There are two methods to install Flyshell.
97
97
 
98
98
  ### Method 1: Install via `pip` (Best for General Use)
99
99
 
100
+ If you are using macOS, install Xcode Command Line Tools first:
101
+ ```bash
102
+ xcode-select --install
103
+ ```
104
+
100
105
  Install Flyshell through `pip`:
101
106
  ```bash
102
107
  pip install flyshell
@@ -5,6 +5,7 @@ pyproject.toml
5
5
  setup.py
6
6
  c_src/diskops/diskops.c
7
7
  c_src/diskops/posix/cat.c
8
+ c_src/diskops/posix/cp.c
8
9
  c_src/diskops/posix/dir.c
9
10
  c_src/diskops/posix/mkdir.c
10
11
  c_src/diskops/posix/rename.c
@@ -16,6 +17,7 @@ c_src/diskops/shared/dir_types.h
16
17
  c_src/diskops/shared/native_errors.h
17
18
  c_src/diskops/shared/win32_utf.h
18
19
  c_src/diskops/win32/cat.c
20
+ c_src/diskops/win32/cp.c
19
21
  c_src/diskops/win32/dir.c
20
22
  c_src/diskops/win32/mkdir.c
21
23
  c_src/diskops/win32/rename.c
@@ -11,6 +11,46 @@ def test_native_extension_loaded():
11
11
  assert bridge._native.ping() == 42
12
12
 
13
13
 
14
+ def test_native_cp_file_and_directory(tmp_path):
15
+ cmd = handler.Copy()
16
+ src_file = tmp_path / "src.txt"
17
+ src_file.write_text("hello copy", encoding="utf-8")
18
+ dst_file = tmp_path / "dst.txt"
19
+ exit_code, msg = cmd.execute([str(src_file), str(dst_file)])
20
+ assert exit_code == 0
21
+ assert "Copied file" in msg
22
+ assert dst_file.read_text(encoding="utf-8") == "hello copy"
23
+ src_file.write_text("updated payload", encoding="utf-8")
24
+ exit_code, msg = cmd.execute(["-f", str(src_file), str(dst_file)])
25
+ assert exit_code == 0
26
+ assert dst_file.read_text(encoding="utf-8") == "updated payload"
27
+ src_dir = tmp_path / "tree_src"
28
+ (src_dir / "nested").mkdir(parents=True)
29
+ (src_dir / "nested" / "leaf.txt").write_text("leaf", encoding="utf-8")
30
+ dst_dir = tmp_path / "tree_dst"
31
+ exit_code, msg = cmd.execute([str(src_dir), str(dst_dir)])
32
+ assert exit_code == 0
33
+ assert "Copied directory" in msg
34
+ assert (dst_dir / "nested" / "leaf.txt").read_text(encoding="utf-8") == "leaf"
35
+
36
+
37
+ def test_native_cp_errors(tmp_path):
38
+ cmd = handler.Copy()
39
+ exit_code, msg = cmd.execute(
40
+ [str(tmp_path / "missing.txt"), str(tmp_path / "out.txt")]
41
+ )
42
+ assert exit_code == 1
43
+ assert "not found" in msg
44
+ f1 = tmp_path / "same.txt"
45
+ f1.write_text("abc", encoding="utf-8")
46
+ code, _ = bridge._native.cp(str(f1), str(f1), True)
47
+ assert code == -7 # ERR_SAME_FILE
48
+ f2 = tmp_path / "other.txt"
49
+ f2.write_text("def", encoding="utf-8")
50
+ code, _ = bridge._native.cp(str(f1), str(f2), False)
51
+ assert code == -5 # ERR_EXISTS
52
+
53
+
14
54
  def test_native_rm_file_and_recursive_dir(tmp_path):
15
55
  cmd = handler.Rm()
16
56
  target_file = tmp_path / "delete_me.txt"
@@ -12,6 +12,25 @@ def force_legacy_backend(monkeypatch):
12
12
  monkeypatch.setattr(bridge, "has_native_support", lambda: False)
13
13
 
14
14
 
15
+ def test_legacy_cp_file_and_directory(tmp_path):
16
+ cmd = handler.Copy()
17
+ src_file = tmp_path / "lgc_src.txt"
18
+ src_file.write_text("payload", encoding="utf-8")
19
+ dst_file = tmp_path / "lgc_dst.txt"
20
+ exit_code, msg = cmd.execute([str(src_file), str(dst_file)])
21
+ assert exit_code == 0
22
+ assert dst_file.read_text(encoding="utf-8") == "payload"
23
+ src_dir = tmp_path / "lgc_tree"
24
+ src_dir.mkdir()
25
+ (src_dir / "item.txt").write_text("inner", encoding="utf-8")
26
+ dst_dir = tmp_path / "lgc_tree_copy"
27
+ exit_code, msg = cmd.execute([str(src_dir), str(dst_dir)])
28
+ assert exit_code == 0
29
+ assert (dst_dir / "item.txt").read_text(encoding="utf-8") == "inner"
30
+ code, _ = legacy.lgc_cp(src_file, src_file, force=True)
31
+ assert code == -7 # ERR_SAME_FILE
32
+
33
+
15
34
  def test_legacy_rm_file_and_recursive_dir(tmp_path):
16
35
  cmd = handler.Rm()
17
36
  target_file = tmp_path / "lgc_del.txt"
@@ -2,6 +2,10 @@
2
2
 
3
3
  from flyshell.builtin import diskops
4
4
 
5
+ import pytest
6
+
7
+ pytestmark = pytest.mark.skip(reason="Deprecated features soon to be removed.")
8
+
5
9
 
6
10
  def test_copy_file_and_directory(tmp_path):
7
11
  src_file = tmp_path / "source.txt"
flyshell-1.4.9/setup.py DELETED
@@ -1,36 +0,0 @@
1
- # setup.py
2
-
3
- from setuptools import Extension, setup
4
- import sys
5
-
6
- sources = [
7
- "c_src/diskops/diskops.c",
8
- "c_src/diskops/shared/dir_types.c",
9
- ]
10
-
11
- if sys.platform == "win32":
12
- sources.append("c_src/diskops/win32/cat.c")
13
- sources.append("c_src/diskops/win32/dir.c")
14
- sources.append("c_src/diskops/win32/mkdir.c")
15
- sources.append("c_src/diskops/win32/rename.c")
16
- sources.append("c_src/diskops/win32/rm.c")
17
- sources.append("c_src/diskops/win32/rmdir.c")
18
- sources.append("c_src/diskops/win32/touch.c")
19
- else:
20
- sources.append("c_src/diskops/posix/cat.c")
21
- sources.append("c_src/diskops/posix/dir.c")
22
- sources.append("c_src/diskops/posix/mkdir.c")
23
- sources.append("c_src/diskops/posix/rename.c")
24
- sources.append("c_src/diskops/posix/rm.c")
25
- sources.append("c_src/diskops/posix/rmdir.c")
26
- sources.append("c_src/diskops/posix/touch.c")
27
-
28
- native_diskops = Extension(
29
- name="flyshell.bin._native_diskops",
30
- sources=sources,
31
- include_dirs=["c_src/diskops/shared"],
32
- )
33
-
34
- setup(
35
- ext_modules=[native_diskops],
36
- )
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes