ccoding 0.2.4__py3-none-any.whl → 0.2.5__py3-none-any.whl

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.
ccode/remote_common.py CHANGED
@@ -3,11 +3,20 @@ from __future__ import annotations
3
3
  import base64
4
4
  import contextlib
5
5
  import datetime as dt
6
- import fcntl
7
6
  import hashlib
8
7
  import hmac
9
8
  import os
10
9
  import re
10
+
11
+ try:
12
+ import fcntl
13
+ except ImportError:
14
+ fcntl = None
15
+
16
+ try:
17
+ import msvcrt
18
+ except ImportError:
19
+ msvcrt = None
11
20
  import secrets
12
21
  import time
13
22
  from dataclasses import dataclass
@@ -209,11 +218,24 @@ def web_asset_text(name: str) -> str:
209
218
  def file_lock(path: Any) -> Iterator[None]:
210
219
  CONFIG_DIR.mkdir(parents=True, exist_ok=True)
211
220
  with path.open("a+") as lock_file:
212
- fcntl.flock(lock_file.fileno(), fcntl.LOCK_EX)
221
+ if msvcrt is not None:
222
+ if path.stat().st_size == 0:
223
+ lock_file.write("0")
224
+ lock_file.flush()
225
+ lock_file.seek(0)
226
+ getattr(msvcrt, "locking")(lock_file.fileno(), getattr(msvcrt, "LK_LOCK"), 1)
227
+ elif fcntl is not None:
228
+ fcntl.flock(lock_file.fileno(), fcntl.LOCK_EX)
229
+ else:
230
+ raise OSError("file locking is not supported on this platform")
213
231
  try:
214
232
  yield
215
233
  finally:
216
- fcntl.flock(lock_file.fileno(), fcntl.LOCK_UN)
234
+ if msvcrt is not None:
235
+ lock_file.seek(0)
236
+ getattr(msvcrt, "locking")(lock_file.fileno(), getattr(msvcrt, "LK_UNLCK"), 1)
237
+ elif fcntl is not None:
238
+ fcntl.flock(lock_file.fileno(), fcntl.LOCK_UN)
217
239
 
218
240
 
219
241
  def rotate_log(path: Any, max_bytes: int, backups: int) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ccoding
3
- Version: 0.2.4
3
+ Version: 0.2.5
4
4
  Summary: Curses-based Claude Code launcher
5
5
  Project-URL: Homepage, https://github.com/8DE4732A/ccode
6
6
  Project-URL: Repository, https://github.com/8DE4732A/ccode
@@ -8,7 +8,7 @@ ccode/logo.py,sha256=L8nkF8Zx4YlrFGnVONpEc7sWF2aAB3cyoQdtISF-SVM,5514
8
8
  ccode/remote.py,sha256=X7coJG7JQapFvDWMoOegno7TSbNkq4zuV5MtB4l4b_I,24971
9
9
  ccode/remote_cli.py,sha256=nblydZh4XiksnZitLp_9RTmuJuGBVCYK_o1vzyA2PeM,8569
10
10
  ccode/remote_client.py,sha256=5UjWK-bTns4jSCON7hTu-S3U5kf4X0ZLH4ql9in3z8Q,9597
11
- ccode/remote_common.py,sha256=9eJeUJTaQQojTLcF7gz8X0dFM5nO3vM5q7bC-YSd8bE,8244
11
+ ccode/remote_common.py,sha256=uxJV0_n_mlLhkXKNAqK6E3r2y1-FzbnSWo1yU4thmxg,8946
12
12
  ccode/remote_server.py,sha256=CqKKiE55yAfGkYOcXIOqELROCkY5rtr-Z3GnyBq3taQ,13692
13
13
  ccode/ui.py,sha256=eoCjHkUAVadsGSAisQ7_BI4DaPdjYnX9cAeh2zzkI58,38274
14
14
  ccode/web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -20,8 +20,8 @@ ccode/web/assets/xterm-LICENSE,sha256=tWn2KdAPJiaoEA3yoXmCEFNWIeQhZN_UJqb-Wqx7DM
20
20
  ccode/web/assets/xterm-addon-fit-LICENSE,sha256=4lbwEYivUn5NBtIdBvv3ha6cUNSzKL8Dy-C6fwqkIo8,1103
21
21
  ccode/web/assets/xterm.css,sha256=hUp8D7cOixoIPBZ5ergnKZ-xh0T1rTTyJ7SDN-Myk8Y,7112
22
22
  ccode/web/assets/xterm.js,sha256=FJA1ef9UZkzXL46GmeaWGmJywhhj7Bw7EYzcivXUqXI,488663
23
- ccoding-0.2.4.dist-info/METADATA,sha256=l1dPEwJjue2Bv5sYIHhmRuCNCgc7DBL5y0fUtm4HH3k,19551
24
- ccoding-0.2.4.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
25
- ccoding-0.2.4.dist-info/entry_points.txt,sha256=uxtngaM0Eazhs4dCpcQvAIVdQBRLJ_6u-BpN3pYaGrQ,125
26
- ccoding-0.2.4.dist-info/licenses/LICENSE,sha256=ghzeEUUCG5lu2DDgFe37bgLJk_0_Y6v-ulXwmYWjQ20,1065
27
- ccoding-0.2.4.dist-info/RECORD,,
23
+ ccoding-0.2.5.dist-info/METADATA,sha256=PWwqzB2rUxumiWgS5FPjyvAkR2BkOFiXlLEaZE_TgDc,19551
24
+ ccoding-0.2.5.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
25
+ ccoding-0.2.5.dist-info/entry_points.txt,sha256=uxtngaM0Eazhs4dCpcQvAIVdQBRLJ_6u-BpN3pYaGrQ,125
26
+ ccoding-0.2.5.dist-info/licenses/LICENSE,sha256=ghzeEUUCG5lu2DDgFe37bgLJk_0_Y6v-ulXwmYWjQ20,1065
27
+ ccoding-0.2.5.dist-info/RECORD,,