Ejemplo n.º 1
0
    def __init__(self, sha, current_version):

        if not sha:
            raise exceptions.InvalidArgumentsException('sha cannot be empty')

        if not current_version:
            raise exceptions.InvalidArgumentsException(
                'current_version cannot be empty')

        try:
            semver.parse(current_version)
        except (TypeError, ValueError):
            raise exceptions.InvalidArgumentsException(
                'Version is not a legal semantic '
                'version string')

        self._current_version = current_version
        self._sha = sha
        self._logger = logger.Logger(__name__)
        self._log_ctx = {
            'sha': self.sha,
            'current_version': self._current_version
        }

        self.features = set()
        self.bugs = set()
        self.issues = set()
        self.commits = set()
Ejemplo n.º 2
0
 def __init__(self, name, image, log=None):
     super(_Distro, self).__init__()
     self._image = image
     self._logger = log or logger.Logger(__name__)
     self._local_runner = LocalCommandRunner(log=self._logger)
     self._container_name = name
     self._data_container_name = '{}-data'.format(self._container_name)
Ejemplo n.º 3
0
    def __init__(self, username, password, repository_url=None, test=False):

        if not username:
            raise exceptions.InvalidArgumentsException(
                'username cannot be None')

        if not password:
            raise exceptions.InvalidArgumentsException(
                'password cannot be None')

        if repository_url and test:
            raise exceptions.InvalidArgumentsException(
                'either repository_url or test is allowed')

        self.test = test
        self.repository_url = 'https://test.pypi.org/legacy/' if self.test else repository_url
        self.username = username
        self.password = password
        self._runner = LocalCommandRunner()
        self._site = 'test.pypi.org' if self.test else 'pypi.org'
        self._logger = logger.Logger(__name__)
        self._log_ctx = {
            'test': self.test,
            'repository_url': self.repository_url,
            'site': self._site
        }
Ejemplo n.º 4
0
    def __init__(self, repo_path, log=None):

        self.repo_path = repo_path
        self.version = test_utils.patch_setup_py(self.repo_path)

        self._logger = log or logger.Logger(__name__)
        self._click_runner = CliRunner()
        self._local_runner = LocalCommandRunner()
        self._packager = Packager.create(path=repo_path, target_dir=repo_path)
Ejemplo n.º 5
0
    def __init__(self, repo, access_token):

        if not repo:
            raise exceptions.InvalidArgumentsException('repo cannot be empty')

        if not access_token:
            raise exceptions.InvalidArgumentsException(
                'access_token cannot be empty')

        self.__commits = {}
        self._logger = logger.Logger(__name__)
        self._hub = Github(access_token, timeout=30)
        self._repo_name = repo
        self._log_ctx = {
            'repo': self._repo_name,
        }
Ejemplo n.º 6
0
    def __init__(self,
                 repo=None,
                 sha=None,
                 path=None,
                 target_dir=None,
                 python=None):

        if sha and not repo:
            raise exceptions.InvalidArgumentsException(
                'Must pass repo as well when passing sha')

        if sha and path:
            raise exceptions.InvalidArgumentsException(
                "Either 'sha' or 'path' is allowed")

        if repo and path:
            raise exceptions.InvalidArgumentsException(
                "Either 'repo' or 'path' is allowed")

        if not sha and not path:
            raise exceptions.InvalidArgumentsException(
                "Either 'sha' or 'path' is required")

        if target_dir:
            utils.validate_directory_exists(target_dir)

        if path:
            utils.validate_directory_exists(path)

        self._repo_location = path if path else '{}@{}'.format(repo, sha)
        self._python = python
        self._target_dir = target_dir or os.getcwd()
        self._logger = logger.Logger(__name__)
        self._runner = LocalCommandRunner(log=self._logger)
        self._log_ctx = {
            'repo': self._repo_location,
        }
        self._repo_dir = self._create_repo(path, sha, repo)
Ejemplo n.º 7
0
def test_no_name():

    with pytest.raises(exceptions.InvalidArgumentsException):
        logger.Logger(name='')
Ejemplo n.º 8
0
 def __init__(self, repo, sha):
     self._repo = repo
     self._sha = sha
     self._runner = LocalCommandRunner()
     self._logger = logger.Logger(__name__)
     self._log_ctx = {'repo': self._repo.repo.full_name, 'sha': self._sha}
Ejemplo n.º 9
0
 def __init__(self, log=None):
     self._logger = log or logger.Logger(__name__)
     self._output_logger = logger.Logger(name='runner-output',
                                         fmt='%(message)s')