Fixed bux for debian, setup.py: pipx install

Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
Václav Valíček 2022-08-08 14:12:19 +02:00
parent 76cbda80cc
commit be404eb5e3
Signed by: valicek
GPG Key ID: FF05BDCA0C73BB31
4 changed files with 21 additions and 9 deletions

View File

@ -28,12 +28,15 @@ def init_gh_token():
def load_gh_token(path: Path): def load_gh_token(path: Path):
global token global token
log.info(f"Loading secret github token") try:
if not path.is_file(): log.info(f"Loading secret github token")
log.warning(f"Token load did not pass - file not found") if not path.is_file():
return log.warning(f"Token load did not pass - file not found")
# load token return
token = path.read_text().strip() # load token
token = path.read_text().strip()
except Exception as e:
log.warning(f"Token reading error: {e.__str__()}")
def config_try_override(config_writer: GitConfigParser, section: str, option: str, value: str): def config_try_override(config_writer: GitConfigParser, section: str, option: str, value: str):

View File

@ -21,7 +21,7 @@ def clone_checkout(
log.critical(f"Recursion limit reached! breaking") log.critical(f"Recursion limit reached! breaking")
return False return False
repo = Repo().clone_from(source.as_posix(), to_path = target.as_posix(), progress = GitRemoteProgress(), bare = False) repo = Repo.clone_from(source.as_posix(), to_path = target.as_posix(), progress = GitRemoteProgress(), bare = False)
if reference: if reference:
log.debug(f"Finding reference: {reference}") log.debug(f"Finding reference: {reference}")
try: try:

View File

@ -1,6 +1,14 @@
from setuptools import setup, find_packages from setuptools import setup, find_packages
import os
print("Packages:", find_packages()) with open(os.path.join(os.path.dirname(__file__), "requirements.txt"), "r") as f:
reqs = f.readlines()
install_requirements = []
for req in reqs:
req = req.strip()
if "==" in req:
install_requirements.append(req)
setup( setup(
name = 'repo_cloner', name = 'repo_cloner',
@ -13,4 +21,5 @@ setup(
'rc-prepare-git-tree=repo_cloner.prepare_git_tree:main', 'rc-prepare-git-tree=repo_cloner.prepare_git_tree:main',
] ]
}, },
install_requires = install_requirements,
) )

View File

@ -433,7 +433,7 @@ def test_open_initialized(cloner_dir_with_config, path_repo_base, caplog):
hashed = gen_repo_hashed_name(path_repo_base.as_uri()) hashed = gen_repo_hashed_name(path_repo_base.as_uri())
path = cloner_dir_with_config.joinpath("repos", hashed).as_posix() path = cloner_dir_with_config.joinpath("repos", hashed).as_posix()
mock.config.cloner_repo_url = path_repo_base.as_uri() mock.config.cloner_repo_url = path_repo_base.as_uri()
r = git.Repo().clone_from(path_repo_base.as_uri(), path, bare = True) r = git.Repo.clone_from(path_repo_base.as_uri(), path, bare = True)
commit = r.head.commit.hexsha commit = r.head.commit.hexsha
assert r.bare assert r.bare
c = Cloner(mock) c = Cloner(mock)