Beispiel #1
0
 def test_create_ssh_wrapper(self):
     filename = os.path.join(appsettings.DATA_DIR, 'ssh',
                             'ssh-weblate-wrapper')
     create_ssh_wrapper()
     with open(filename, 'r') as handle:
         data = handle.read()
         self.assertTrue(ssh_file('known_hosts') in data)
         self.assertTrue(ssh_file('id_rsa') in data)
         self.assertTrue(appsettings.DATA_DIR in data)
     self.assertTrue(os.access(filename, os.X_OK))
Beispiel #2
0
 def test_create_ssh_wrapper(self):
     filename = os.path.join(
         appsettings.DATA_DIR, 'ssh', 'ssh-weblate-wrapper'
     )
     create_ssh_wrapper()
     with open(filename, 'r') as handle:
         data = handle.read()
         self.assertTrue(ssh_file('known_hosts') in data)
         self.assertTrue(ssh_file('id_rsa') in data)
         self.assertTrue(appsettings.DATA_DIR in data)
     self.assertTrue(
         os.access(filename, os.X_OK)
     )
Beispiel #3
0
 def test_create_ssh_wrapper(self):
     check_data_writable()
     filename = os.path.join(settings.DATA_DIR, 'ssh', SSH_WRAPPER)
     create_ssh_wrapper()
     with open(filename, 'r') as handle:
         data = handle.read()
         self.assertTrue(ssh_file('known_hosts') in data)
         self.assertTrue(ssh_file('id_rsa') in data)
         self.assertTrue(settings.DATA_DIR in data)
     self.assertTrue(os.access(filename, os.X_OK))
     # Second run should not touch the file
     timestamp = os.stat(filename).st_mtime
     create_ssh_wrapper()
     self.assertEqual(timestamp, os.stat(filename).st_mtime)
Beispiel #4
0
 def __init__(self, path, branch=None, component=None, local=False):
     self.path = path
     if branch is None:
         self.branch = self.default_branch
     else:
         self.branch = branch
     self.component = component
     self.last_output = ''
     self.lock = FileLock(self.path.rstrip('/').rstrip('\\') + '.lock',
                          timeout=120)
     if not local:
         # Create ssh wrapper for possible use
         create_ssh_wrapper()
     if not self.is_valid():
         self.init()
Beispiel #5
0
 def test_create_ssh_wrapper(self):
     try:
         backup_dir = appsettings.DATA_DIR
         appsettings.DATA_DIR = self._tempdir
         filename = os.path.join(appsettings.DATA_DIR, 'ssh',
                                 'ssh-weblate-wrapper')
         create_ssh_wrapper()
         with open(filename, 'r') as handle:
             data = handle.read()
             self.assertTrue(ssh_file('known_hosts') in data)
             self.assertTrue(ssh_file('id_rsa') in data)
             self.assertTrue(self._tempdir in data)
         self.assertTrue(os.access(filename, os.X_OK))
     finally:
         appsettings.DATA_DIR = backup_dir
Beispiel #6
0
 def test_create_ssh_wrapper(self):
     try:
         backup_dir = appsettings.DATA_DIR
         appsettings.DATA_DIR = self._tempdir
         filename = os.path.join(
             appsettings.DATA_DIR, 'ssh', 'ssh-weblate-wrapper'
         )
         create_ssh_wrapper()
         with open(filename, 'r') as handle:
             data = handle.read()
             self.assertTrue(ssh_file('known_hosts') in data)
             self.assertTrue(ssh_file('id_rsa') in data)
             self.assertTrue(self._tempdir in data)
         self.assertTrue(
             os.access(filename, os.X_OK)
         )
     finally:
         appsettings.DATA_DIR = backup_dir
Beispiel #7
0
    return url


def get_versions_list():
    """Return list with version information summary."""
    return (
        [('Weblate', '', GIT_VERSION)] +
        get_versions() +
        get_optional_versions()
    )


def get_versions_string():
    """Return string with version information summary."""
    result = []
    for version in get_versions_list():
        result.append(
            ' * {0} {1}'.format(
                version[0],
                version[2]
            )
        )
    return '\n'.join(result)


# Check for requirements

check_requirements()
check_data_writable()
create_ssh_wrapper()
Beispiel #8
0
    return url


def get_versions_list():
    """Return list with version information summary."""
    return (
        [('Weblate', '', GIT_VERSION)] +
        get_versions() +
        get_optional_versions()
    )


def get_versions_string():
    """Return string with version information summary."""
    result = []
    for version in get_versions_list():
        result.append(
            ' * {0} {1}'.format(
                version[0],
                version[2]
            )
        )
    return '\n'.join(result)


# Check for requirements

check_requirements()
check_data_writable()
create_ssh_wrapper()
Beispiel #9
0
 def clone(cls, source, target, branch=None):
     """Clone repository and return object for cloned repository."""
     create_ssh_wrapper()
     cls._clone(source, target, branch)
     return cls(target, branch)