flyshell 1.4.0__tar.gz → 1.4.2__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 (66) hide show
  1. {flyshell-1.4.0/src/flyshell.egg-info → flyshell-1.4.2}/PKG-INFO +1 -1
  2. {flyshell-1.4.0 → flyshell-1.4.2}/c_src/diskops/diskops.c +21 -26
  3. {flyshell-1.4.0 → flyshell-1.4.2}/c_src/diskops/posix/cat.c +5 -5
  4. {flyshell-1.4.0 → flyshell-1.4.2}/c_src/diskops/posix/dir.c +9 -9
  5. {flyshell-1.4.0 → flyshell-1.4.2}/c_src/diskops/posix/touch.c +3 -3
  6. {flyshell-1.4.0 → flyshell-1.4.2}/c_src/diskops/shared/dir_types.c +5 -4
  7. {flyshell-1.4.0 → flyshell-1.4.2}/c_src/diskops/shared/dir_types.h +3 -3
  8. flyshell-1.4.2/c_src/diskops/shared/native_errors.h +108 -0
  9. {flyshell-1.4.0 → flyshell-1.4.2}/c_src/diskops/win32/cat.c +8 -14
  10. {flyshell-1.4.0 → flyshell-1.4.2}/c_src/diskops/win32/dir.c +6 -6
  11. {flyshell-1.4.0 → flyshell-1.4.2}/c_src/diskops/win32/touch.c +7 -13
  12. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/constants.py +2 -2
  13. {flyshell-1.4.0 → flyshell-1.4.2/src/flyshell.egg-info}/PKG-INFO +1 -1
  14. flyshell-1.4.0/c_src/diskops/shared/native_errors.h +0 -84
  15. {flyshell-1.4.0 → flyshell-1.4.2}/LICENSE +0 -0
  16. {flyshell-1.4.0 → flyshell-1.4.2}/MANIFEST.in +0 -0
  17. {flyshell-1.4.0 → flyshell-1.4.2}/README.md +0 -0
  18. {flyshell-1.4.0 → flyshell-1.4.2}/pyproject.toml +0 -0
  19. {flyshell-1.4.0 → flyshell-1.4.2}/setup.cfg +0 -0
  20. {flyshell-1.4.0 → flyshell-1.4.2}/setup.py +0 -0
  21. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/__init__.py +0 -0
  22. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/abstract/__init__.py +0 -0
  23. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/abstract/base_cmd.py +0 -0
  24. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/abstract/base_plugin.py +0 -0
  25. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/abstract/parent_cmd.py +0 -0
  26. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/accounts/__init__.py +0 -0
  27. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/accounts/auth.py +0 -0
  28. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/bin/__init__.py +0 -0
  29. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/builtin/__init__.py +0 -0
  30. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/builtin/diskops.py +0 -0
  31. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/builtin/fs.py +0 -0
  32. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/builtin/pkg.py +0 -0
  33. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/builtin/system.py +0 -0
  34. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/builtin/utils.py +0 -0
  35. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/core/__init__.py +0 -0
  36. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/core/console.py +0 -0
  37. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/core/data.py +0 -0
  38. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/core/directory.py +0 -0
  39. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/main.py +0 -0
  40. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/native/__init__.py +0 -0
  41. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/native/diskops_bridge.py +0 -0
  42. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/native/diskops_handler.py +0 -0
  43. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/native/legacy/__init__.py +0 -0
  44. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/native/legacy/diskops.py +0 -0
  45. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/startup/__init__.py +0 -0
  46. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/startup/deps.py +0 -0
  47. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/startup/env.py +0 -0
  48. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell/startup/loader.py +0 -0
  49. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell.egg-info/SOURCES.txt +0 -0
  50. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell.egg-info/dependency_links.txt +0 -0
  51. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell.egg-info/entry_points.txt +0 -0
  52. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell.egg-info/requires.txt +0 -0
  53. {flyshell-1.4.0 → flyshell-1.4.2}/src/flyshell.egg-info/top_level.txt +0 -0
  54. {flyshell-1.4.0 → flyshell-1.4.2}/tests/test_auth.py +0 -0
  55. {flyshell-1.4.0 → flyshell-1.4.2}/tests/test_data.py +0 -0
  56. {flyshell-1.4.0 → flyshell-1.4.2}/tests/test_deps.py +0 -0
  57. {flyshell-1.4.0 → flyshell-1.4.2}/tests/test_directory.py +0 -0
  58. {flyshell-1.4.0 → flyshell-1.4.2}/tests/test_diskops_ext.py +0 -0
  59. {flyshell-1.4.0 → flyshell-1.4.2}/tests/test_diskops_lgc.py +0 -0
  60. {flyshell-1.4.0 → flyshell-1.4.2}/tests/test_diskops_old.py +0 -0
  61. {flyshell-1.4.0 → flyshell-1.4.2}/tests/test_env.py +0 -0
  62. {flyshell-1.4.0 → flyshell-1.4.2}/tests/test_fs.py +0 -0
  63. {flyshell-1.4.0 → flyshell-1.4.2}/tests/test_loader.py +0 -0
  64. {flyshell-1.4.0 → flyshell-1.4.2}/tests/test_pkg.py +0 -0
  65. {flyshell-1.4.0 → flyshell-1.4.2}/tests/test_security.py +0 -0
  66. {flyshell-1.4.0 → flyshell-1.4.2}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyshell
3
- Version: 1.4.0
3
+ Version: 1.4.2
4
4
  Summary: A modular, zero-dependency command-line environment in Python.
5
5
  License-Expression: MIT
6
6
  Requires-Python: >=3.10
@@ -1,27 +1,27 @@
1
1
  // c_src/diskops/diskops.c
2
2
 
3
3
  #define PY_SSIZE_T_CLEAN
4
- #include <Python.h>
5
- #include "shared/native_errors.h"
6
4
  #include "shared/dir_types.h"
5
+ #include "shared/native_errors.h"
6
+ #include <Python.h>
7
7
 
8
- Result cat(const char* path, char** out_buf, size_t* out_size);
8
+ Result cat(const char *path, char **out_buf, size_t *out_size);
9
9
 
10
- Result touch(const char* path);
10
+ Result touch(const char *path);
11
11
 
12
- Result list_dir(const char* path, DirList* out_list);
12
+ Result list_dir(const char *path, DirList *out_list);
13
13
 
14
- static PyObject* method_ping(PyObject* self, PyObject* args) {
14
+ static PyObject *method_ping(PyObject *self, PyObject *args) {
15
15
  return PyLong_FromLong(42);
16
16
  }
17
17
 
18
- static PyObject* method_cat(PyObject* self, PyObject* args) {
19
- const char* path;
18
+ static PyObject *method_cat(PyObject *self, PyObject *args) {
19
+ const char *path;
20
20
  if (!PyArg_ParseTuple(args, "s", &path)) {
21
21
  return NULL;
22
22
  }
23
23
 
24
- char* buf = NULL;
24
+ char *buf = NULL;
25
25
  size_t size = 0;
26
26
  Result res = cat(path, &buf, &size);
27
27
 
@@ -29,7 +29,7 @@ static PyObject* method_cat(PyObject* self, PyObject* args) {
29
29
  return Py_BuildValue("(is)", (int)res, "");
30
30
  }
31
31
 
32
- PyObject* content = PyUnicode_FromStringAndSize(buf, size);
32
+ PyObject *content = PyUnicode_FromStringAndSize(buf, (Py_ssize_t)size);
33
33
  free(buf);
34
34
 
35
35
  if (!content) {
@@ -37,12 +37,12 @@ static PyObject* method_cat(PyObject* self, PyObject* args) {
37
37
  return Py_BuildValue("(is)", (int)ERR_DECODE, "");
38
38
  }
39
39
 
40
- PyObject* ret = Py_BuildValue("(iN)", (int)SUCCESS, content);
40
+ PyObject *ret = Py_BuildValue("(iN)", (int)SUCCESS, content);
41
41
  return ret;
42
42
  }
43
43
 
44
- static PyObject* method_touch(PyObject* self, PyObject* args) {
45
- const char* path;
44
+ static PyObject *method_touch(PyObject *self, PyObject *args) {
45
+ const char *path;
46
46
  if (!PyArg_ParseTuple(args, "s", &path)) {
47
47
  return NULL;
48
48
  }
@@ -51,8 +51,8 @@ static PyObject* method_touch(PyObject* self, PyObject* args) {
51
51
  return Py_BuildValue("(is)", (int)res, "");
52
52
  }
53
53
 
54
- static PyObject* method_dir(PyObject* self, PyObject* args) {
55
- const char* path;
54
+ static PyObject *method_dir(PyObject *self, PyObject *args) {
55
+ const char *path;
56
56
  if (!PyArg_ParseTuple(args, "s", &path)) {
57
57
  return NULL;
58
58
  }
@@ -63,14 +63,14 @@ static PyObject* method_dir(PyObject* self, PyObject* args) {
63
63
  return Py_BuildValue("(i[])", (int)res);
64
64
  }
65
65
 
66
- PyObject* py_list = PyList_New(dir_list.count);
66
+ PyObject *py_list = PyList_New((Py_ssize_t)dir_list.count);
67
67
  if (!py_list) {
68
68
  free_dir_list(&dir_list);
69
69
  return Py_BuildValue("(i[])", (int)ERR_IO);
70
70
  }
71
71
 
72
72
  for (size_t i = 0; i < dir_list.count; ++i) {
73
- PyObject* item = Py_BuildValue("(sO)", dir_list.entries[i].name,
73
+ PyObject *item = Py_BuildValue("(sO)", dir_list.entries[i].name,
74
74
  dir_list.entries[i].is_dir ? Py_True : Py_False);
75
75
  PyList_SET_ITEM(py_list, i, item);
76
76
  }
@@ -81,19 +81,14 @@ static PyObject* method_dir(PyObject* self, PyObject* args) {
81
81
 
82
82
  static PyMethodDef DiskopsMethods[] = {
83
83
  {"ping", method_ping, METH_NOARGS, "Health check ping."},
84
- {"cat", method_cat, METH_VARARGS, "Read file content natively."},
84
+ {"cat", method_cat, METH_VARARGS, "Read file content natively."},
85
85
  {"touch", method_touch, METH_VARARGS, "Touch or create file natively."},
86
- {"dir", method_dir, METH_VARARGS, "List directory contents natively."},
86
+ {"dir", method_dir, METH_VARARGS, "List directory contents natively."},
87
87
  {NULL, NULL, 0, NULL},
88
88
  };
89
89
 
90
- static struct PyModuleDef diskopsmodule = {
91
- PyModuleDef_HEAD_INIT,
92
- "_native_diskops",
93
- "Flyshell native disk operations.",
94
- -1,
95
- DiskopsMethods
96
- };
90
+ static struct PyModuleDef diskopsmodule = {PyModuleDef_HEAD_INIT, "_native_diskops",
91
+ "Flyshell native disk operations.", -1, DiskopsMethods};
97
92
 
98
93
  PyMODINIT_FUNC PyInit__native_diskops(void) {
99
94
  return PyModule_Create(&diskopsmodule);
@@ -1,13 +1,13 @@
1
1
  // c_src/diskops/posix/cat.c
2
2
 
3
+ #include "../shared/native_errors.h"
4
+ #include <errno.h>
3
5
  #include <fcntl.h>
6
+ #include <stdlib.h>
4
7
  #include <sys/stat.h>
5
8
  #include <unistd.h>
6
- #include <stdlib.h>
7
- #include <errno.h>
8
- #include "../shared/native_errors.h"
9
9
 
10
- Result cat(const char* path, char** out_buf, size_t* out_size) {
10
+ Result cat(const char *path, char **out_buf, size_t *out_size) {
11
11
  if (!path || !out_buf || !out_size) {
12
12
  return ERR_INVALID_PATH;
13
13
  }
@@ -36,7 +36,7 @@ Result cat(const char* path, char** out_buf, size_t* out_size) {
36
36
  return ERR_EMPTY;
37
37
  }
38
38
 
39
- char* buf = (char*)malloc(st.st_size + 1);
39
+ char *buf = (char *)malloc(st.st_size + 1);
40
40
  if (!buf) {
41
41
  close(fd);
42
42
  return ERR_IO;
@@ -3,15 +3,15 @@
3
3
  #define _POSIX_C_SOURCE 200809L
4
4
  #define _GNU_SOURCE
5
5
 
6
+ #include "../shared/dir_types.h"
7
+ #include "../shared/native_errors.h"
6
8
  #include <dirent.h>
7
- #include <sys/stat.h>
9
+ #include <errno.h>
8
10
  #include <stdlib.h>
9
11
  #include <string.h>
10
- #include <errno.h>
11
- #include "../shared/native_errors.h"
12
- #include "../shared/dir_types.h"
12
+ #include <sys/stat.h>
13
13
 
14
- Result list_dir(const char* path, DirList* out_list) {
14
+ Result list_dir(const char *path, DirList *out_list) {
15
15
  if (!path || path[0] == '\0' || !out_list) {
16
16
  return ERR_INVALID_PATH;
17
17
  }
@@ -19,19 +19,19 @@ Result list_dir(const char* path, DirList* out_list) {
19
19
  out_list->entries = NULL;
20
20
  out_list->count = 0;
21
21
 
22
- DIR* dir = opendir(path);
22
+ DIR *dir = opendir(path);
23
23
  if (!dir) {
24
24
  return map_posix_errno(errno);
25
25
  }
26
26
 
27
27
  size_t capacity = 16;
28
- out_list->entries = (DirEntry*)malloc(capacity * sizeof(DirEntry));
28
+ out_list->entries = (DirEntry *)malloc(capacity * sizeof(DirEntry));
29
29
  if (!out_list->entries) {
30
30
  closedir(dir);
31
31
  return ERR_IO;
32
32
  }
33
33
 
34
- struct dirent* entry;
34
+ struct dirent *entry;
35
35
  while ((entry = readdir(dir)) != NULL) {
36
36
  if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) {
37
37
  continue;
@@ -39,7 +39,7 @@ Result list_dir(const char* path, DirList* out_list) {
39
39
 
40
40
  if (out_list->count >= capacity) {
41
41
  capacity *= 2;
42
- DirEntry* resized = (DirEntry*)realloc(out_list->entries, capacity * sizeof(DirEntry));
42
+ DirEntry *resized = (DirEntry *)realloc(out_list->entries, capacity * sizeof(DirEntry));
43
43
  if (!resized) {
44
44
  closedir(dir);
45
45
  free_dir_list(out_list);
@@ -3,13 +3,13 @@
3
3
  #define _POSIX_C_SOURCE 200809L
4
4
  #define _GNU_SOURCE
5
5
 
6
+ #include "../shared/native_errors.h"
7
+ #include <errno.h>
6
8
  #include <fcntl.h>
7
9
  #include <sys/stat.h>
8
10
  #include <unistd.h>
9
- #include <errno.h>
10
- #include "../shared/native_errors.h"
11
11
 
12
- Result touch(const char* path) {
12
+ Result touch(const char *path) {
13
13
  if (!path || path[0] == '\0') {
14
14
  return ERR_INVALID_PATH;
15
15
  }
@@ -1,12 +1,13 @@
1
1
  // c_src/diskops/shared/dir_types.c
2
2
 
3
- #include <stdlib.h>
4
3
  #include "dir_types.h"
4
+ #include <stdlib.h>
5
5
 
6
- void free_dir_list(DirList* list) {
7
- if (!list) return;
6
+ void free_dir_list(DirList *list) {
7
+ if (!list)
8
+ return;
8
9
  if (list->entries) {
9
- for (size_t i = 0; i < list ->count; ++i) {
10
+ for (size_t i = 0; i < list->count; ++i) {
10
11
  free(list->entries[i].name);
11
12
  }
12
13
  free(list->entries);
@@ -7,15 +7,15 @@
7
7
  #include <stddef.h>
8
8
 
9
9
  typedef struct {
10
- char* name;
10
+ char *name;
11
11
  bool is_dir;
12
12
  } DirEntry;
13
13
 
14
14
  typedef struct {
15
- DirEntry* entries;
15
+ DirEntry *entries;
16
16
  size_t count;
17
17
  } DirList;
18
18
 
19
- void free_dir_list(DirList* list);
19
+ void free_dir_list(DirList *list);
20
20
 
21
21
  #endif /* DIR_TYPES_H */
@@ -0,0 +1,108 @@
1
+ // c_src/diskops/shared/native_errors.h
2
+
3
+ #ifndef NATIVE_ERRORS_H
4
+ #define NATIVE_ERRORS_H
5
+
6
+ #include <errno.h>
7
+
8
+ #ifdef _WIN32
9
+ #include <windows.h>
10
+ #endif
11
+
12
+ typedef enum {
13
+ SUCCESS = 0,
14
+ ERR_NOT_FOUND = -1,
15
+ ERR_PERMISSION = -2,
16
+ ERR_IS_DIR = -3,
17
+ ERR_NOT_DIR = -4,
18
+ ERR_EXISTS = -5,
19
+ ERR_NOT_EMPTY = -6,
20
+ ERR_SAME_FILE = -7,
21
+ ERR_EMPTY = -8,
22
+ ERR_INVALID_PATH = -9,
23
+ ERR_XDEV = -10,
24
+ ERR_BUSY = -11,
25
+ ERR_NO_SPACE = -12,
26
+ ERR_IO = -13,
27
+ ERR_DECODE = -14,
28
+ ERR_LAUNCH_FAIL = -15,
29
+ ERR_UNKNOWN = -99
30
+ } Result;
31
+
32
+ static inline Result map_posix_errno(int err) {
33
+ switch (err) {
34
+ case 0:
35
+ return SUCCESS;
36
+ case ENOENT:
37
+ return ERR_NOT_FOUND;
38
+ case EACCES:
39
+ case EPERM:
40
+ return ERR_PERMISSION;
41
+ case EISDIR:
42
+ return ERR_IS_DIR;
43
+ case ENOTDIR:
44
+ return ERR_NOT_DIR;
45
+ case EEXIST:
46
+ return ERR_EXISTS;
47
+ case ENOTEMPTY:
48
+ return ERR_NOT_EMPTY;
49
+ case EXDEV:
50
+ return ERR_XDEV;
51
+ case EBUSY:
52
+ return ERR_BUSY;
53
+ case ENOSPC:
54
+ #ifdef EDQUOT
55
+ case EDQUOT:
56
+ #endif
57
+ return ERR_NO_SPACE;
58
+ case EINVAL:
59
+ case ENAMETOOLONG:
60
+ return ERR_INVALID_PATH;
61
+ case EIO:
62
+ return ERR_IO;
63
+ default:
64
+ return ERR_UNKNOWN;
65
+ }
66
+ }
67
+
68
+ #ifdef _WIN32
69
+ static inline Result map_win32_error(DWORD err) {
70
+ switch (err) {
71
+ case ERROR_SUCCESS:
72
+ return SUCCESS;
73
+ case ERROR_FILE_NOT_FOUND:
74
+ case ERROR_PATH_NOT_FOUND:
75
+ return ERR_NOT_FOUND;
76
+ case ERROR_ACCESS_DENIED:
77
+ return ERR_PERMISSION;
78
+ case ERROR_DIRECTORY:
79
+ return ERR_NOT_DIR;
80
+ case ERROR_ALREADY_EXISTS:
81
+ case ERROR_FILE_EXISTS:
82
+ return ERR_EXISTS;
83
+ case ERROR_DIR_NOT_EMPTY:
84
+ return ERR_NOT_EMPTY;
85
+ case ERROR_NOT_SAME_DEVICE:
86
+ return ERR_XDEV;
87
+ case ERROR_SHARING_VIOLATION:
88
+ case ERROR_LOCK_VIOLATION:
89
+ case ERROR_BUSY:
90
+ return ERR_BUSY;
91
+ case ERROR_DISK_FULL:
92
+ case ERROR_HANDLE_DISK_FULL:
93
+ return ERR_NO_SPACE;
94
+ case ERROR_INVALID_NAME:
95
+ case ERROR_FILENAME_EXCED_RANGE:
96
+ case ERROR_BAD_PATHNAME:
97
+ return ERR_INVALID_PATH;
98
+ case ERROR_READ_FAULT:
99
+ case ERROR_WRITE_FAULT:
100
+ case ERROR_IO_DEVICE:
101
+ return ERR_IO;
102
+ default:
103
+ return ERR_UNKNOWN;
104
+ }
105
+ }
106
+ #endif
107
+
108
+ #endif /* NATIVE_ERRORS_H */
@@ -1,10 +1,10 @@
1
1
  // c_src/diskops/win32/cat.c
2
2
 
3
- #include <windows.h>
4
- #include <stdlib.h>
5
3
  #include "../shared/native_errors.h"
4
+ #include <stdlib.h>
5
+ #include <windows.h>
6
6
 
7
- Result cat(const char* path, char** out_buf, size_t* out_size) {
7
+ Result cat(const char *path, char **out_buf, size_t *out_size) {
8
8
  if (!path || !out_buf || !out_size) {
9
9
  return ERR_INVALID_PATH;
10
10
  }
@@ -16,21 +16,15 @@ Result cat(const char* path, char** out_buf, size_t* out_size) {
16
16
  return ERR_INVALID_PATH;
17
17
  }
18
18
 
19
- wchar_t* wpath = (wchar_t*)malloc(wlen * sizeof(wchar_t));
19
+ wchar_t *wpath = (wchar_t *)malloc(wlen * sizeof(wchar_t));
20
20
  if (!wpath) {
21
21
  return ERR_IO;
22
22
  }
23
23
  MultiByteToWideChar(CP_UTF8, 0, path, -1, wpath, wlen);
24
24
 
25
- HANDLE hFile = CreateFileW(
26
- wpath,
27
- GENERIC_READ,
28
- FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
29
- NULL,
30
- OPEN_EXISTING,
31
- FILE_ATTRIBUTE_NORMAL,
32
- NULL
33
- );
25
+ HANDLE hFile =
26
+ CreateFileW(wpath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
27
+ NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
34
28
 
35
29
  if (hFile == INVALID_HANDLE_VALUE) {
36
30
  DWORD err = GetLastError();
@@ -58,7 +52,7 @@ Result cat(const char* path, char** out_buf, size_t* out_size) {
58
52
  return ERR_EMPTY;
59
53
  }
60
54
 
61
- char* buf = (char*)malloc(size.QuadPart + 1);
55
+ char *buf = (char *)malloc(size.QuadPart + 1);
62
56
  if (!buf) {
63
57
  CloseHandle(hFile);
64
58
  return ERR_IO;
@@ -1,13 +1,13 @@
1
1
  // c_src/diskops/win32/dir.c
2
2
 
3
- #include <windows.h>
3
+ #include "../shared/dir_types.h"
4
+ #include "../shared/native_errors.h"
4
5
  #include <stdio.h>
5
6
  #include <stdlib.h>
6
7
  #include <string.h>
7
- #include "../shared/native_errors.h"
8
- #include "../shared/dir_types.h"
8
+ #include <windows.h>
9
9
 
10
- Result list_dir(const char* path, DirList* out_list) {
10
+ Result list_dir(const char *path, DirList *out_list) {
11
11
  if (!path || path[0] == '\0' || !out_list) {
12
12
  return ERR_INVALID_PATH;
13
13
  }
@@ -25,7 +25,7 @@ Result list_dir(const char* path, DirList* out_list) {
25
25
  }
26
26
 
27
27
  size_t capacity = 16;
28
- out_list->entries = (DirEntry*)malloc(capacity * sizeof(DirEntry));
28
+ out_list->entries = (DirEntry *)malloc(capacity * sizeof(DirEntry));
29
29
  if (!out_list->entries) {
30
30
  FindClose(h_find);
31
31
  return ERR_IO;
@@ -38,7 +38,7 @@ Result list_dir(const char* path, DirList* out_list) {
38
38
 
39
39
  if (out_list->count >= capacity) {
40
40
  capacity *= 2;
41
- DirEntry* resized = (DirEntry*)realloc(out_list->entries, capacity * sizeof(DirEntry));
41
+ DirEntry *resized = (DirEntry *)realloc(out_list->entries, capacity * sizeof(DirEntry));
42
42
  if (!resized) {
43
43
  FindClose(h_find);
44
44
  free_dir_list(out_list);
@@ -1,10 +1,10 @@
1
1
  // c_src/diskops/win32/touch.c
2
2
 
3
- #include <windows.h>
4
- #include <stdlib.h>
5
3
  #include "../shared/native_errors.h"
4
+ #include <stdlib.h>
5
+ #include <windows.h>
6
6
 
7
- Result touch(const char* path) {
7
+ Result touch(const char *path) {
8
8
  if (!path || path[0] == '\0') {
9
9
  return ERR_INVALID_PATH;
10
10
  }
@@ -14,7 +14,7 @@ Result touch(const char* path) {
14
14
  return ERR_INVALID_PATH;
15
15
  }
16
16
 
17
- wchar_t* wpath = (wchar_t*)malloc(wlen * sizeof(wchar_t));
17
+ wchar_t *wpath = (wchar_t *)malloc(wlen * sizeof(wchar_t));
18
18
  if (!wpath) {
19
19
  return ERR_IO;
20
20
  }
@@ -26,15 +26,9 @@ Result touch(const char* path) {
26
26
  return ERR_IS_DIR;
27
27
  }
28
28
 
29
- HANDLE hFile = CreateFileW(
30
- wpath,
31
- FILE_WRITE_ATTRIBUTES,
32
- FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
33
- NULL,
34
- OPEN_ALWAYS,
35
- FILE_ATTRIBUTE_NORMAL,
36
- NULL
37
- );
29
+ HANDLE hFile = CreateFileW(wpath, FILE_WRITE_ATTRIBUTES,
30
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL,
31
+ OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
38
32
 
39
33
  if (hFile == INVALID_HANDLE_VALUE) {
40
34
  DWORD err = GetLastError();
@@ -5,8 +5,8 @@ import os
5
5
  import platform
6
6
  import time
7
7
 
8
- BUILD = 154
9
- VERSION = "1.4.0"
8
+ BUILD = 156
9
+ VERSION = "1.4.2"
10
10
 
11
11
 
12
12
  def _resolve_app_dir() -> Path:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyshell
3
- Version: 1.4.0
3
+ Version: 1.4.2
4
4
  Summary: A modular, zero-dependency command-line environment in Python.
5
5
  License-Expression: MIT
6
6
  Requires-Python: >=3.10
@@ -1,84 +0,0 @@
1
- // c_src/diskops/shared/native_errors.h
2
-
3
- #ifndef NATIVE_ERRORS_H
4
- #define NATIVE_ERRORS_H
5
-
6
- #include <errno.h>
7
-
8
- #ifdef _WIN32
9
- #include <windows.h>
10
- #endif
11
-
12
- typedef enum {
13
- SUCCESS = 0,
14
- ERR_NOT_FOUND = -1,
15
- ERR_PERMISSION = -2,
16
- ERR_IS_DIR = -3,
17
- ERR_NOT_DIR = -4,
18
- ERR_EXISTS = -5,
19
- ERR_NOT_EMPTY = -6,
20
- ERR_SAME_FILE = -7,
21
- ERR_EMPTY = -8,
22
- ERR_INVALID_PATH = -9,
23
- ERR_XDEV = -10,
24
- ERR_BUSY = -11,
25
- ERR_NO_SPACE = -12,
26
- ERR_IO = -13,
27
- ERR_DECODE = -14,
28
- ERR_LAUNCH_FAIL = -15,
29
- ERR_UNKNOWN = -99
30
- } Result;
31
-
32
- static inline Result map_posix_errno(int err) {
33
- switch (err) {
34
- case 0: return SUCCESS;
35
- case ENOENT: return ERR_NOT_FOUND;
36
- case EACCES:
37
- case EPERM: return ERR_PERMISSION;
38
- case EISDIR: return ERR_IS_DIR;
39
- case ENOTDIR: return ERR_NOT_DIR;
40
- case EEXIST: return ERR_EXISTS;
41
- case ENOTEMPTY: return ERR_NOT_EMPTY;
42
- case EXDEV: return ERR_XDEV;
43
- case EBUSY: return ERR_BUSY;
44
- case ENOSPC:
45
- #ifdef EDQUOT
46
- case EDQUOT:
47
- #endif
48
- return ERR_NO_SPACE;
49
- case EINVAL:
50
- case ENAMETOOLONG: return ERR_INVALID_PATH;
51
- case EIO: return ERR_IO;
52
- default: return ERR_UNKNOWN;
53
- }
54
- }
55
-
56
- #ifdef _WIN32
57
- static inline Result map_win32_error(DWORD err) {
58
- switch (err) {
59
- case ERROR_SUCCESS: return SUCCESS;
60
- case ERROR_FILE_NOT_FOUND:
61
- case ERROR_PATH_NOT_FOUND: return ERR_NOT_FOUND;
62
- case ERROR_ACCESS_DENIED: return ERR_PERMISSION;
63
- case ERROR_DIRECTORY: return ERR_NOT_DIR;
64
- case ERROR_ALREADY_EXISTS:
65
- case ERROR_FILE_EXISTS: return ERR_EXISTS;
66
- case ERROR_DIR_NOT_EMPTY: return ERR_NOT_EMPTY;
67
- case ERROR_NOT_SAME_DEVICE: return ERR_XDEV;
68
- case ERROR_SHARING_VIOLATION:
69
- case ERROR_LOCK_VIOLATION:
70
- case ERROR_BUSY: return ERR_BUSY;
71
- case ERROR_DISK_FULL:
72
- case ERROR_HANDLE_DISK_FULL: return ERR_NO_SPACE;
73
- case ERROR_INVALID_NAME:
74
- case ERROR_FILENAME_EXCED_RANGE:
75
- case ERROR_BAD_PATHNAME: return ERR_INVALID_PATH;
76
- case ERROR_READ_FAULT:
77
- case ERROR_WRITE_FAULT:
78
- case ERROR_IO_DEVICE: return ERR_IO;
79
- default: return ERR_UNKNOWN;
80
- }
81
- }
82
- #endif
83
-
84
- #endif /* NATIVE_ERRORS_H */
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
File without changes
File without changes
File without changes