Files
@ 6af3e67cc576
Branch filter:
Location: kallithea/rhodecode/tests/vcs/utils.py - annotation
6af3e67cc576
2.9 KiB
text/x-python
Add Twitter's Bootstrap 3.0.0 CSS and Javascript files, under Apache License 2.0
These files are exactly as they appear the upstream release 3.0.0 of
Bootstrap, which Twitter released under the Apache License 2.0. To extract
these files, I did the following:
I downloaded the following file:
https://github.com/twbs/bootstrap/archive/v3.0.0.zip
with sha256sum of:
$ sha256sum v3.0.0.zip
2d54f345f4abc6bf65ea648c323e9bae577e6febf755650e62555f2d7a222e17 v3.0.0.zip
And extracted from it these two files:
bootstrap-3.0.0/dist/css/bootstrap.css
bootstrap-3.0.0/dist/js/bootstrap.js
which are licensed under the Apache License 2.0.
and placed them into:
rhodecode/public/css/bootstrap.css
rhodecode/public/js/bootstrap.js
respectively.
These files are exactly as they appear the upstream release 3.0.0 of
Bootstrap, which Twitter released under the Apache License 2.0. To extract
these files, I did the following:
I downloaded the following file:
https://github.com/twbs/bootstrap/archive/v3.0.0.zip
with sha256sum of:
$ sha256sum v3.0.0.zip
2d54f345f4abc6bf65ea648c323e9bae577e6febf755650e62555f2d7a222e17 v3.0.0.zip
And extracted from it these two files:
bootstrap-3.0.0/dist/css/bootstrap.css
bootstrap-3.0.0/dist/js/bootstrap.js
which are licensed under the Apache License 2.0.
and placed them into:
rhodecode/public/css/bootstrap.css
rhodecode/public/js/bootstrap.js
respectively.
402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 402a96fcfa22 | """
Utilities for tests only. These are not or should not be used normally -
functions here are crafted as we don't want to use ``vcs`` to verify tests.
"""
import os
import re
import sys
from subprocess import Popen
class VCSTestError(Exception):
pass
def run_command(cmd, args):
"""
Runs command on the system with given ``args``.
"""
command = ' '.join((cmd, args))
p = Popen(command, shell=True)
status = os.waitpid(p.pid, 0)[1]
return status
def eprint(msg):
"""
Prints given ``msg`` into sys.stderr as nose test runner hides all output
from sys.stdout by default and if we want to pipe stream somewhere we don't
need those verbose messages anyway.
Appends line break.
"""
sys.stderr.write(msg)
sys.stderr.write('\n')
class SCMFetcher(object):
def __init__(self, alias, test_repo_path, remote_repo, clone_cmd):
"""
:param clone_cmd: command which would clone remote repository; pass
only first bits - remote path and destination would be appended
using ``remote_repo`` and ``test_repo_path``
"""
self.alias = alias
self.test_repo_path = test_repo_path
self.remote_repo = remote_repo
self.clone_cmd = clone_cmd
def setup(self):
if not os.path.isdir(self.test_repo_path):
self.fetch_repo()
def fetch_repo(self):
"""
Tries to fetch repository from remote path.
"""
remote = self.remote_repo
eprint("Fetching repository %s into %s" % (remote, self.test_repo_path))
run_command(self.clone_cmd, '%s %s' % (remote, self.test_repo_path))
def get_normalized_path(path):
"""
If given path exists, new path would be generated and returned. Otherwise
same whats given is returned. Assumes that there would be no more than
10000 same named files.
"""
if os.path.exists(path):
dir, basename = os.path.split(path)
splitted_name = basename.split('.')
if len(splitted_name) > 1:
ext = splitted_name[-1]
else:
ext = None
name = '.'.join(splitted_name[:-1])
matcher = re.compile(r'^.*-(\d{5})$')
start = 0
m = matcher.match(name)
if not m:
# Haven't append number yet so return first
newname = '%s-00000' % name
newpath = os.path.join(dir, newname)
if ext:
newpath = '.'.join((newpath, ext))
return get_normalized_path(newpath)
else:
start = int(m.group(1)[-5:]) + 1
for x in xrange(start, 10000):
newname = name[:-5] + str(x).rjust(5, '0')
newpath = os.path.join(dir, newname)
if ext:
newpath = '.'.join((newpath, ext))
if not os.path.exists(newpath):
return newpath
raise VCSTestError("Couldn't compute new path for %s" % path)
return path
|