diff --git a/core/argument_parser.py b/core/argument_parser.py index 27c5253..3dffb13 100644 --- a/core/argument_parser.py +++ b/core/argument_parser.py @@ -37,10 +37,10 @@ def create_parser() -> ArgumentParser: parser.add_argument('-g', '--group', required=False, type=int, help='Add group id it can be found under group name. Id must be integer') - parser.add_argument('-u', '--urls', nargs='+', help='Provide url or urls to mirror with it in format: ' - 'https://github.com/s3rius/FastAPI-template.git. ' - 'You can provide multiple urls separated by space. ' - 'Names will generate automatically from links') + parser.add_argument('-u', '--urls', nargs='+', + help='Provide url or urls to mirror with it in format: ' + 'https://github.com/s3rius/FastAPI-template.git. You can provide multiple urls ' + 'separated by space. Names will generate automatically from links') parser.add_argument('-f', '--file', help='Add file with urls. Each url on new line. Can be combined with ' '--url option. Names will generate automatically from links') diff --git a/core/repo_creator.py b/core/repo_creator.py index d0c1976..c897d79 100644 --- a/core/repo_creator.py +++ b/core/repo_creator.py @@ -92,13 +92,14 @@ class RepositoryCreator: elif request.status_code != self.HTTP_200_OK: logger.error(f'Error pull repository. Status code: {request.status_code}. Reason: {request.text}') - def create_repository_mirror(self, **kwargs): + def create_repository_mirror(self, github_url: str, group_id: int): """ Base action for one thread. Creates repository, add mirror url and triggers pull at te end - :param kwargs: Can contain github url to mirror of, gitlab group ID + :param github_url: Github url which will be mirrored + :param group_id: Gitlab group id which contains created repository """ - repo_id = self.__create_new_project(kwargs['url'], kwargs['group_id']) - url = self.__add_pull_mirror(kwargs['url'], repo_id) + repo_id = self.__create_new_project(github_url, group_id) + url = self.__add_pull_mirror(github_url, repo_id) if url: self.__pull_github_repo(url, repo_id) diff --git a/github-repositories.txt b/github-repositories.txt index a0a2232..7a3d8a8 100644 --- a/github-repositories.txt +++ b/github-repositories.txt @@ -73,4 +73,18 @@ https://github.com/django/django.git https://github.com/KristianOellegaard/django-health-check.git https://github.com/wemake-services/django-split-settings.git https://github.com/jazzband/django-constance.git -https://github.com/numpy/numpy.git \ No newline at end of file +https://github.com/numpy/numpy.git +https://github.com/mher/flower.git +https://github.com/hynek/structlog.git +https://github.com/bradmontgomery/django-querycount.git +https://github.com/justinmayer/django-autoslug.git +https://github.com/SmileyChris/easy-thumbnails.git +https://github.com/jonasundderwolf/django-image-cropping.git +https://github.com/marshmallow-code/marshmallow.git +https://github.com/TvoroG/pytest-lazy-fixture.git +https://github.com/PyCQA/flake8.git +https://github.com/getsentry/responses.git +https://github.com/gotcha/ipdb.git +https://github.com/pypa/setuptools.git +https://github.com/jazzband/django-redis.git +https://github.com/sebleier/django-redis-cache.git \ No newline at end of file diff --git a/github_mirror.py b/github_mirror.py index 9d02d17..841460b 100644 --- a/github_mirror.py +++ b/github_mirror.py @@ -1,5 +1,5 @@ import sys -from threading import Thread, Semaphore +from threading import Thread from core.argument_parser import create_parser from core.repo_creator import RepositoryCreator @@ -33,15 +33,13 @@ def main(): if mirror_urls: for url in set(mirror_urls): # github urls must be unique thread = Thread(target=repository_creator.create_repository_mirror, - kwargs={'url': url, 'group_id': group_id, }) + kwargs={'github_url': url, 'group_id': group_id, }) threads.append(thread) for thread in threads: - with Semaphore(50): - thread.start() + thread.start() threads_ready_statistic(threads) # add threads ready status to log output - else: logger.info('You must provide at least one github url for mirror') sys.exit(1)