cubething_psync 0.1.0.dev10__tar.gz → 0.2.1__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 (21) hide show
  1. {cubething_psync-0.1.0.dev10/src/cubething_psync.egg-info → cubething_psync-0.2.1}/PKG-INFO +1 -1
  2. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.1}/pyproject.toml +1 -1
  3. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.1}/src/client/args.py +4 -4
  4. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.1}/src/client/main.py +5 -11
  5. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.1/src/cubething_psync.egg-info}/PKG-INFO +1 -1
  6. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.1}/src/server/main.py +6 -1
  7. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.1}/LICENSE +0 -0
  8. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.1}/README.md +0 -0
  9. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.1}/setup.cfg +0 -0
  10. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.1}/src/client/__init__.py +0 -0
  11. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.1}/src/client/__main__.py +0 -0
  12. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.1}/src/common/__init__.py +0 -0
  13. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.1}/src/common/data.py +0 -0
  14. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.1}/src/common/log.py +0 -0
  15. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.1}/src/cubething_psync.egg-info/SOURCES.txt +0 -0
  16. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.1}/src/cubething_psync.egg-info/dependency_links.txt +0 -0
  17. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.1}/src/cubething_psync.egg-info/entry_points.txt +0 -0
  18. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.1}/src/cubething_psync.egg-info/requires.txt +0 -0
  19. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.1}/src/cubething_psync.egg-info/top_level.txt +0 -0
  20. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.1}/src/server/__init__.py +0 -0
  21. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.1}/src/server/__main__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cubething_psync
3
- Version: 0.1.0.dev10
3
+ Version: 0.2.1
4
4
  Summary: Simple project synchronization tool.
5
5
  Author-email: ada mandala <ada@cubething.dev>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "cubething_psync"
3
- version = "0.1.0.dev10"
3
+ version = "0.2.1"
4
4
  description = "Simple project synchronization tool."
5
5
  authors = [{name = "ada mandala", email="ada@cubething.dev"}]
6
6
  readme = "README.md"
@@ -28,8 +28,8 @@ Variable | Default
28
28
  PSYNC_SERVER_IP | 127.0.0.1
29
29
  PSYNC_SERVER_PORT | 5000
30
30
  PSYNC_SSH_PORT | 5022
31
- PSYNC_SERVER_DEST | /app/rsync/
32
- PSYNC_SSH_USER | root
31
+ PSYNC_SERVER_DEST | /home/psync/
32
+ PSYNC_SSH_USER | psync
33
33
  PSYNC_CERT_PATH | ~/.local/share/psync/cert.pem
34
34
  """,
35
35
  )
@@ -57,8 +57,8 @@ _action = parser.add_argument(
57
57
  SERVER_IP: str = os.environ.get("PSYNC_SERVER_IP", "127.0.0.1")
58
58
  SERVER_PORT: int = int(os.environ.get("PSYNC_SERVER_PORT", "5000"))
59
59
  SERVER_SSH_PORT: int = int(os.environ.get("PSYNC_SSH_PORT", "5022"))
60
- SERVER_DEST: str = os.environ.get("PSYNC_SERVER_DEST", "/app/rsync")
61
- USER: str = os.environ.get("PSYNC_SSH_USER", "")
60
+ SERVER_DEST: str = os.environ.get("PSYNC_SERVER_DEST", "/home/psync")
61
+ USER: str = os.environ.get("PSYNC_SSH_USER", "psync")
62
62
  SSL_CERT_PATH: str = os.environ.get("PSYNC_CERT_PATH", "~/.local/share/psync/cert.pem")
63
63
 
64
64
 
@@ -40,12 +40,6 @@ class PsyncClient:
40
40
  rsync, then execute them remotely while receiving the logs.
41
41
 
42
42
  CLI arguments: ::
43
-
44
- usage: psync-client [-h] --path PATH [--extra EXTRA [EXTRA ...]] [--env ENV] [--args ARGS]
45
-
46
- Client for the psync server.
47
-
48
- options:
49
43
  -h, --help show this help message and exit
50
44
  --path, -p PATH Path to the target exectuable.
51
45
  --extra, -E EXTRA [EXTRA ...]
@@ -60,9 +54,9 @@ class PsyncClient:
60
54
  PSYNC_SERVER_PORT: The port of the server instance.
61
55
  Default: 5000
62
56
  PSYNC_SSH_PORT: The server instance's SSH port.
63
- Default: 5001
57
+ Default: 5022
64
58
  PSYNC_SSH_USER: The server instance's SSH user.
65
- Default: Unset. Will use the default ssh user.
59
+ Default: psync
66
60
  PSYNC_CERT_PATH: Path to the SSL certificate. Used to trust self-signed certs. Should
67
61
  match the server's certificate.
68
62
  Default: ~/.local/share/psync/cert.pem
@@ -142,14 +136,14 @@ class PsyncClient:
142
136
 
143
137
  def __rsync(project_hash: str, args: Args):
144
138
  """Runs rsync."""
145
- user = f"{USER}@" if USER != "" else ""
146
- url = f"{user}{SERVER_IP}:{SERVER_DEST}/{project_hash}/"
139
+ url = f"{SERVER_IP}:{SERVER_DEST}/{project_hash}/"
147
140
  rsync_args = [
148
141
  "rsync",
149
142
  "-avzr",
143
+ "-e",
144
+ f"/usr/bin/ssh -l {USER} -p {str(SERVER_SSH_PORT)}",
150
145
  "--progress",
151
146
  "--mkpath",
152
- f"--port={str(SERVER_SSH_PORT)}",
153
147
  args.target_path,
154
148
  *args.extra,
155
149
  url,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cubething_psync
3
- Version: 0.1.0.dev10
3
+ Version: 0.2.1
4
4
  Summary: Simple project synchronization tool.
5
5
  Author-email: ada mandala <ada@cubething.dev>
6
6
  License-Expression: MIT
@@ -6,6 +6,8 @@ import asyncio
6
6
  from asyncio.subprocess import Process
7
7
  from asyncio.tasks import Task
8
8
  from collections.abc import Awaitable
9
+ import functools
10
+ import operator
9
11
  from os import environ
10
12
  from os.path import basename
11
13
  import pathlib
@@ -187,8 +189,11 @@ class PsyncServer:
187
189
  path = pathlib.Path.expanduser(req.path).resolve()
188
190
  args = [str(path), *req.args]
189
191
  env = {"PYTHONUNBUFFERED": "1", **req.env}
192
+ reduced: str = functools.reduce(
193
+ operator.add, map(lambda x: (f"{x[0]}={x[1]}"), env.items())
194
+ )
190
195
  logging.info(
191
- f"Running `{map(lambda x: (f'{x[0]}={x[1]}'), env.items())} [...]/{basename(args[0])} {' '.join(args[1:])}`"
196
+ f"Running `{reduced} [...]/{basename(args[0])} {' '.join(args[1:])}`"
192
197
  )
193
198
  try:
194
199
  p = await asyncio.create_subprocess_exec(