github-backup 0.44.0__tar.gz → 0.45.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.
@@ -1,10 +1,311 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
- 0.44.0 (2023-12-09)
4
+ 0.45.0 (2024-01-29)
5
5
  -------------------
6
6
  ------------------------
7
7
 
8
+ Fix
9
+ ~~~
10
+ - Catch 404s for non-existing hooks. Fixes #176. [Moritz Federspiel]
11
+ - Ensure wheel is installed. [Jose Diaz-Gonzalez]
12
+
13
+ Other
14
+ ~~~~~
15
+ - Fix code style. [BrOleg5]
16
+ - Add option to skip prerelease versions. [BrOleg5]
17
+
18
+ Replace release sorting by tag with release sorting by creation date.
19
+ - Add option to include certain number of the latest releases. [BrOleg5]
20
+ - Auto docker build. [8cH9azbsFifZ]
21
+ - Vs code. [8cH9azbsFifZ]
22
+ - Chore(deps): bump the python-packages group with 6 updates.
23
+ [dependabot[bot]]
24
+
25
+ Bumps the python-packages group with 6 updates:
26
+
27
+ | Package | From | To |
28
+ | --- | --- | --- |
29
+ | [black](https://github.com/psf/black) | `23.11.0` | `24.1.0` |
30
+ | [flake8](https://github.com/pycqa/flake8) | `6.1.0` | `7.0.0` |
31
+ | [importlib-metadata](https://github.com/python/importlib_metadata) | `7.0.0` | `7.0.1` |
32
+ | [more-itertools](https://github.com/more-itertools/more-itertools) | `10.1.0` | `10.2.0` |
33
+ | [pathspec](https://github.com/cpburnz/python-pathspec) | `0.11.2` | `0.12.1` |
34
+ | [pyflakes](https://github.com/PyCQA/pyflakes) | `3.1.0` | `3.2.0` |
35
+
36
+
37
+ Updates `black` from 23.11.0 to 24.1.0
38
+ - [Release notes](https://github.com/psf/black/releases)
39
+ - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
40
+ - [Commits](https://github.com/psf/black/compare/23.11.0...24.1.0)
41
+
42
+ Updates `flake8` from 6.1.0 to 7.0.0
43
+ - [Commits](https://github.com/pycqa/flake8/compare/6.1.0...7.0.0)
44
+
45
+ Updates `importlib-metadata` from 7.0.0 to 7.0.1
46
+ - [Release notes](https://github.com/python/importlib_metadata/releases)
47
+ - [Changelog](https://github.com/python/importlib_metadata/blob/main/NEWS.rst)
48
+ - [Commits](https://github.com/python/importlib_metadata/compare/v7.0.0...v7.0.1)
49
+
50
+ Updates `more-itertools` from 10.1.0 to 10.2.0
51
+ - [Release notes](https://github.com/more-itertools/more-itertools/releases)
52
+ - [Commits](https://github.com/more-itertools/more-itertools/compare/v10.1.0...v10.2.0)
53
+
54
+ Updates `pathspec` from 0.11.2 to 0.12.1
55
+ - [Release notes](https://github.com/cpburnz/python-pathspec/releases)
56
+ - [Changelog](https://github.com/cpburnz/python-pathspec/blob/master/CHANGES.rst)
57
+ - [Commits](https://github.com/cpburnz/python-pathspec/compare/v0.11.2...v0.12.1)
58
+
59
+ Updates `pyflakes` from 3.1.0 to 3.2.0
60
+ - [Changelog](https://github.com/PyCQA/pyflakes/blob/main/NEWS.rst)
61
+ - [Commits](https://github.com/PyCQA/pyflakes/compare/3.1.0...3.2.0)
62
+
63
+ ---
64
+ updated-dependencies:
65
+ - dependency-name: black
66
+ dependency-type: direct:production
67
+ update-type: version-update:semver-major
68
+ dependency-group: python-packages
69
+ - dependency-name: flake8
70
+ dependency-type: direct:production
71
+ update-type: version-update:semver-major
72
+ dependency-group: python-packages
73
+ - dependency-name: importlib-metadata
74
+ dependency-type: direct:production
75
+ update-type: version-update:semver-patch
76
+ dependency-group: python-packages
77
+ - dependency-name: more-itertools
78
+ dependency-type: direct:production
79
+ update-type: version-update:semver-minor
80
+ dependency-group: python-packages
81
+ - dependency-name: pathspec
82
+ dependency-type: direct:production
83
+ update-type: version-update:semver-minor
84
+ dependency-group: python-packages
85
+ - dependency-name: pyflakes
86
+ dependency-type: direct:production
87
+ update-type: version-update:semver-minor
88
+ dependency-group: python-packages
89
+ ...
90
+ - Chore(deps): bump the python-packages group with 15 updates.
91
+ [dependabot[bot]]
92
+
93
+ Bumps the python-packages group with 15 updates:
94
+
95
+ | Package | From | To |
96
+ | --- | --- | --- |
97
+ | [bleach](https://github.com/mozilla/bleach) | `6.0.0` | `6.1.0` |
98
+ | [certifi](https://github.com/certifi/python-certifi) | `2023.7.22` | `2023.11.17` |
99
+ | [charset-normalizer](https://github.com/Ousret/charset_normalizer) | `3.1.0` | `3.3.2` |
100
+ | [idna](https://github.com/kjd/idna) | `3.4` | `3.6` |
101
+ | [importlib-metadata](https://github.com/python/importlib_metadata) | `6.6.0` | `7.0.0` |
102
+ | [jaraco-classes](https://github.com/jaraco/jaraco.classes) | `3.2.3` | `3.3.0` |
103
+ | [keyring](https://github.com/jaraco/keyring) | `23.13.1` | `24.3.0` |
104
+ | [markdown-it-py](https://github.com/executablebooks/markdown-it-py) | `2.2.0` | `3.0.0` |
105
+ | [more-itertools](https://github.com/more-itertools/more-itertools) | `9.1.0` | `10.1.0` |
106
+ | [pygments](https://github.com/pygments/pygments) | `2.15.1` | `2.17.2` |
107
+ | [readme-renderer](https://github.com/pypa/readme_renderer) | `37.3` | `42.0` |
108
+ | [rich](https://github.com/Textualize/rich) | `13.3.5` | `13.7.0` |
109
+ | [tqdm](https://github.com/tqdm/tqdm) | `4.65.0` | `4.66.1` |
110
+ | [urllib3](https://github.com/urllib3/urllib3) | `2.0.7` | `2.1.0` |
111
+ | [zipp](https://github.com/jaraco/zipp) | `3.15.0` | `3.17.0` |
112
+
113
+
114
+ Updates `bleach` from 6.0.0 to 6.1.0
115
+ - [Changelog](https://github.com/mozilla/bleach/blob/main/CHANGES)
116
+ - [Commits](https://github.com/mozilla/bleach/compare/v6.0.0...v6.1.0)
117
+
118
+ Updates `certifi` from 2023.7.22 to 2023.11.17
119
+ - [Commits](https://github.com/certifi/python-certifi/compare/2023.07.22...2023.11.17)
120
+
121
+ Updates `charset-normalizer` from 3.1.0 to 3.3.2
122
+ - [Release notes](https://github.com/Ousret/charset_normalizer/releases)
123
+ - [Changelog](https://github.com/Ousret/charset_normalizer/blob/master/CHANGELOG.md)
124
+ - [Commits](https://github.com/Ousret/charset_normalizer/compare/3.1.0...3.3.2)
125
+
126
+ Updates `idna` from 3.4 to 3.6
127
+ - [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.rst)
128
+ - [Commits](https://github.com/kjd/idna/compare/v3.4...v3.6)
129
+
130
+ Updates `importlib-metadata` from 6.6.0 to 7.0.0
131
+ - [Release notes](https://github.com/python/importlib_metadata/releases)
132
+ - [Changelog](https://github.com/python/importlib_metadata/blob/main/NEWS.rst)
133
+ - [Commits](https://github.com/python/importlib_metadata/compare/v6.6.0...v7.0.0)
134
+
135
+ Updates `jaraco-classes` from 3.2.3 to 3.3.0
136
+ - [Release notes](https://github.com/jaraco/jaraco.classes/releases)
137
+ - [Changelog](https://github.com/jaraco/jaraco.classes/blob/main/NEWS.rst)
138
+ - [Commits](https://github.com/jaraco/jaraco.classes/compare/v3.2.3...v3.3.0)
139
+
140
+ Updates `keyring` from 23.13.1 to 24.3.0
141
+ - [Release notes](https://github.com/jaraco/keyring/releases)
142
+ - [Changelog](https://github.com/jaraco/keyring/blob/main/NEWS.rst)
143
+ - [Commits](https://github.com/jaraco/keyring/compare/v23.13.1...v24.3.0)
144
+
145
+ Updates `markdown-it-py` from 2.2.0 to 3.0.0
146
+ - [Release notes](https://github.com/executablebooks/markdown-it-py/releases)
147
+ - [Changelog](https://github.com/executablebooks/markdown-it-py/blob/master/CHANGELOG.md)
148
+ - [Commits](https://github.com/executablebooks/markdown-it-py/compare/v2.2.0...v3.0.0)
149
+
150
+ Updates `more-itertools` from 9.1.0 to 10.1.0
151
+ - [Release notes](https://github.com/more-itertools/more-itertools/releases)
152
+ - [Commits](https://github.com/more-itertools/more-itertools/compare/v9.1.0...v10.1.0)
153
+
154
+ Updates `pygments` from 2.15.1 to 2.17.2
155
+ - [Release notes](https://github.com/pygments/pygments/releases)
156
+ - [Changelog](https://github.com/pygments/pygments/blob/master/CHANGES)
157
+ - [Commits](https://github.com/pygments/pygments/compare/2.15.1...2.17.2)
158
+
159
+ Updates `readme-renderer` from 37.3 to 42.0
160
+ - [Release notes](https://github.com/pypa/readme_renderer/releases)
161
+ - [Changelog](https://github.com/pypa/readme_renderer/blob/main/CHANGES.rst)
162
+ - [Commits](https://github.com/pypa/readme_renderer/compare/37.3...42.0)
163
+
164
+ Updates `rich` from 13.3.5 to 13.7.0
165
+ - [Release notes](https://github.com/Textualize/rich/releases)
166
+ - [Changelog](https://github.com/Textualize/rich/blob/master/CHANGELOG.md)
167
+ - [Commits](https://github.com/Textualize/rich/compare/v13.3.5...v13.7.0)
168
+
169
+ Updates `tqdm` from 4.65.0 to 4.66.1
170
+ - [Release notes](https://github.com/tqdm/tqdm/releases)
171
+ - [Commits](https://github.com/tqdm/tqdm/compare/v4.65.0...v4.66.1)
172
+
173
+ Updates `urllib3` from 2.0.7 to 2.1.0
174
+ - [Release notes](https://github.com/urllib3/urllib3/releases)
175
+ - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
176
+ - [Commits](https://github.com/urllib3/urllib3/compare/2.0.7...2.1.0)
177
+
178
+ Updates `zipp` from 3.15.0 to 3.17.0
179
+ - [Release notes](https://github.com/jaraco/zipp/releases)
180
+ - [Changelog](https://github.com/jaraco/zipp/blob/main/NEWS.rst)
181
+ - [Commits](https://github.com/jaraco/zipp/compare/v3.15.0...v3.17.0)
182
+
183
+ ---
184
+ updated-dependencies:
185
+ - dependency-name: bleach
186
+ dependency-type: direct:production
187
+ update-type: version-update:semver-minor
188
+ dependency-group: python-packages
189
+ - dependency-name: certifi
190
+ dependency-type: direct:production
191
+ update-type: version-update:semver-minor
192
+ dependency-group: python-packages
193
+ - dependency-name: charset-normalizer
194
+ dependency-type: direct:production
195
+ update-type: version-update:semver-minor
196
+ dependency-group: python-packages
197
+ - dependency-name: idna
198
+ dependency-type: direct:production
199
+ update-type: version-update:semver-minor
200
+ dependency-group: python-packages
201
+ - dependency-name: importlib-metadata
202
+ dependency-type: direct:production
203
+ update-type: version-update:semver-major
204
+ dependency-group: python-packages
205
+ - dependency-name: jaraco-classes
206
+ dependency-type: direct:production
207
+ update-type: version-update:semver-minor
208
+ dependency-group: python-packages
209
+ - dependency-name: keyring
210
+ dependency-type: direct:production
211
+ update-type: version-update:semver-major
212
+ dependency-group: python-packages
213
+ - dependency-name: markdown-it-py
214
+ dependency-type: direct:production
215
+ update-type: version-update:semver-major
216
+ dependency-group: python-packages
217
+ - dependency-name: more-itertools
218
+ dependency-type: direct:production
219
+ update-type: version-update:semver-major
220
+ dependency-group: python-packages
221
+ - dependency-name: pygments
222
+ dependency-type: direct:production
223
+ update-type: version-update:semver-minor
224
+ dependency-group: python-packages
225
+ - dependency-name: readme-renderer
226
+ dependency-type: direct:production
227
+ update-type: version-update:semver-major
228
+ dependency-group: python-packages
229
+ - dependency-name: rich
230
+ dependency-type: direct:production
231
+ update-type: version-update:semver-minor
232
+ dependency-group: python-packages
233
+ - dependency-name: tqdm
234
+ dependency-type: direct:production
235
+ update-type: version-update:semver-minor
236
+ dependency-group: python-packages
237
+ - dependency-name: urllib3
238
+ dependency-type: direct:production
239
+ update-type: version-update:semver-minor
240
+ dependency-group: python-packages
241
+ - dependency-name: zipp
242
+ dependency-type: direct:production
243
+ update-type: version-update:semver-minor
244
+ dependency-group: python-packages
245
+ ...
246
+ - Chore: format python code. [Jose Diaz-Gonzalez]
247
+ - Chore: format yaml. [Jose Diaz-Gonzalez]
248
+ - Chore: update gitignore. [Jose Diaz-Gonzalez]
249
+ - Feat: add dependabot config to repository. [Jose Diaz-Gonzalez]
250
+
251
+
252
+ 0.44.1 (2023-12-09)
253
+ -------------------
254
+
255
+ Fix
256
+ ~~~
257
+ - Use a deploy key to push tags so releases get auto-created. [Jose
258
+ Diaz-Gonzalez]
259
+
260
+ Other
261
+ ~~~~~
262
+ - Chore(deps): bump certifi from 2023.5.7 to 2023.7.22.
263
+ [dependabot[bot]]
264
+
265
+ Bumps [certifi](https://github.com/certifi/python-certifi) from 2023.5.7 to 2023.7.22.
266
+ - [Commits](https://github.com/certifi/python-certifi/compare/2023.05.07...2023.07.22)
267
+
268
+ ---
269
+ updated-dependencies:
270
+ - dependency-name: certifi
271
+ dependency-type: direct:production
272
+ ...
273
+ - Tests: run lint on pull requests. [Jose Diaz-Gonzalez]
274
+ - Chore(deps): bump urllib3 from 2.0.2 to 2.0.7. [dependabot[bot]]
275
+
276
+ Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.0.2 to 2.0.7.
277
+ - [Release notes](https://github.com/urllib3/urllib3/releases)
278
+ - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
279
+ - [Commits](https://github.com/urllib3/urllib3/compare/2.0.2...2.0.7)
280
+
281
+ ---
282
+ updated-dependencies:
283
+ - dependency-name: urllib3
284
+ dependency-type: direct:production
285
+ ...
286
+ - Chore: remove circleci as tests now run in github actions. [Jose Diaz-
287
+ Gonzalez]
288
+ - Tests: install correct dependencies and rename job. [Jose Diaz-
289
+ Gonzalez]
290
+ - Tests: add lint github action workflow. [Jose Diaz-Gonzalez]
291
+ - Feat: install autopep8. [Jose Diaz-Gonzalez]
292
+ - Chore(deps): bump certifi from 2023.5.7 to 2023.7.22.
293
+ [dependabot[bot]]
294
+
295
+ Bumps [certifi](https://github.com/certifi/python-certifi) from 2023.5.7 to 2023.7.22.
296
+ - [Commits](https://github.com/certifi/python-certifi/compare/2023.05.07...2023.07.22)
297
+
298
+ ---
299
+ updated-dependencies:
300
+ - dependency-name: certifi
301
+ dependency-type: direct:production
302
+ ...
303
+ - Chore: reformat file and update flake8. [Jose Diaz-Gonzalez]
304
+
305
+
306
+ 0.44.0 (2023-12-09)
307
+ -------------------
308
+
8
309
  Fix
9
310
  ~~~
10
311
  - Do not use raw property in readme. [Jose Diaz-Gonzalez]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: github-backup
3
- Version: 0.44.0
3
+ Version: 0.45.0
4
4
  Summary: backup a github user or organization
5
5
  Home-page: http://github.com/josegonzalez/python-github-backup
6
6
  Author: Jose Diaz-Gonzalez
@@ -57,7 +57,9 @@ Description: =============
57
57
  [-P] [-F] [--prefer-ssh] [-v]
58
58
  [--keychain-name OSX_KEYCHAIN_ITEM_NAME]
59
59
  [--keychain-account OSX_KEYCHAIN_ITEM_ACCOUNT]
60
- [--releases] [--assets] [--exclude [REPOSITORY [REPOSITORY ...]]
60
+ [--releases] [--latest-releases NUMBER_OF_LATEST_RELEASES]
61
+ [--skip-prerelease] [--assets]
62
+ [--exclude [REPOSITORY [REPOSITORY ...]]
61
63
  [--throttle-limit THROTTLE_LIMIT] [--throttle-pause THROTTLE_PAUSE]
62
64
  USER
63
65
 
@@ -132,6 +134,10 @@ Description: =============
132
134
  keychain that holds the personal access or OAuth token
133
135
  --releases include release information, not including assets or
134
136
  binaries
137
+ --latest-releases NUMBER_OF_LATEST_RELEASES
138
+ include certain number of the latest releases;
139
+ only applies if including releases
140
+ --skip-prerelease skip prerelease and draft versions; only applies if including releases
135
141
  --assets include assets alongside release information; only
136
142
  applies if including releases
137
143
  --exclude [REPOSITORY [REPOSITORY ...]]
@@ -49,7 +49,9 @@ CLI Help output::
49
49
  [-P] [-F] [--prefer-ssh] [-v]
50
50
  [--keychain-name OSX_KEYCHAIN_ITEM_NAME]
51
51
  [--keychain-account OSX_KEYCHAIN_ITEM_ACCOUNT]
52
- [--releases] [--assets] [--exclude [REPOSITORY [REPOSITORY ...]]
52
+ [--releases] [--latest-releases NUMBER_OF_LATEST_RELEASES]
53
+ [--skip-prerelease] [--assets]
54
+ [--exclude [REPOSITORY [REPOSITORY ...]]
53
55
  [--throttle-limit THROTTLE_LIMIT] [--throttle-pause THROTTLE_PAUSE]
54
56
  USER
55
57
 
@@ -124,6 +126,10 @@ CLI Help output::
124
126
  keychain that holds the personal access or OAuth token
125
127
  --releases include release information, not including assets or
126
128
  binaries
129
+ --latest-releases NUMBER_OF_LATEST_RELEASES
130
+ include certain number of the latest releases;
131
+ only applies if including releases
132
+ --skip-prerelease skip prerelease and draft versions; only applies if including releases
127
133
  --assets include assets alongside release information; only
128
134
  applies if including releases
129
135
  --exclude [REPOSITORY [REPOSITORY ...]]
@@ -49,7 +49,9 @@ CLI Help output::
49
49
  [-P] [-F] [--prefer-ssh] [-v]
50
50
  [--keychain-name OSX_KEYCHAIN_ITEM_NAME]
51
51
  [--keychain-account OSX_KEYCHAIN_ITEM_ACCOUNT]
52
- [--releases] [--assets] [--exclude [REPOSITORY [REPOSITORY ...]]
52
+ [--releases] [--latest-releases NUMBER_OF_LATEST_RELEASES]
53
+ [--skip-prerelease] [--assets]
54
+ [--exclude [REPOSITORY [REPOSITORY ...]]
53
55
  [--throttle-limit THROTTLE_LIMIT] [--throttle-pause THROTTLE_PAUSE]
54
56
  USER
55
57
 
@@ -124,6 +126,10 @@ CLI Help output::
124
126
  keychain that holds the personal access or OAuth token
125
127
  --releases include release information, not including assets or
126
128
  binaries
129
+ --latest-releases NUMBER_OF_LATEST_RELEASES
130
+ include certain number of the latest releases;
131
+ only applies if including releases
132
+ --skip-prerelease skip prerelease and draft versions; only applies if including releases
127
133
  --assets include assets alongside release information; only
128
134
  applies if including releases
129
135
  --exclude [REPOSITORY [REPOSITORY ...]]
@@ -1,12 +1,8 @@
1
1
  #!/usr/bin/env python
2
2
 
3
- import os, sys, logging
4
-
5
- logging.basicConfig(
6
- format='%(asctime)s.%(msecs)03d: %(message)s',
7
- datefmt='%Y-%m-%dT%H:%M:%S',
8
- level=logging.INFO
9
- )
3
+ import logging
4
+ import os
5
+ import sys
10
6
 
11
7
  from github_backup.github_backup import (
12
8
  backup_account,
@@ -20,6 +16,12 @@ from github_backup.github_backup import (
20
16
  retrieve_repositories,
21
17
  )
22
18
 
19
+ logging.basicConfig(
20
+ format="%(asctime)s.%(msecs)03d: %(message)s",
21
+ datefmt="%Y-%m-%dT%H:%M:%S",
22
+ level=logging.INFO,
23
+ )
24
+
23
25
 
24
26
  def main():
25
27
  args = parse_args()
@@ -29,7 +31,7 @@ def main():
29
31
 
30
32
  output_directory = os.path.realpath(args.output_directory)
31
33
  if not os.path.isdir(output_directory):
32
- logger.info('Create output directory {0}'.format(output_directory))
34
+ logger.info("Create output directory {0}".format(output_directory))
33
35
  mkdir_p(output_directory)
34
36
 
35
37
  if args.lfs_clone:
@@ -41,10 +43,10 @@ def main():
41
43
  logger.root.setLevel(log_level)
42
44
 
43
45
  if not args.as_app:
44
- logger.info('Backing up user {0} to {1}'.format(args.user, output_directory))
46
+ logger.info("Backing up user {0} to {1}".format(args.user, output_directory))
45
47
  authenticated_user = get_authenticated_user(args)
46
48
  else:
47
- authenticated_user = {'login': None}
49
+ authenticated_user = {"login": None}
48
50
 
49
51
  repositories = retrieve_repositories(args, authenticated_user)
50
52
  repositories = filter_repositories(args, repositories)
@@ -52,7 +54,7 @@ def main():
52
54
  backup_account(args, output_directory)
53
55
 
54
56
 
55
- if __name__ == '__main__':
57
+ if __name__ == "__main__":
56
58
  try:
57
59
  main()
58
60
  except Exception as e:
@@ -0,0 +1 @@
1
+ __version__ = "0.45.0"
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env python
2
2
 
3
3
  from __future__ import print_function
4
- import socket
5
4
 
6
5
  import argparse
7
6
  import base64
@@ -10,23 +9,21 @@ import codecs
10
9
  import errno
11
10
  import getpass
12
11
  import json
12
+ import logging
13
13
  import os
14
+ import platform
14
15
  import re
15
16
  import select
17
+ import socket
16
18
  import subprocess
17
19
  import sys
18
- import logging
19
20
  import time
20
- import platform
21
- from urllib.parse import urlparse
22
- from urllib.parse import quote as urlquote
23
- from urllib.parse import urlencode
24
- from urllib.error import HTTPError, URLError
25
- from urllib.request import urlopen
26
- from urllib.request import Request
27
- from urllib.request import HTTPRedirectHandler
28
- from urllib.request import build_opener
29
21
  from http.client import IncompleteRead
22
+ from urllib.error import HTTPError, URLError
23
+ from urllib.parse import quote as urlquote
24
+ from urllib.parse import urlencode, urlparse
25
+ from urllib.request import HTTPRedirectHandler, Request, build_opener, urlopen
26
+ from datetime import datetime
30
27
 
31
28
  try:
32
29
  from . import __version__
@@ -41,10 +38,7 @@ logger = logging.getLogger(__name__)
41
38
 
42
39
 
43
40
  def logging_subprocess(
44
- popenargs,
45
- stdout_log_level=logging.DEBUG,
46
- stderr_log_level=logging.ERROR,
47
- **kwargs
41
+ popenargs, stdout_log_level=logging.DEBUG, stderr_log_level=logging.ERROR, **kwargs
48
42
  ):
49
43
  """
50
44
  Variant of subprocess.call that accepts a logger instead of stdout/stderr,
@@ -383,6 +377,19 @@ def parse_args(args=None):
383
377
  dest="include_releases",
384
378
  help="include release information, not including assets or binaries",
385
379
  )
380
+ parser.add_argument(
381
+ "--latest-releases",
382
+ type=int,
383
+ default=0,
384
+ dest="number_of_latest_releases",
385
+ help="include certain number of the latest releases; only applies if including releases",
386
+ )
387
+ parser.add_argument(
388
+ "--skip-prerelease",
389
+ action="store_true",
390
+ dest="skip_prerelease",
391
+ help="skip prerelease and draft versions; only applies if including releases",
392
+ )
386
393
  parser.add_argument(
387
394
  "--assets",
388
395
  action="store_true",
@@ -504,7 +511,7 @@ def get_github_host(args):
504
511
 
505
512
 
506
513
  def read_file_contents(file_uri):
507
- return open(file_uri[len(FILE_URI_PREFIX) :], "rt").readline().strip()
514
+ return open(file_uri[len(FILE_URI_PREFIX):], "rt").readline().strip()
508
515
 
509
516
 
510
517
  def get_github_repo_url(args, repository):
@@ -626,12 +633,12 @@ def retrieve_data_gen(args, template, query_args=None, single_request=False):
626
633
  raise Exception(", ".join(errors))
627
634
 
628
635
  if len(errors) == 0:
629
- if type(response) == list:
636
+ if type(response) is list:
630
637
  for resp in response:
631
638
  yield resp
632
639
  if len(response) < per_page:
633
640
  break
634
- elif type(response) == dict and single_request:
641
+ elif type(response) is dict and single_request:
635
642
  yield response
636
643
 
637
644
  if len(errors) > 0:
@@ -1196,8 +1203,11 @@ def backup_hooks(args, repo_cwd, repository, repos_template):
1196
1203
  template = "{0}/{1}/hooks".format(repos_template, repository["full_name"])
1197
1204
  try:
1198
1205
  _backup_data(args, "hooks", template, output_file, hook_cwd)
1199
- except SystemExit:
1200
- logger.info("Unable to read hooks, skipping")
1206
+ except Exception as e:
1207
+ if "404" in str(e):
1208
+ logger.info("Unable to read hooks, skipping")
1209
+ else:
1210
+ raise e
1201
1211
 
1202
1212
 
1203
1213
  def backup_releases(args, repo_cwd, repository, repos_template, include_assets=False):
@@ -1213,8 +1223,18 @@ def backup_releases(args, repo_cwd, repository, repos_template, include_assets=F
1213
1223
  release_template = "{0}/{1}/releases".format(repos_template, repository_fullname)
1214
1224
  releases = retrieve_data(args, release_template, query_args=query_args)
1215
1225
 
1226
+ if args.skip_prerelease:
1227
+ releases = [r for r in releases if not r["prerelease"] and not r["draft"]]
1228
+
1229
+ if args.number_of_latest_releases and args.number_of_latest_releases < len(releases):
1230
+ releases.sort(key=lambda item: datetime.strptime(item["created_at"], "%Y-%m-%dT%H:%M:%SZ"),
1231
+ reverse=True)
1232
+ releases = releases[:args.number_of_latest_releases]
1233
+ logger.info("Saving the latest {0} releases to disk".format(len(releases)))
1234
+ else:
1235
+ logger.info("Saving {0} releases to disk".format(len(releases)))
1236
+
1216
1237
  # for each release, store it
1217
- logger.info("Saving {0} releases to disk".format(len(releases)))
1218
1238
  for release in releases:
1219
1239
  release_name = release["tag_name"]
1220
1240
  release_name_safe = release_name.replace("/", "__")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: github-backup
3
- Version: 0.44.0
3
+ Version: 0.45.0
4
4
  Summary: backup a github user or organization
5
5
  Home-page: http://github.com/josegonzalez/python-github-backup
6
6
  Author: Jose Diaz-Gonzalez
@@ -57,7 +57,9 @@ Description: =============
57
57
  [-P] [-F] [--prefer-ssh] [-v]
58
58
  [--keychain-name OSX_KEYCHAIN_ITEM_NAME]
59
59
  [--keychain-account OSX_KEYCHAIN_ITEM_ACCOUNT]
60
- [--releases] [--assets] [--exclude [REPOSITORY [REPOSITORY ...]]
60
+ [--releases] [--latest-releases NUMBER_OF_LATEST_RELEASES]
61
+ [--skip-prerelease] [--assets]
62
+ [--exclude [REPOSITORY [REPOSITORY ...]]
61
63
  [--throttle-limit THROTTLE_LIMIT] [--throttle-pause THROTTLE_PAUSE]
62
64
  USER
63
65
 
@@ -132,6 +134,10 @@ Description: =============
132
134
  keychain that holds the personal access or OAuth token
133
135
  --releases include release information, not including assets or
134
136
  binaries
137
+ --latest-releases NUMBER_OF_LATEST_RELEASES
138
+ include certain number of the latest releases;
139
+ only applies if including releases
140
+ --skip-prerelease skip prerelease and draft versions; only applies if including releases
135
141
  --assets include assets alongside release information; only
136
142
  applies if including releases
137
143
  --exclude [REPOSITORY [REPOSITORY ...]]
@@ -0,0 +1,38 @@
1
+ autopep8==2.0.4
2
+ black==24.1.0
3
+ bleach==6.1.0
4
+ certifi==2023.11.17
5
+ charset-normalizer==3.3.2
6
+ click==8.1.7
7
+ colorama==0.4.6
8
+ docutils==0.20.1
9
+ flake8==7.0.0
10
+ gitchangelog==3.0.4
11
+ idna==3.6
12
+ importlib-metadata==7.0.1
13
+ jaraco.classes==3.3.0
14
+ keyring==24.3.0
15
+ markdown-it-py==3.0.0
16
+ mccabe==0.7.0
17
+ mdurl==0.1.2
18
+ more-itertools==10.2.0
19
+ mypy-extensions==1.0.0
20
+ packaging==23.2
21
+ pathspec==0.12.1
22
+ pkginfo==1.9.6
23
+ platformdirs==4.1.0
24
+ pycodestyle==2.11.1
25
+ pyflakes==3.2.0
26
+ Pygments==2.17.2
27
+ readme-renderer==42.0
28
+ requests==2.31.0
29
+ requests-toolbelt==1.0.0
30
+ restructuredtext-lint==1.4.0
31
+ rfc3986==2.0.0
32
+ rich==13.7.0
33
+ six==1.16.0
34
+ tqdm==4.66.1
35
+ twine==4.0.2
36
+ urllib3==2.1.0
37
+ webencodings==0.5.1
38
+ zipp==3.17.0
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding: utf-8 -*-
3
3
  import os
4
+
4
5
  from github_backup import __version__
5
6
 
6
7
  try:
@@ -1 +0,0 @@
1
- __version__ = "0.44.0"
@@ -1,31 +0,0 @@
1
- bleach==6.0.0
2
- certifi==2023.7.22
3
- charset-normalizer==3.1.0
4
- colorama==0.4.6
5
- docutils==0.20.1
6
- flake8==6.0.0
7
- gitchangelog==3.0.4
8
- idna==3.4
9
- importlib-metadata==6.6.0
10
- jaraco.classes==3.2.3
11
- keyring==23.13.1
12
- markdown-it-py==2.2.0
13
- mccabe==0.7.0
14
- mdurl==0.1.2
15
- more-itertools==9.1.0
16
- pkginfo==1.9.6
17
- pycodestyle==2.10.0
18
- pyflakes==3.0.1
19
- Pygments==2.15.1
20
- readme-renderer==37.3
21
- requests==2.31.0
22
- requests-toolbelt==1.0.0
23
- restructuredtext-lint==1.4.0
24
- rfc3986==2.0.0
25
- rich==13.3.5
26
- six==1.16.0
27
- tqdm==4.65.0
28
- twine==4.0.2
29
- urllib3==2.0.7
30
- webencodings==0.5.1
31
- zipp==3.15.0
File without changes