pygitmirror 0.0.1__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.
- pygitmirror/__init__.py +0 -0
- pygitmirror/__main__.py +50 -0
- pygitmirror/arguments/__init__.py +7 -0
- pygitmirror/arguments/arguments.py +65 -0
- pygitmirror/arguments/check_repos.py +34 -0
- pygitmirror/arguments/check_url.py +4 -0
- pygitmirror/arguments/process_arguments.py +56 -0
- pygitmirror/arguments/py.typed +0 -0
- pygitmirror/arguments/read_json.py +21 -0
- pygitmirror/py.typed +0 -0
- pygitmirror/sync/__init__.py +5 -0
- pygitmirror/sync/add_destination_remote.py +27 -0
- pygitmirror/sync/clone_repo.py +17 -0
- pygitmirror/sync/constants.py +2 -0
- pygitmirror/sync/fetch_repo.py +25 -0
- pygitmirror/sync/get_reference_by_name.py +15 -0
- pygitmirror/sync/push_origin_destination.py +58 -0
- pygitmirror/sync/py.typed +0 -0
- pygitmirror/sync/sync_repo.py +38 -0
- pygitmirror-0.0.1.dist-info/LICENSE +21 -0
- pygitmirror-0.0.1.dist-info/METADATA +84 -0
- pygitmirror-0.0.1.dist-info/RECORD +25 -0
- pygitmirror-0.0.1.dist-info/WHEEL +5 -0
- pygitmirror-0.0.1.dist-info/entry_points.txt +2 -0
- pygitmirror-0.0.1.dist-info/top_level.txt +1 -0
pygitmirror/__init__.py
ADDED
|
File without changes
|
pygitmirror/__main__.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
from typing import Optional, Tuple
|
|
5
|
+
from pprint import pformat
|
|
6
|
+
|
|
7
|
+
from .arguments import process_arguments
|
|
8
|
+
from .sync import sync_repo
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def main(args: Optional[Tuple[str, ...]] = None) -> int:
|
|
12
|
+
p_args = process_arguments(args=args)
|
|
13
|
+
|
|
14
|
+
logging.basicConfig(level=logging.INFO)
|
|
15
|
+
|
|
16
|
+
logger = logging.getLogger(__name__)
|
|
17
|
+
|
|
18
|
+
logger.info(
|
|
19
|
+
"System paths:\n%s",
|
|
20
|
+
pformat(
|
|
21
|
+
os.environ["PATH"].split(":"),
|
|
22
|
+
indent=2,
|
|
23
|
+
),
|
|
24
|
+
)
|
|
25
|
+
logger.info(
|
|
26
|
+
"Python paths:\n%s",
|
|
27
|
+
pformat(
|
|
28
|
+
sys.path,
|
|
29
|
+
indent=2,
|
|
30
|
+
),
|
|
31
|
+
)
|
|
32
|
+
logger.info(p_args.get_arguments_summary())
|
|
33
|
+
|
|
34
|
+
logger.info("using sync path %s", p_args.sync_path)
|
|
35
|
+
|
|
36
|
+
for org, repos in p_args.repos.items():
|
|
37
|
+
for repo in repos:
|
|
38
|
+
sync_repo(
|
|
39
|
+
sync_path=p_args.sync_path,
|
|
40
|
+
source_url=p_args.source_url,
|
|
41
|
+
destination_url=p_args.destination_url,
|
|
42
|
+
org=org,
|
|
43
|
+
repo=repo,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
return 0
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
if __name__ == "__main__":
|
|
50
|
+
sys.exit(main())
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
from argparse import Namespace
|
|
2
|
+
from typing import Tuple, Dict
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
from .check_repos import check_repos
|
|
6
|
+
from .check_url import check_url
|
|
7
|
+
from .read_json import read_json
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Arguments:
|
|
11
|
+
def __init__(self, args: Namespace) -> None:
|
|
12
|
+
self.__log = str(args.log)
|
|
13
|
+
|
|
14
|
+
json_file = str(args.json)
|
|
15
|
+
|
|
16
|
+
json_dict = {}
|
|
17
|
+
if os.path.isfile(json_file):
|
|
18
|
+
json_dict = read_json(json_file)
|
|
19
|
+
|
|
20
|
+
sync_path = json_dict.get("sync_path", str(args.sync_path))
|
|
21
|
+
source_url = json_dict.get("source_url", str(args.source_url))
|
|
22
|
+
destination_url = json_dict.get("destination_url", str(args.destination_url))
|
|
23
|
+
repos = json_dict.get(
|
|
24
|
+
"repos", {str(args.org): list(args.repo) if args.repo else []}
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
check_url("source", source_url)
|
|
28
|
+
check_url("destination", destination_url)
|
|
29
|
+
check_repos(repos)
|
|
30
|
+
|
|
31
|
+
self.__sync_path = sync_path
|
|
32
|
+
self.__source_url = source_url
|
|
33
|
+
self.__destination_url = destination_url
|
|
34
|
+
self.__repos = repos
|
|
35
|
+
|
|
36
|
+
@property
|
|
37
|
+
def log_level(self) -> str:
|
|
38
|
+
return self.__log
|
|
39
|
+
|
|
40
|
+
@property
|
|
41
|
+
def sync_path(self) -> str:
|
|
42
|
+
return self.__sync_path
|
|
43
|
+
|
|
44
|
+
@property
|
|
45
|
+
def source_url(self) -> str:
|
|
46
|
+
return self.__source_url
|
|
47
|
+
|
|
48
|
+
@property
|
|
49
|
+
def destination_url(self) -> str:
|
|
50
|
+
return self.__destination_url
|
|
51
|
+
|
|
52
|
+
@property
|
|
53
|
+
def repos(self) -> Dict[str, Tuple[str, ...]]:
|
|
54
|
+
return self.__repos
|
|
55
|
+
|
|
56
|
+
def get_arguments_summary(self) -> str:
|
|
57
|
+
s_str = Arguments.__name__
|
|
58
|
+
s_str += "\n=======================\n"
|
|
59
|
+
s_str += f"log_level='{self.log_level}'\n"
|
|
60
|
+
s_str += f"sync_path='{self.sync_path}'\n"
|
|
61
|
+
s_str += f"source_url='{self.source_url}'\n"
|
|
62
|
+
s_str += f"destination_url='{self.destination_url}'\n"
|
|
63
|
+
s_str += f"repos='{self.repos}'\n"
|
|
64
|
+
|
|
65
|
+
return s_str
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from typing import Dict, List
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def check_repos(repos: Dict[str, List[str]]) -> None:
|
|
5
|
+
|
|
6
|
+
if not repos:
|
|
7
|
+
raise RuntimeError("repos are null")
|
|
8
|
+
|
|
9
|
+
if not isinstance(repos, dict):
|
|
10
|
+
raise RuntimeError(f"repos object is not a dict {repos.__class__.__name__}")
|
|
11
|
+
|
|
12
|
+
for key, value in repos.items():
|
|
13
|
+
if not key:
|
|
14
|
+
raise RuntimeError("key is null")
|
|
15
|
+
|
|
16
|
+
if not isinstance(key, str):
|
|
17
|
+
raise RuntimeError(f"key {key} is not a string: {key.__class__.__name__}")
|
|
18
|
+
|
|
19
|
+
if not value:
|
|
20
|
+
raise RuntimeError("value is null")
|
|
21
|
+
|
|
22
|
+
if not isinstance(value, list):
|
|
23
|
+
raise RuntimeError(
|
|
24
|
+
f"value {value} is not a list: {value.__class__.__name__}"
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
for v in value:
|
|
28
|
+
if not v:
|
|
29
|
+
raise RuntimeError("value element is null")
|
|
30
|
+
|
|
31
|
+
if not isinstance(v, str):
|
|
32
|
+
raise RuntimeError(
|
|
33
|
+
f"value element {v} is not a string: {v.__class__.__name__}"
|
|
34
|
+
)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from argparse import ArgumentParser
|
|
3
|
+
from typing import Optional, Tuple
|
|
4
|
+
|
|
5
|
+
from .arguments import Arguments
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def process_arguments(args: Optional[Tuple[str, ...]] = None) -> Arguments:
|
|
9
|
+
parser = ArgumentParser()
|
|
10
|
+
|
|
11
|
+
parser.add_argument(
|
|
12
|
+
"--log",
|
|
13
|
+
default="INFO",
|
|
14
|
+
choices=("DEBUG", "INFO", "WARNING", "CRITICAL"),
|
|
15
|
+
help="log level (default: %(default)s)",
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
parser.add_argument(
|
|
19
|
+
"--json",
|
|
20
|
+
type=str,
|
|
21
|
+
help="path to a JSON input file",
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
parser.add_argument(
|
|
25
|
+
"--sync_path",
|
|
26
|
+
type=str,
|
|
27
|
+
default=os.getcwd(),
|
|
28
|
+
help="path to use for syncing",
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
parser.add_argument(
|
|
32
|
+
"--source_url",
|
|
33
|
+
type=str,
|
|
34
|
+
help="source URL",
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
parser.add_argument(
|
|
38
|
+
"--destination_url",
|
|
39
|
+
type=str,
|
|
40
|
+
help="destination URL",
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
parser.add_argument(
|
|
44
|
+
"--org",
|
|
45
|
+
type=str,
|
|
46
|
+
help="organization name",
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
parser.add_argument(
|
|
50
|
+
"--repo",
|
|
51
|
+
type=str,
|
|
52
|
+
nargs="+",
|
|
53
|
+
help="one or more repo names",
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
return Arguments(args=parser.parse_args(args=args))
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def read_json(file_path: str) -> Any:
|
|
7
|
+
with open(file_path, encoding="utf-8") as f:
|
|
8
|
+
lines = f.readlines()
|
|
9
|
+
|
|
10
|
+
active_lines = []
|
|
11
|
+
for line in lines:
|
|
12
|
+
line = line.strip()
|
|
13
|
+
|
|
14
|
+
if not line or line.startswith("//"):
|
|
15
|
+
continue
|
|
16
|
+
|
|
17
|
+
active_lines.append(line)
|
|
18
|
+
|
|
19
|
+
all_str = "\n".join(active_lines)
|
|
20
|
+
|
|
21
|
+
return json.loads(all_str)
|
pygitmirror/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import git
|
|
3
|
+
|
|
4
|
+
from .constants import DESTINATION_NAME
|
|
5
|
+
|
|
6
|
+
_logger = logging.getLogger(__name__)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def add_destination_remote(
|
|
10
|
+
sync_path: str,
|
|
11
|
+
destination_url: str,
|
|
12
|
+
) -> None:
|
|
13
|
+
|
|
14
|
+
repo = git.Repo(sync_path)
|
|
15
|
+
|
|
16
|
+
destination = None
|
|
17
|
+
for remote in repo.remotes:
|
|
18
|
+
if remote.name == DESTINATION_NAME:
|
|
19
|
+
destination = remote
|
|
20
|
+
break
|
|
21
|
+
|
|
22
|
+
if destination is not None:
|
|
23
|
+
_logger.info("%s remote is already defined", DESTINATION_NAME)
|
|
24
|
+
return
|
|
25
|
+
|
|
26
|
+
_logger.info("adding remote %s", DESTINATION_NAME)
|
|
27
|
+
repo.create_remote(DESTINATION_NAME, destination_url)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import git
|
|
3
|
+
|
|
4
|
+
_logger = logging.getLogger(__name__)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def clone_repo(
|
|
8
|
+
sync_path: str,
|
|
9
|
+
source_url: str,
|
|
10
|
+
) -> None:
|
|
11
|
+
_logger.info(
|
|
12
|
+
"cloning new repo from %s to %s",
|
|
13
|
+
source_url,
|
|
14
|
+
sync_path,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
git.Repo.clone_from(source_url, sync_path)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import git
|
|
3
|
+
|
|
4
|
+
from .constants import ORIGIN_NAME
|
|
5
|
+
|
|
6
|
+
_logger = logging.getLogger(__name__)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def fetch_repo(
|
|
10
|
+
sync_path: str,
|
|
11
|
+
) -> None:
|
|
12
|
+
_logger.info("fetching existing repo %s", sync_path)
|
|
13
|
+
|
|
14
|
+
repo = git.Repo(sync_path)
|
|
15
|
+
|
|
16
|
+
origin = None
|
|
17
|
+
for remote in repo.remotes:
|
|
18
|
+
if remote.name == ORIGIN_NAME:
|
|
19
|
+
origin = remote
|
|
20
|
+
break
|
|
21
|
+
|
|
22
|
+
if origin is None:
|
|
23
|
+
raise RuntimeError(f"could not find remote {ORIGIN_NAME}")
|
|
24
|
+
|
|
25
|
+
origin.fetch()
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import subprocess
|
|
3
|
+
|
|
4
|
+
import git
|
|
5
|
+
|
|
6
|
+
from .constants import DESTINATION_NAME, ORIGIN_NAME
|
|
7
|
+
from .get_reference_by_name import get_reference_by_name
|
|
8
|
+
|
|
9
|
+
_logger = logging.getLogger(__name__)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def push_origin_destination(
|
|
13
|
+
sync_path: str,
|
|
14
|
+
) -> None:
|
|
15
|
+
|
|
16
|
+
repo = git.Repo(sync_path)
|
|
17
|
+
|
|
18
|
+
origin = get_reference_by_name(repo, ORIGIN_NAME)
|
|
19
|
+
|
|
20
|
+
if origin is None:
|
|
21
|
+
raise RuntimeError(f"{ORIGIN_NAME} remote does not exist")
|
|
22
|
+
|
|
23
|
+
destination = get_reference_by_name(repo, DESTINATION_NAME)
|
|
24
|
+
|
|
25
|
+
if destination is None:
|
|
26
|
+
raise RuntimeError(f"{DESTINATION_NAME} remote does not exist")
|
|
27
|
+
|
|
28
|
+
for branch in origin.refs:
|
|
29
|
+
if branch.remote_head == "HEAD":
|
|
30
|
+
continue
|
|
31
|
+
|
|
32
|
+
_logger.info("%s", branch.remote_head)
|
|
33
|
+
|
|
34
|
+
args = [
|
|
35
|
+
"git",
|
|
36
|
+
"checkout",
|
|
37
|
+
branch.remote_head,
|
|
38
|
+
]
|
|
39
|
+
subprocess.check_call(
|
|
40
|
+
args,
|
|
41
|
+
cwd=sync_path,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
# origin.pull(f"{branch.remote_head}:{branch.remote_head}")
|
|
45
|
+
|
|
46
|
+
# destination.push(f"{branch.remote_head}:{branch.remote_head}")
|
|
47
|
+
|
|
48
|
+
args = [
|
|
49
|
+
"git",
|
|
50
|
+
"push",
|
|
51
|
+
DESTINATION_NAME,
|
|
52
|
+
"--all",
|
|
53
|
+
]
|
|
54
|
+
_logger.info(" ".join(args))
|
|
55
|
+
subprocess.check_call(
|
|
56
|
+
args,
|
|
57
|
+
cwd=sync_path,
|
|
58
|
+
)
|
|
File without changes
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
from .fetch_repo import fetch_repo
|
|
5
|
+
from .clone_repo import clone_repo
|
|
6
|
+
from .add_destination_remote import add_destination_remote
|
|
7
|
+
from .push_origin_destination import push_origin_destination
|
|
8
|
+
|
|
9
|
+
_logger = logging.getLogger(__name__)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def sync_repo(
|
|
13
|
+
sync_path: str,
|
|
14
|
+
source_url: str,
|
|
15
|
+
destination_url: str,
|
|
16
|
+
org: str,
|
|
17
|
+
repo: str,
|
|
18
|
+
) -> int:
|
|
19
|
+
_logger.info("syncing %s/%s", org, repo)
|
|
20
|
+
|
|
21
|
+
repo_sync_path = os.path.join(sync_path, org, repo)
|
|
22
|
+
repo_source_url = f"{source_url}/{org}/{repo}"
|
|
23
|
+
repo_destination_url = f"{destination_url}/{org}/{repo}"
|
|
24
|
+
|
|
25
|
+
_logger.info("repo_sync_path: %s", repo_sync_path)
|
|
26
|
+
_logger.info("repo_source_url: %s", repo_source_url)
|
|
27
|
+
_logger.info("repo_destination_url: %s", repo_destination_url)
|
|
28
|
+
|
|
29
|
+
if os.path.isdir(repo_sync_path):
|
|
30
|
+
fetch_repo(repo_sync_path)
|
|
31
|
+
else:
|
|
32
|
+
clone_repo(repo_sync_path, repo_source_url)
|
|
33
|
+
|
|
34
|
+
add_destination_remote(repo_sync_path, repo_destination_url)
|
|
35
|
+
|
|
36
|
+
push_origin_destination(repo_sync_path)
|
|
37
|
+
|
|
38
|
+
return 0
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 pygitmirror
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: pygitmirror
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: An executable to clone git repos from one gitea instance to another.
|
|
5
|
+
Author-email: Bassem Girgis <brgirgis@gmail.com>
|
|
6
|
+
Maintainer-email: Bassem Girgis <brgirgis@gmail.com>
|
|
7
|
+
License: BSD
|
|
8
|
+
Project-URL: Homepage, https://github.com/pygitmirror/pygitmirror
|
|
9
|
+
Project-URL: Documentation, https://github.com/pygitmirror/pygitmirror
|
|
10
|
+
Project-URL: Repository, https://github.com/pygitmirror/pygitmirror.git
|
|
11
|
+
Project-URL: Issues, https://github.com/pygitmirror/pygitmirror/issues
|
|
12
|
+
Keywords: git,clone,gitea
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
16
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
17
|
+
Classifier: Operating System :: MacOS
|
|
18
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Requires-Python: >=3.9
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: GitPython
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: build ; extra == 'dev'
|
|
29
|
+
Requires-Dist: flake8 ; extra == 'dev'
|
|
30
|
+
Requires-Dist: mypy ; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest ; extra == 'dev'
|
|
32
|
+
Requires-Dist: twine ; extra == 'dev'
|
|
33
|
+
Requires-Dist: pylint ; extra == 'dev'
|
|
34
|
+
|
|
35
|
+
# pygitmirror
|
|
36
|
+
|
|
37
|
+
[](https://pypi.org/project/pygitmirror/)
|
|
38
|
+

|
|
39
|
+

|
|
40
|
+
[](https://pepy.tech/project/pygitmirror)
|
|
41
|
+
[](https://pepy.tech/project/pygitmirror)
|
|
42
|
+
[](https://pepy.tech/project/pygitmirror)
|
|
43
|
+
|
|
44
|
+
## Development
|
|
45
|
+
|
|
46
|
+
To clone the library for development:
|
|
47
|
+
|
|
48
|
+
git clone
|
|
49
|
+
|
|
50
|
+
or
|
|
51
|
+
|
|
52
|
+
git clone
|
|
53
|
+
|
|
54
|
+
### Build The Virtual Environment
|
|
55
|
+
|
|
56
|
+
The current earliest Python version supported is `3.9`. You need to be able to create a virtual environment at this version to make sure any changes you make is compatible.
|
|
57
|
+
|
|
58
|
+
If you are using `conda`:
|
|
59
|
+
|
|
60
|
+
conda create --prefix=.venv python=3.9 --yes
|
|
61
|
+
|
|
62
|
+
If you are using `venv`, make sure you have the right base package:
|
|
63
|
+
|
|
64
|
+
>> python --version
|
|
65
|
+
Python 3.9.x
|
|
66
|
+
|
|
67
|
+
Once you verify your base Python, you can then create a virtual environment using:
|
|
68
|
+
|
|
69
|
+
virtualenv -p py3.9 .venv
|
|
70
|
+
|
|
71
|
+
### Setup
|
|
72
|
+
|
|
73
|
+
Once you have created your virtual environment and made sure it is active in your current command line:
|
|
74
|
+
|
|
75
|
+
python3 -m pip install --upgrade pip
|
|
76
|
+
pip install -e .[dev]
|
|
77
|
+
|
|
78
|
+
This should all the dependencies you need for developing into the library and also allow you to run the unit tests:
|
|
79
|
+
|
|
80
|
+
pytest
|
|
81
|
+
|
|
82
|
+
### Debugging
|
|
83
|
+
|
|
84
|
+
WIP
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
pygitmirror/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
pygitmirror/__main__.py,sha256=xk14HI7jNfZQUiEJ29-htRZ08-Omp8_AOoNkoRY42v8,1102
|
|
3
|
+
pygitmirror/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
pygitmirror/arguments/__init__.py,sha256=2zfe1OKgkcfyNEynI-sapkCebXVyDQxoXPMzYJiMoeY,139
|
|
5
|
+
pygitmirror/arguments/arguments.py,sha256=5J8-vpI5LIYfzZXHkgYuRo3eM6J3a-TxM5DcVLnDUPQ,1865
|
|
6
|
+
pygitmirror/arguments/check_repos.py,sha256=hbBWgBrT3FZPAecUbixsVDoiourlp5CanSBSDXkq45A,1016
|
|
7
|
+
pygitmirror/arguments/check_url.py,sha256=cag92YVSBJs14F6jRH8q4G3geNuGxUsXCeWZhw6Dsnc,111
|
|
8
|
+
pygitmirror/arguments/process_arguments.py,sha256=I7sBNlfDHjL8zSWboziGXdPzFhiTTviPzNTh1MIaOZQ,1151
|
|
9
|
+
pygitmirror/arguments/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
+
pygitmirror/arguments/read_json.py,sha256=IxasH0ewnjQpCaUx8OcnARqW2ME27DMEqM-Oj3NsDok,403
|
|
11
|
+
pygitmirror/sync/__init__.py,sha256=GFeJPQktp_KVJUsRjUiEuH9PVKD8BzhssSqS7U26a8o,65
|
|
12
|
+
pygitmirror/sync/add_destination_remote.py,sha256=St5duB_ktHdmxYyvL6E_Btym8FbBnxFwi6I-UJ9LY3Y,609
|
|
13
|
+
pygitmirror/sync/clone_repo.py,sha256=RNUk_mif7g2EF3XZdHlO_9m5uGaN6AXbpd-I2t7xxS0,288
|
|
14
|
+
pygitmirror/sync/constants.py,sha256=tv_VpD7i70i9nVAmeqNNZQI0pm1mviLVmzDyM7QslC4,56
|
|
15
|
+
pygitmirror/sync/fetch_repo.py,sha256=qvTnZSUA9GXGZEM9ErJKPL6hGEQc1j9Y_MSTAjd-y4E,486
|
|
16
|
+
pygitmirror/sync/get_reference_by_name.py,sha256=pRr7GoP-N4HELCOGdT_UgCn5XspcK-RJ8wotlUCKuM0,242
|
|
17
|
+
pygitmirror/sync/push_origin_destination.py,sha256=XmJl_C1XWdJ4_7uxAzlX3yaF5_z0CDokF21XV1exHLc,1264
|
|
18
|
+
pygitmirror/sync/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
+
pygitmirror/sync/sync_repo.py,sha256=JwjQmRwcrgXo2FoupE7lr-4dvMY5Fd7sZduGpTLfTO0,1033
|
|
20
|
+
pygitmirror-0.0.1.dist-info/LICENSE,sha256=XxymavR2clUjMaEv-lNhceKlaeOMcPSlNHjsCXAHvDQ,1068
|
|
21
|
+
pygitmirror-0.0.1.dist-info/METADATA,sha256=wouCPhexpU7d9M2gs7M5bP0XX7Hcl6jTau5wNIO9WDc,3219
|
|
22
|
+
pygitmirror-0.0.1.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
23
|
+
pygitmirror-0.0.1.dist-info/entry_points.txt,sha256=tR36-HOrSf2Fb03ipI5H0LII07234yCHfhkykCA5aLA,57
|
|
24
|
+
pygitmirror-0.0.1.dist-info/top_level.txt,sha256=JZNAxZ7jxuLTcPdkW1N3e8Wotc3hEEmU1I-zBd1LnBI,12
|
|
25
|
+
pygitmirror-0.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pygitmirror
|