cubething_psync 0.1.0.dev10__tar.gz → 0.2.0__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.0}/PKG-INFO +1 -1
  2. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.0}/pyproject.toml +1 -1
  3. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.0}/src/client/args.py +4 -4
  4. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.0}/src/client/main.py +4 -4
  5. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.0/src/cubething_psync.egg-info}/PKG-INFO +1 -1
  6. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.0}/src/server/main.py +6 -1
  7. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.0}/LICENSE +0 -0
  8. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.0}/README.md +0 -0
  9. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.0}/setup.cfg +0 -0
  10. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.0}/src/client/__init__.py +0 -0
  11. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.0}/src/client/__main__.py +0 -0
  12. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.0}/src/common/__init__.py +0 -0
  13. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.0}/src/common/data.py +0 -0
  14. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.0}/src/common/log.py +0 -0
  15. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.0}/src/cubething_psync.egg-info/SOURCES.txt +0 -0
  16. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.0}/src/cubething_psync.egg-info/dependency_links.txt +0 -0
  17. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.0}/src/cubething_psync.egg-info/entry_points.txt +0 -0
  18. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.0}/src/cubething_psync.egg-info/requires.txt +0 -0
  19. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.0}/src/cubething_psync.egg-info/top_level.txt +0 -0
  20. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.0}/src/server/__init__.py +0 -0
  21. {cubething_psync-0.1.0.dev10 → cubething_psync-0.2.0}/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.0
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.0"
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
 
@@ -62,7 +62,7 @@ class PsyncClient:
62
62
  PSYNC_SSH_PORT: The server instance's SSH port.
63
63
  Default: 5001
64
64
  PSYNC_SSH_USER: The server instance's SSH user.
65
- Default: Unset. Will use the default ssh user.
65
+ Default: psync
66
66
  PSYNC_CERT_PATH: Path to the SSL certificate. Used to trust self-signed certs. Should
67
67
  match the server's certificate.
68
68
  Default: ~/.local/share/psync/cert.pem
@@ -142,14 +142,14 @@ class PsyncClient:
142
142
 
143
143
  def __rsync(project_hash: str, args: Args):
144
144
  """Runs rsync."""
145
- user = f"{USER}@" if USER != "" else ""
146
- url = f"{user}{SERVER_IP}:{SERVER_DEST}/{project_hash}/"
145
+ url = f"{SERVER_IP}:{SERVER_DEST}/{project_hash}/"
147
146
  rsync_args = [
148
147
  "rsync",
149
148
  "-avzr",
149
+ "-e",
150
+ f"/usr/bin/ssh -l {USER} -p {str(SERVER_SSH_PORT)}",
150
151
  "--progress",
151
152
  "--mkpath",
152
- f"--port={str(SERVER_SSH_PORT)}",
153
153
  args.target_path,
154
154
  *args.extra,
155
155
  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.0
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(