Skip to content

Commit b07e1bd

Browse files
committed
py 3.8 compatibility
1 parent cbf30d8 commit b07e1bd

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

git_fleximod/cli.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from pathlib import Path
22
import argparse, os, sys
3-
from importlib.resources import files
43
from git_fleximod import utils
54

65
__version__ = "1.0.1"
@@ -12,13 +11,13 @@ def print_help(self, file=None):
1211

1312
# Then append the contents of README.md
1413
candidate_paths = [
15-
os.path.join(sys.prefix, "share", "your-package", "README.md"),
16-
os.path.join(os.path.dirname(__file__), "..", "README.md") # fallback for dev
14+
Path(sys.prefix) / "share" / "your-package" / "README.md",
15+
Path(__file__).resolve().parent.parent / "README.md", # fallback for dev
1716
]
1817
for path in candidate_paths:
1918
if os.path.exists(path):
2019
with open(path) as f:
21-
print( f.read(), file=file)
20+
print( f.read_text(encoding="utf-8"), file=file)
2221
return
2322
print( "README.md not found.", file=file)
2423

@@ -42,7 +41,7 @@ def find_root_dir(filename=".gitmodules"):
4241
for dl in dirlist:
4342
attempt = dl / filename
4443
if attempt.is_file():
45-
return str(dl)
44+
return dl
4645
return None
4746
return Path(root)
4847

git_fleximod/gitinterface.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,14 @@ def _git_operation_command(self, operation, args):
6060

6161
# pylint: disable=unused-argument
6262
def git_operation(self, operation, *args, **kwargs):
63-
command = self._git_operation_command(operation, args)
63+
newargs = []
64+
for a in args:
65+
# Do not use ssh interface
66+
if isinstance(a, str):
67+
a = a.replace("[email protected]:", "https://github.com/")
68+
newargs.append(a)
69+
70+
command = self._git_command(operation, *newargs)
6471
if isinstance(command, list):
6572
try:
6673
status, output = utils.execute_subprocess(command, status_to_caller=True, output_to_caller=True)

0 commit comments

Comments
 (0)