LiveSync 0.3.3__tar.gz → 0.3.4__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.
- {LiveSync-0.3.3 → LiveSync-0.3.4/LiveSync.egg-info}/PKG-INFO +4 -1
- {LiveSync-0.3.3/LiveSync.egg-info → LiveSync-0.3.4}/PKG-INFO +4 -1
- {LiveSync-0.3.3 → LiveSync-0.3.4}/README.md +3 -0
- {LiveSync-0.3.3 → LiveSync-0.3.4}/livesync/livesync.py +2 -1
- {LiveSync-0.3.3 → LiveSync-0.3.4}/livesync/sync.py +17 -14
- {LiveSync-0.3.3 → LiveSync-0.3.4}/LICENSE +0 -0
- {LiveSync-0.3.3 → LiveSync-0.3.4}/LiveSync.egg-info/SOURCES.txt +0 -0
- {LiveSync-0.3.3 → LiveSync-0.3.4}/LiveSync.egg-info/dependency_links.txt +0 -0
- {LiveSync-0.3.3 → LiveSync-0.3.4}/LiveSync.egg-info/entry_points.txt +0 -0
- {LiveSync-0.3.3 → LiveSync-0.3.4}/LiveSync.egg-info/requires.txt +0 -0
- {LiveSync-0.3.3 → LiveSync-0.3.4}/LiveSync.egg-info/top_level.txt +0 -0
- {LiveSync-0.3.3 → LiveSync-0.3.4}/livesync/__init__.py +0 -0
- {LiveSync-0.3.3 → LiveSync-0.3.4}/livesync/folder.py +0 -0
- {LiveSync-0.3.3 → LiveSync-0.3.4}/livesync/mutex.py +0 -0
- {LiveSync-0.3.3 → LiveSync-0.3.4}/livesync/run_subprocess.py +0 -0
- {LiveSync-0.3.3 → LiveSync-0.3.4}/setup.cfg +0 -0
- {LiveSync-0.3.3 → LiveSync-0.3.4}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: LiveSync
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: Repeatedly synchronize local workspace with a (slow) remote machine
|
|
5
5
|
Home-page: https://github.com/zauberzeug/livesync
|
|
6
6
|
Author: Zauberzeug GmbH
|
|
@@ -62,6 +62,8 @@ Options:
|
|
|
62
62
|
interval in which mutex is updated (default: 10 seconds)
|
|
63
63
|
- `--ignore-mutex`
|
|
64
64
|
ignore mutex (use with caution) (default: False)
|
|
65
|
+
- `--no-watch`
|
|
66
|
+
don't keep watching the copied folders for changes after the sync (default: False)
|
|
65
67
|
|
|
66
68
|
### Python
|
|
67
69
|
|
|
@@ -77,6 +79,7 @@ sync(
|
|
|
77
79
|
```
|
|
78
80
|
|
|
79
81
|
The `sync` call will block until the script is aborted.
|
|
82
|
+
Only if `watch=False` is used, the `sync` call will end after copying the folders to the target once.
|
|
80
83
|
The `Folder` class allows to set the `port` and an `on_change` bash command which is executed after a sync has been performed.
|
|
81
84
|
Via the `rsync_args` build method you can pass additional options to configure rsync.
|
|
82
85
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: LiveSync
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: Repeatedly synchronize local workspace with a (slow) remote machine
|
|
5
5
|
Home-page: https://github.com/zauberzeug/livesync
|
|
6
6
|
Author: Zauberzeug GmbH
|
|
@@ -62,6 +62,8 @@ Options:
|
|
|
62
62
|
interval in which mutex is updated (default: 10 seconds)
|
|
63
63
|
- `--ignore-mutex`
|
|
64
64
|
ignore mutex (use with caution) (default: False)
|
|
65
|
+
- `--no-watch`
|
|
66
|
+
don't keep watching the copied folders for changes after the sync (default: False)
|
|
65
67
|
|
|
66
68
|
### Python
|
|
67
69
|
|
|
@@ -77,6 +79,7 @@ sync(
|
|
|
77
79
|
```
|
|
78
80
|
|
|
79
81
|
The `sync` call will block until the script is aborted.
|
|
82
|
+
Only if `watch=False` is used, the `sync` call will end after copying the folders to the target once.
|
|
80
83
|
The `Folder` class allows to set the `port` and an `on_change` bash command which is executed after a sync has been performed.
|
|
81
84
|
Via the `rsync_args` build method you can pass additional options to configure rsync.
|
|
82
85
|
|
|
@@ -49,6 +49,8 @@ Options:
|
|
|
49
49
|
interval in which mutex is updated (default: 10 seconds)
|
|
50
50
|
- `--ignore-mutex`
|
|
51
51
|
ignore mutex (use with caution) (default: False)
|
|
52
|
+
- `--no-watch`
|
|
53
|
+
don't keep watching the copied folders for changes after the sync (default: False)
|
|
52
54
|
|
|
53
55
|
### Python
|
|
54
56
|
|
|
@@ -64,6 +66,7 @@ sync(
|
|
|
64
66
|
```
|
|
65
67
|
|
|
66
68
|
The `sync` call will block until the script is aborted.
|
|
69
|
+
Only if `watch=False` is used, the `sync` call will end after copying the folders to the target once.
|
|
67
70
|
The `Folder` class allows to set the `port` and an `on_change` bash command which is executed after a sync has been performed.
|
|
68
71
|
Via the `rsync_args` build method you can pass additional options to configure rsync.
|
|
69
72
|
|
|
@@ -14,12 +14,13 @@ def main():
|
|
|
14
14
|
parser.add_argument('--on-change', type=str, help='command to be executed on remote host after any file change')
|
|
15
15
|
parser.add_argument('--mutex-interval', type=int, default=10, help='interval in which mutex is updated')
|
|
16
16
|
parser.add_argument('--ignore-mutex', action='store_true', help='ignore mutex (use with caution)')
|
|
17
|
+
parser.add_argument('--no-watch', action='store_true', help='do not watch for changes')
|
|
17
18
|
parser.add_argument('rsync_args', nargs=argparse.REMAINDER, help='arbitrary rsync parameters after "--"')
|
|
18
19
|
args = parser.parse_args()
|
|
19
20
|
|
|
20
21
|
folder = Folder(args.source, args.target, ssh_port=args.ssh_port, on_change=args.on_change)
|
|
21
22
|
folder.rsync_args(' '.join(args.rsync_args))
|
|
22
|
-
sync(folder, mutex_interval=args.mutex_interval, ignore_mutex=args.ignore_mutex)
|
|
23
|
+
sync(folder, mutex_interval=args.mutex_interval, ignore_mutex=args.ignore_mutex, watch=not args.no_watch)
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
if __name__ == '__main__':
|
|
@@ -10,7 +10,9 @@ def get_summary(folders: Iterable[Folder]) -> str:
|
|
|
10
10
|
return '\n'.join(folder.get_summary() for folder in folders).replace('"', '\'')
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
async def run_folder_tasks(
|
|
13
|
+
async def run_folder_tasks(
|
|
14
|
+
folders: Iterable[Folder],
|
|
15
|
+
mutex_interval: float, ignore_mutex: bool = False, watch: bool = True) -> None:
|
|
14
16
|
try:
|
|
15
17
|
if not ignore_mutex:
|
|
16
18
|
summary = get_summary(folders)
|
|
@@ -25,23 +27,24 @@ async def run_folder_tasks(folders: Iterable[Folder], mutex_interval: float, ign
|
|
|
25
27
|
print(f' {folder.source_path} --> {folder.target}', flush=True)
|
|
26
28
|
folder.sync()
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
if watch:
|
|
31
|
+
for folder in folders:
|
|
32
|
+
print(f'Watch folder {folder.source_path}', flush=True)
|
|
33
|
+
asyncio.create_task(folder.watch())
|
|
34
|
+
|
|
35
|
+
while True:
|
|
36
|
+
if not ignore_mutex:
|
|
37
|
+
summary = get_summary(folders)
|
|
38
|
+
for mutex in mutexes.values():
|
|
39
|
+
if not mutex.set(summary):
|
|
40
|
+
break
|
|
41
|
+
await asyncio.sleep(mutex_interval)
|
|
39
42
|
except Exception as e:
|
|
40
43
|
print(e)
|
|
41
44
|
|
|
42
45
|
|
|
43
|
-
def sync(*folders: Folder, mutex_interval: float = 10, ignore_mutex: bool = False) -> None:
|
|
46
|
+
def sync(*folders: Folder, mutex_interval: float = 10, ignore_mutex: bool = False, watch: bool = True) -> None:
|
|
44
47
|
try:
|
|
45
|
-
asyncio.run(run_folder_tasks(folders, mutex_interval, ignore_mutex=ignore_mutex))
|
|
48
|
+
asyncio.run(run_folder_tasks(folders, mutex_interval, ignore_mutex=ignore_mutex, watch=watch))
|
|
46
49
|
except KeyboardInterrupt:
|
|
47
50
|
print('Bye!')
|
|
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
|