datakit-data 0.7.1__tar.gz → 0.7.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.
- {datakit_data-0.7.1 → datakit_data-0.7.2}/PKG-INFO +1 -1
- {datakit_data-0.7.1 → datakit_data-0.7.2}/datakit_data/__init__.py +1 -1
- {datakit_data-0.7.1 → datakit_data-0.7.2}/datakit_data/commands/status.py +24 -0
- {datakit_data-0.7.1 → datakit_data-0.7.2}/pyproject.toml +1 -1
- {datakit_data-0.7.1 → datakit_data-0.7.2}/datakit_data/commands/__init__.py +0 -0
- {datakit_data-0.7.1 → datakit_data-0.7.2}/datakit_data/commands/init.py +0 -0
- {datakit_data-0.7.1 → datakit_data-0.7.2}/datakit_data/commands/pull.py +0 -0
- {datakit_data-0.7.1 → datakit_data-0.7.2}/datakit_data/commands/push.py +0 -0
- {datakit_data-0.7.1 → datakit_data-0.7.2}/datakit_data/extra_flags.py +0 -0
- {datakit_data-0.7.1 → datakit_data-0.7.2}/datakit_data/project_mixin.py +0 -0
- {datakit_data-0.7.1 → datakit_data-0.7.2}/datakit_data/s3.py +0 -0
- {datakit_data-0.7.1 → datakit_data-0.7.2}/datakit_data/sync_markers.py +0 -0
|
@@ -8,6 +8,7 @@ from ..project_mixin import ProjectMixin
|
|
|
8
8
|
from ..s3 import S3, list_local_files
|
|
9
9
|
from ..sync_markers import SyncMarkers
|
|
10
10
|
|
|
11
|
+
|
|
11
12
|
class Status(ProjectMixin, CommandHelpers, Command):
|
|
12
13
|
|
|
13
14
|
"Show sync status of local data files"
|
|
@@ -50,6 +51,7 @@ class Status(ProjectMixin, CommandHelpers, Command):
|
|
|
50
51
|
configs = read_json(self.project_config_path)
|
|
51
52
|
configs['sync_status_location'] = '.sync_status/'
|
|
52
53
|
write_json(self.project_config_path, configs)
|
|
54
|
+
self._add_to_gitignore('.sync_status/')
|
|
53
55
|
self.log.info("Added sync_status_location to config/datakit-data.json")
|
|
54
56
|
return
|
|
55
57
|
missing, stale = self._find_unsynced('data/', markers)
|
|
@@ -57,6 +59,28 @@ class Status(ProjectMixin, CommandHelpers, Command):
|
|
|
57
59
|
self._log_group("file(s) missing a .synced file", missing, parsed_args.filepaths)
|
|
58
60
|
self._log_group("file(s) modified since last sync", stale, parsed_args.filepaths)
|
|
59
61
|
|
|
62
|
+
def _add_to_gitignore(self, directory):
|
|
63
|
+
gitignore_path = '.gitignore'
|
|
64
|
+
try:
|
|
65
|
+
with open(gitignore_path, encoding='utf-8') as gitignore:
|
|
66
|
+
contents = gitignore.read()
|
|
67
|
+
except FileNotFoundError:
|
|
68
|
+
contents = ''
|
|
69
|
+
|
|
70
|
+
entry = f"{directory.rstrip('/')}/"
|
|
71
|
+
existing_entries = {
|
|
72
|
+
line.strip().rstrip('/')
|
|
73
|
+
for line in contents.splitlines()
|
|
74
|
+
if line.strip() and not line.lstrip().startswith('#')
|
|
75
|
+
}
|
|
76
|
+
if entry.rstrip('/') in existing_entries:
|
|
77
|
+
return
|
|
78
|
+
|
|
79
|
+
with open(gitignore_path, 'a', encoding='utf-8') as gitignore:
|
|
80
|
+
if contents and not contents.endswith('\n'):
|
|
81
|
+
gitignore.write('\n')
|
|
82
|
+
gitignore.write(f'{entry}\n')
|
|
83
|
+
|
|
60
84
|
def _report_s3_comparison(self, sync_status_dir, filepaths):
|
|
61
85
|
bucket = self.project_configs['s3_bucket']
|
|
62
86
|
if bucket == "":
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|