github-backup 0.45.2__py3-none-any.whl → 0.47.0__py3-none-any.whl
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.
- github_backup/__init__.py +1 -1
- github_backup/github_backup.py +23 -8
- {github_backup-0.45.2.dist-info → github_backup-0.47.0.dist-info}/METADATA +9 -10
- github_backup-0.47.0.dist-info/RECORD +9 -0
- {github_backup-0.45.2.dist-info → github_backup-0.47.0.dist-info}/WHEEL +1 -1
- github_backup-0.45.2.dist-info/RECORD +0 -9
- {github_backup-0.45.2.data → github_backup-0.47.0.data}/scripts/github-backup +0 -0
- {github_backup-0.45.2.dist-info → github_backup-0.47.0.dist-info}/LICENSE.txt +0 -0
- {github_backup-0.45.2.dist-info → github_backup-0.47.0.dist-info}/top_level.txt +0 -0
- {github_backup-0.45.2.dist-info → github_backup-0.47.0.dist-info}/zip-safe +0 -0
github_backup/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.
|
|
1
|
+
__version__ = "0.47.0"
|
github_backup/github_backup.py
CHANGED
|
@@ -15,6 +15,7 @@ import platform
|
|
|
15
15
|
import re
|
|
16
16
|
import select
|
|
17
17
|
import socket
|
|
18
|
+
import ssl
|
|
18
19
|
import subprocess
|
|
19
20
|
import sys
|
|
20
21
|
import time
|
|
@@ -36,6 +37,18 @@ FNULL = open(os.devnull, "w")
|
|
|
36
37
|
FILE_URI_PREFIX = "file://"
|
|
37
38
|
logger = logging.getLogger(__name__)
|
|
38
39
|
|
|
40
|
+
https_ctx = ssl.create_default_context()
|
|
41
|
+
if not https_ctx.get_ca_certs():
|
|
42
|
+
import warnings
|
|
43
|
+
warnings.warn('\n\nYOUR DEFAULT CA CERTS ARE EMPTY.\n' +
|
|
44
|
+
'PLEASE POPULATE ANY OF:' +
|
|
45
|
+
''.join([
|
|
46
|
+
'\n - ' + x
|
|
47
|
+
for x in ssl.get_default_verify_paths()
|
|
48
|
+
if type(x) is str
|
|
49
|
+
]) + '\n', stacklevel=2)
|
|
50
|
+
import certifi
|
|
51
|
+
https_ctx = ssl.create_default_context(cafile=certifi.where())
|
|
39
52
|
|
|
40
53
|
def logging_subprocess(
|
|
41
54
|
popenargs, stdout_log_level=logging.DEBUG, stderr_log_level=logging.ERROR, **kwargs
|
|
@@ -666,7 +679,7 @@ def _get_response(request, auth, template):
|
|
|
666
679
|
while True:
|
|
667
680
|
should_continue = False
|
|
668
681
|
try:
|
|
669
|
-
r = urlopen(request)
|
|
682
|
+
r = urlopen(request, context=https_ctx)
|
|
670
683
|
except HTTPError as exc:
|
|
671
684
|
errors, should_continue = _request_http_error(exc, auth, errors) # noqa
|
|
672
685
|
r = exc
|
|
@@ -931,11 +944,11 @@ def filter_repositories(args, unfiltered_repositories):
|
|
|
931
944
|
if r.get("language") and r.get("language").lower() in languages
|
|
932
945
|
] # noqa
|
|
933
946
|
if name_regex:
|
|
934
|
-
repositories = [r for r in repositories if name_regex.match(r["name"])]
|
|
947
|
+
repositories = [r for r in repositories if "name" not in r or name_regex.match(r["name"])]
|
|
935
948
|
if args.skip_archived:
|
|
936
949
|
repositories = [r for r in repositories if not r.get("archived")]
|
|
937
950
|
if args.exclude:
|
|
938
|
-
repositories = [r for r in repositories if r["name"] not in args.exclude]
|
|
951
|
+
repositories = [r for r in repositories if "name" not in r or r["name"] not in args.exclude]
|
|
939
952
|
|
|
940
953
|
return repositories
|
|
941
954
|
|
|
@@ -1259,7 +1272,7 @@ def backup_releases(args, repo_cwd, repository, repos_template, include_assets=F
|
|
|
1259
1272
|
download_file(
|
|
1260
1273
|
asset["url"],
|
|
1261
1274
|
os.path.join(release_assets_cwd, asset["name"]),
|
|
1262
|
-
get_auth(args),
|
|
1275
|
+
get_auth(args, encode=not args.as_app),
|
|
1263
1276
|
as_app=args.as_app,
|
|
1264
1277
|
fine=True if args.token_fine is not None else False
|
|
1265
1278
|
)
|
|
@@ -1318,13 +1331,15 @@ def fetch_repository(
|
|
|
1318
1331
|
git_command = ["git", "remote", "set-url", "origin", remote_url]
|
|
1319
1332
|
logging_subprocess(git_command, cwd=local_dir)
|
|
1320
1333
|
|
|
1321
|
-
|
|
1322
|
-
git_command = ["git", "lfs", "fetch", "--all", "--prune"]
|
|
1323
|
-
else:
|
|
1324
|
-
git_command = ["git", "fetch", "--all", "--force", "--tags", "--prune"]
|
|
1334
|
+
git_command = ["git", "fetch", "--all", "--force", "--tags", "--prune"]
|
|
1325
1335
|
if no_prune:
|
|
1326
1336
|
git_command.pop()
|
|
1327
1337
|
logging_subprocess(git_command, cwd=local_dir)
|
|
1338
|
+
if lfs_clone:
|
|
1339
|
+
git_command = ["git", "lfs", "fetch", "--all", "--prune"]
|
|
1340
|
+
if no_prune:
|
|
1341
|
+
git_command.pop()
|
|
1342
|
+
logging_subprocess(git_command, cwd=local_dir)
|
|
1328
1343
|
else:
|
|
1329
1344
|
logger.info(
|
|
1330
1345
|
"Cloning {0} repository from {1} to {2}".format(
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: github-backup
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.47.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
|
|
7
7
|
Author-email: github-backup@josediazgonzalez.com
|
|
8
8
|
License: MIT
|
|
9
|
-
Platform: UNKNOWN
|
|
10
9
|
Classifier: Development Status :: 5 - Production/Stable
|
|
11
10
|
Classifier: Topic :: System :: Archiving :: Backup
|
|
12
11
|
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.5
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
16
12
|
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
17
|
Description-Content-Type: text/x-rst
|
|
18
|
+
License-File: LICENSE.txt
|
|
18
19
|
|
|
19
20
|
=============
|
|
20
21
|
github-backup
|
|
@@ -40,7 +41,7 @@ Using PIP via PyPI::
|
|
|
40
41
|
Using PIP via Github (more likely the latest version)::
|
|
41
42
|
|
|
42
43
|
pip install git+https://github.com/josegonzalez/python-github-backup.git#egg=github-backup
|
|
43
|
-
|
|
44
|
+
|
|
44
45
|
*Install note for python newcomers:*
|
|
45
46
|
|
|
46
47
|
Python scripts are unlikely to be included in your ``$PATH`` by default, this means it cannot be run directly in terminal with ``$ github-backup ...``, you can either add python's install path to your environments ``$PATH`` or call the script directly e.g. using ``$ ~/.local/bin/github-backup``.*
|
|
@@ -243,7 +244,7 @@ Gotchas / Known-issues
|
|
|
243
244
|
All is not everything
|
|
244
245
|
---------------------
|
|
245
246
|
|
|
246
|
-
The ``--all`` argument does not include
|
|
247
|
+
The ``--all`` argument does not include: cloning private repos (``-P, --private``), cloning forks (``-F, --fork``), cloning starred repositories (``--all-starred``), ``--pull-details``, cloning LFS repositories (``--lfs``), cloning gists (``--starred-gists``) or cloning starred gist repos (``--starred-gists``). See examples for more.
|
|
247
248
|
|
|
248
249
|
Cloning all starred size
|
|
249
250
|
------------------------
|
|
@@ -321,7 +322,7 @@ Quietly and incrementally backup useful Github user data (public and private rep
|
|
|
321
322
|
GH_USER=YOUR-GITHUB-USER
|
|
322
323
|
|
|
323
324
|
github-backup -f $FINE_ACCESS_TOKEN --prefer-ssh -o ~/github-backup/ -l error -P -i --all-starred --starred --watched --followers --following --issues --issue-comments --issue-events --pulls --pull-comments --pull-commits --labels --milestones --repositories --wikis --releases --assets --pull-details --gists --starred-gists $GH_USER
|
|
324
|
-
|
|
325
|
+
|
|
325
326
|
Debug an error/block or incomplete backup into a temporary directory. Omit "incremental" to fill a previous incomplete backup. ::
|
|
326
327
|
|
|
327
328
|
export FINE_ACCESS_TOKEN=SOME-GITHUB-TOKEN
|
|
@@ -358,5 +359,3 @@ This project currently contains no unit tests. To run linting::
|
|
|
358
359
|
:target: https://pypi.python.org/pypi/github-backup/
|
|
359
360
|
.. |Python Versions| image:: https://img.shields.io/pypi/pyversions/github-backup.svg
|
|
360
361
|
:target: https://github.com/josegonzalez/python-github-backup
|
|
361
|
-
|
|
362
|
-
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
github_backup/__init__.py,sha256=aqLqdmGXCjcE1UvvJF8OHznHKbGMeoRrk-C4_mjzdPs,23
|
|
2
|
+
github_backup/github_backup.py,sha256=h6lu2QBhjx5yHrSA0ocQ3xga0GdJuj4yG92zJZYtz-0,48732
|
|
3
|
+
github_backup-0.47.0.data/scripts/github-backup,sha256=I79TNA67phytRmI9nm_LlD9h2zauXFOsOn9tYyAy9pU,1546
|
|
4
|
+
github_backup-0.47.0.dist-info/LICENSE.txt,sha256=ML-pLyn1qtAKo_DHMcQ8-p7k3f8cp-IR-mf5B49R2rk,1085
|
|
5
|
+
github_backup-0.47.0.dist-info/METADATA,sha256=Yokav5VhHSroGqxzvkvXZSSPRrD4K4t9vGsCSt1H0Mg,19291
|
|
6
|
+
github_backup-0.47.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
7
|
+
github_backup-0.47.0.dist-info/top_level.txt,sha256=Za6fKRAlxZ0b3ZBH_osPqklLe14LetdNAkvAQANT2AA,14
|
|
8
|
+
github_backup-0.47.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
9
|
+
github_backup-0.47.0.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
github_backup/__init__.py,sha256=tds0V9F1Q9oamCkPJBF1oU5gAI0B2Y0XGkpwE0Axysk,23
|
|
2
|
-
github_backup/github_backup.py,sha256=EiYRWJZI5VK-T3QREblmg3YH7dAY74t1zRd5c5yNFsk,48052
|
|
3
|
-
github_backup-0.45.2.data/scripts/github-backup,sha256=I79TNA67phytRmI9nm_LlD9h2zauXFOsOn9tYyAy9pU,1546
|
|
4
|
-
github_backup-0.45.2.dist-info/LICENSE.txt,sha256=ML-pLyn1qtAKo_DHMcQ8-p7k3f8cp-IR-mf5B49R2rk,1085
|
|
5
|
-
github_backup-0.45.2.dist-info/METADATA,sha256=tJ-JWFkNs1X7n5J-ZiDybXdrfTJOhprIP5MFFSrxo_8,19223
|
|
6
|
-
github_backup-0.45.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
7
|
-
github_backup-0.45.2.dist-info/top_level.txt,sha256=Za6fKRAlxZ0b3ZBH_osPqklLe14LetdNAkvAQANT2AA,14
|
|
8
|
-
github_backup-0.45.2.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
9
|
-
github_backup-0.45.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|