backupchan-cli 0.2.0__tar.gz → 0.2.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.
- {backupchan_cli-0.2.0 → backupchan_cli-0.2.2}/CHANGELOG.md +8 -0
- {backupchan_cli-0.2.0/backupchan_cli.egg-info → backupchan_cli-0.2.2}/PKG-INFO +4 -5
- {backupchan_cli-0.2.0 → backupchan_cli-0.2.2}/backupchan_cli/commands/backup.py +6 -20
- {backupchan_cli-0.2.0 → backupchan_cli-0.2.2}/backupchan_cli/commands/config.py +1 -1
- {backupchan_cli-0.2.0 → backupchan_cli-0.2.2}/backupchan_cli/main.py +1 -1
- {backupchan_cli-0.2.0 → backupchan_cli-0.2.2/backupchan_cli.egg-info}/PKG-INFO +4 -5
- {backupchan_cli-0.2.0 → backupchan_cli-0.2.2}/backupchan_cli.egg-info/SOURCES.txt +0 -1
- backupchan_cli-0.2.2/backupchan_cli.egg-info/requires.txt +2 -0
- {backupchan_cli-0.2.0 → backupchan_cli-0.2.2}/pyproject.toml +4 -5
- backupchan_cli-0.2.0/backupchan_cli/config.py +0 -72
- backupchan_cli-0.2.0/backupchan_cli.egg-info/requires.txt +0 -3
- {backupchan_cli-0.2.0 → backupchan_cli-0.2.2}/.gitignore +0 -0
- {backupchan_cli-0.2.0 → backupchan_cli-0.2.2}/LICENSE +0 -0
- {backupchan_cli-0.2.0 → backupchan_cli-0.2.2}/README.md +0 -0
- {backupchan_cli-0.2.0 → backupchan_cli-0.2.2}/backupchan_cli/__init__.py +0 -0
- {backupchan_cli-0.2.0 → backupchan_cli-0.2.2}/backupchan_cli/commands/log.py +0 -0
- {backupchan_cli-0.2.0 → backupchan_cli-0.2.2}/backupchan_cli/commands/recyclebin.py +0 -0
- {backupchan_cli-0.2.0 → backupchan_cli-0.2.2}/backupchan_cli/commands/stats.py +0 -0
- {backupchan_cli-0.2.0 → backupchan_cli-0.2.2}/backupchan_cli/commands/target.py +0 -0
- {backupchan_cli-0.2.0 → backupchan_cli-0.2.2}/backupchan_cli/utility.py +0 -0
- {backupchan_cli-0.2.0 → backupchan_cli-0.2.2}/backupchan_cli.egg-info/dependency_links.txt +0 -0
- {backupchan_cli-0.2.0 → backupchan_cli-0.2.2}/backupchan_cli.egg-info/entry_points.txt +0 -0
- {backupchan_cli-0.2.0 → backupchan_cli-0.2.2}/backupchan_cli.egg-info/top_level.txt +0 -0
- {backupchan_cli-0.2.0 → backupchan_cli-0.2.2}/cli.py +0 -0
- {backupchan_cli-0.2.0 → backupchan_cli-0.2.2}/setup.cfg +0 -0
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
See what's changed between versions!
|
|
4
4
|
|
|
5
|
+
## 0.2.2
|
|
6
|
+
|
|
7
|
+
* Refactored to use the API's new directory upload function.
|
|
8
|
+
|
|
9
|
+
## 0.2.1
|
|
10
|
+
|
|
11
|
+
* Refactored to use the [client connection configuration library](https://github.com/Backupchan/client-config).
|
|
12
|
+
|
|
5
13
|
## 0.2.0
|
|
6
14
|
|
|
7
15
|
* Added command to view stats.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: backupchan-cli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Command-line interface for interacting with Backup-chan.
|
|
5
5
|
Author-email: Moltony <koronavirusnyj@gmail.com>
|
|
6
6
|
License: BSD-3-Clause
|
|
@@ -8,7 +8,7 @@ Project-URL: Homepage, https://github.com/Backupchan/cli
|
|
|
8
8
|
Project-URL: Repository, https://github.com/Backupchan/cli.git
|
|
9
9
|
Project-URL: Issues, https://github.com/Backupchan/cli/issues
|
|
10
10
|
Project-URL: Changelog, https://github.com/Backupchan/cli/blob/main/CHANGELOG.md
|
|
11
|
-
Classifier: Development Status ::
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
12
|
Classifier: Environment :: Console
|
|
13
13
|
Classifier: License :: OSI Approved :: BSD License
|
|
14
14
|
Classifier: Natural Language :: English
|
|
@@ -18,9 +18,8 @@ Classifier: Topic :: System :: Archiving :: Backup
|
|
|
18
18
|
Classifier: Typing :: Typed
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE
|
|
21
|
-
Requires-Dist: backupchan-client-lib>=0.
|
|
22
|
-
Requires-Dist:
|
|
23
|
-
Requires-Dist: platformdirs
|
|
21
|
+
Requires-Dist: backupchan-client-lib>=0.3.0
|
|
22
|
+
Requires-Dist: backupchan-client-config>=0.1.0
|
|
24
23
|
Dynamic: license-file
|
|
25
24
|
|
|
26
25
|
# Backup-chan CLI
|
|
@@ -70,26 +70,12 @@ def setup_subcommands(subparser):
|
|
|
70
70
|
|
|
71
71
|
def do_upload(args, _, api: API):
|
|
72
72
|
if os.path.isdir(args.filename):
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
utility.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
temp_dir = tempfile.gettempdir()
|
|
80
|
-
temp_tar_path = os.path.join(temp_dir, f"bakch-{uuid.uuid4().hex}.tar.gz")
|
|
81
|
-
with tarfile.open(temp_tar_path, "w:gz") as tar:
|
|
82
|
-
tar.add(args.filename, arcname=os.path.basename(args.filename))
|
|
83
|
-
|
|
84
|
-
# Upload our new tar.
|
|
85
|
-
with open(temp_tar_path, "rb") as tar:
|
|
86
|
-
try:
|
|
87
|
-
api.upload_backup(args.target_id, tar, os.path.basename(args.filename) + ".tar.gz", not args.automatic)
|
|
88
|
-
except requests.exceptions.ConnectionError:
|
|
89
|
-
utility.failure_network()
|
|
90
|
-
except BackupchanAPIError as exc:
|
|
91
|
-
utility.failure(f"Failed to upload backup: {str(exc)}")
|
|
92
|
-
|
|
73
|
+
try:
|
|
74
|
+
api.upload_backup_folder(args.target_id, args.filename, not args.automatic)
|
|
75
|
+
except requests.exceptions.ConnectionError:
|
|
76
|
+
utility.failure_network()
|
|
77
|
+
except BackupchanAPIError as exc:
|
|
78
|
+
utility.failure(f"Failed to upload backup: {str(exc)}")
|
|
93
79
|
else:
|
|
94
80
|
with open(args.filename, "rb") as file:
|
|
95
81
|
try:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from .commands import config, target, backup, log, recyclebin, stats
|
|
2
|
-
from .config import Config, ConfigException
|
|
3
2
|
from .utility import failure, NO_CONFIG_MESSAGE
|
|
3
|
+
from backupchan_config import Config, ConfigException
|
|
4
4
|
from backupchan import API
|
|
5
5
|
import argparse
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: backupchan-cli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Command-line interface for interacting with Backup-chan.
|
|
5
5
|
Author-email: Moltony <koronavirusnyj@gmail.com>
|
|
6
6
|
License: BSD-3-Clause
|
|
@@ -8,7 +8,7 @@ Project-URL: Homepage, https://github.com/Backupchan/cli
|
|
|
8
8
|
Project-URL: Repository, https://github.com/Backupchan/cli.git
|
|
9
9
|
Project-URL: Issues, https://github.com/Backupchan/cli/issues
|
|
10
10
|
Project-URL: Changelog, https://github.com/Backupchan/cli/blob/main/CHANGELOG.md
|
|
11
|
-
Classifier: Development Status ::
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
12
|
Classifier: Environment :: Console
|
|
13
13
|
Classifier: License :: OSI Approved :: BSD License
|
|
14
14
|
Classifier: Natural Language :: English
|
|
@@ -18,9 +18,8 @@ Classifier: Topic :: System :: Archiving :: Backup
|
|
|
18
18
|
Classifier: Typing :: Typed
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE
|
|
21
|
-
Requires-Dist: backupchan-client-lib>=0.
|
|
22
|
-
Requires-Dist:
|
|
23
|
-
Requires-Dist: platformdirs
|
|
21
|
+
Requires-Dist: backupchan-client-lib>=0.3.0
|
|
22
|
+
Requires-Dist: backupchan-client-config>=0.1.0
|
|
24
23
|
Dynamic: license-file
|
|
25
24
|
|
|
26
25
|
# Backup-chan CLI
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "backupchan-cli"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.2"
|
|
4
4
|
description = "Command-line interface for interacting with Backup-chan."
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "Moltony", email = "koronavirusnyj@gmail.com" }
|
|
7
7
|
]
|
|
8
8
|
dependencies = [
|
|
9
|
-
"backupchan-client-lib>=0.
|
|
10
|
-
"
|
|
11
|
-
"platformdirs"
|
|
9
|
+
"backupchan-client-lib>=0.3.0",
|
|
10
|
+
"backupchan-client-config>=0.1.0"
|
|
12
11
|
]
|
|
13
12
|
|
|
14
13
|
readme = "README.md"
|
|
15
14
|
license = {text = "BSD-3-Clause"}
|
|
16
15
|
|
|
17
16
|
classifiers = [
|
|
18
|
-
"Development Status ::
|
|
17
|
+
"Development Status :: 5 - Production/Stable",
|
|
19
18
|
"Environment :: Console",
|
|
20
19
|
"License :: OSI Approved :: BSD License",
|
|
21
20
|
"Natural Language :: English",
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import json
|
|
2
|
-
import sys
|
|
3
|
-
import platformdirs
|
|
4
|
-
import keyring
|
|
5
|
-
import os
|
|
6
|
-
from pathlib import Path
|
|
7
|
-
|
|
8
|
-
class ConfigException(Exception):
|
|
9
|
-
pass
|
|
10
|
-
|
|
11
|
-
CONFIG_FILE_DIR = platformdirs.user_config_dir('backupchan')
|
|
12
|
-
CONFIG_FILE_PATH = f"{CONFIG_FILE_DIR}/config.json"
|
|
13
|
-
|
|
14
|
-
class Config:
|
|
15
|
-
def __init__(self):
|
|
16
|
-
self.port: int | None = None
|
|
17
|
-
self.host: str | None = None
|
|
18
|
-
self.api_key: str | None = None
|
|
19
|
-
|
|
20
|
-
def read_config(self):
|
|
21
|
-
if not os.path.exists(CONFIG_FILE_PATH):
|
|
22
|
-
raise ConfigException("Config file not found")
|
|
23
|
-
|
|
24
|
-
with open(CONFIG_FILE_PATH, "r") as config_file:
|
|
25
|
-
self.parse_config(config_file.read())
|
|
26
|
-
self.retrieve_api_key()
|
|
27
|
-
|
|
28
|
-
def reset(self, write: bool = False):
|
|
29
|
-
self.port = None
|
|
30
|
-
self.host = None
|
|
31
|
-
self.api_key = None
|
|
32
|
-
|
|
33
|
-
if write:
|
|
34
|
-
self.delete_api_key()
|
|
35
|
-
if os.path.exists(CONFIG_FILE_PATH):
|
|
36
|
-
os.remove(CONFIG_FILE_PATH)
|
|
37
|
-
|
|
38
|
-
def is_incomplete(self):
|
|
39
|
-
return self.port is None or self.host is None or self.api_key is None
|
|
40
|
-
|
|
41
|
-
def parse_config(self, config: str):
|
|
42
|
-
config_json = json.loads(config)
|
|
43
|
-
self.port = config_json["port"]
|
|
44
|
-
self.host = config_json["host"]
|
|
45
|
-
|
|
46
|
-
def retrieve_api_key(self):
|
|
47
|
-
self.api_key = keyring.get_password("backupchan", "api_key")
|
|
48
|
-
|
|
49
|
-
def save_config(self):
|
|
50
|
-
if self.is_incomplete():
|
|
51
|
-
raise ConfigException("Cannot save incomplete config")
|
|
52
|
-
|
|
53
|
-
Path(CONFIG_FILE_DIR).mkdir(exist_ok=True, parents=True)
|
|
54
|
-
|
|
55
|
-
config_dict = {
|
|
56
|
-
"host": self.host,
|
|
57
|
-
"port": self.port
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
with open(CONFIG_FILE_PATH, "w") as config_file:
|
|
61
|
-
json.dump(config_dict, config_file)
|
|
62
|
-
|
|
63
|
-
self.save_api_key()
|
|
64
|
-
|
|
65
|
-
def delete_api_key(self):
|
|
66
|
-
try:
|
|
67
|
-
keyring.delete_password("backupchan", "api_key")
|
|
68
|
-
except keyring.errors.PasswordDeleteError:
|
|
69
|
-
pass
|
|
70
|
-
|
|
71
|
-
def save_api_key(self):
|
|
72
|
-
keyring.set_password("backupchan", "api_key", self.api_key)
|
|
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
|