commit
5bf04936d9
|
@ -15,7 +15,8 @@ from utils import (
|
|||
remove_duplicates,
|
||||
add_execution_right,
|
||||
get_sha256,
|
||||
print_status,
|
||||
print_progress,
|
||||
setup_print_progress,
|
||||
StopBuild,
|
||||
SkipCommand,
|
||||
Defaultdict,
|
||||
|
@ -453,9 +454,9 @@ class BuildEnv:
|
|||
break
|
||||
if tsize:
|
||||
current += batch_size
|
||||
print_status("{:.2%}".format(current/tsize))
|
||||
print_progress("{:.2%}".format(current/tsize))
|
||||
else:
|
||||
print_status(progress_chars[current])
|
||||
print_progress(progress_chars[current])
|
||||
current = (current+1)%4
|
||||
file.write(batch)
|
||||
|
||||
|
@ -924,6 +925,8 @@ def parse_args():
|
|||
parser.add_argument('--verbose', '-v', action="store_true",
|
||||
help=("Print all logs on stdout instead of in specific"
|
||||
" log files per commands"))
|
||||
parser.add_argument('--hide-progress', action='store_false', dest='show_progress',
|
||||
help="Hide intermediate progress information.")
|
||||
parser.add_argument('--no-cert-check', action='store_true',
|
||||
help="Skip SSL certificate verification during download")
|
||||
parser.add_argument('--skip-source-prepare', action='store_true',
|
||||
|
@ -952,5 +955,6 @@ def parse_args():
|
|||
if __name__ == "__main__":
|
||||
options = parse_args()
|
||||
options.working_dir = os.path.abspath(options.working_dir)
|
||||
setup_print_progress(options.show_progress)
|
||||
builder = Builder(options)
|
||||
builder.run()
|
||||
|
|
|
@ -25,6 +25,7 @@ then
|
|||
${TRAVIS_BUILD_DIR}/kiwix-build.py \
|
||||
--target-platform $PLATFORM \
|
||||
--build-deps-only \
|
||||
--hide-progress \
|
||||
${TARGET}
|
||||
rm ${BASE_DIR}/.install_packages_ok
|
||||
|
||||
|
@ -49,7 +50,7 @@ EOF
|
|||
scp -i ${SSH_KEY} ${ARCHIVE_NAME} nightlybot@download.kiwix.org:/var/www/tmp.kiwix.org/ci/
|
||||
)
|
||||
|
||||
${TRAVIS_BUILD_DIR}/kiwix-build.py --target-platform $PLATFORM ${TARGET}
|
||||
${TRAVIS_BUILD_DIR}/kiwix-build.py --hide-progress --target-platform $PLATFORM ${TARGET}
|
||||
rm ${BASE_DIR}/.install_packages_ok
|
||||
done
|
||||
|
||||
|
@ -96,5 +97,6 @@ else
|
|||
fi
|
||||
${TRAVIS_BUILD_DIR}/kiwix-build.py \
|
||||
--target-platform $PLATFORM \
|
||||
--hide-progress \
|
||||
${TARGET}
|
||||
fi
|
||||
|
|
18
utils.py
18
utils.py
|
@ -8,6 +8,13 @@ from collections import namedtuple, defaultdict
|
|||
|
||||
pj = os.path.join
|
||||
|
||||
g_print_progress = True
|
||||
|
||||
|
||||
def setup_print_progress(print_progress):
|
||||
global g_print_progress
|
||||
g_print_progress = print_progress
|
||||
|
||||
|
||||
class Defaultdict(defaultdict):
|
||||
def __getattr__(self, name):
|
||||
|
@ -37,13 +44,16 @@ def get_sha256(path):
|
|||
if not batch:
|
||||
break
|
||||
sha256.update(batch)
|
||||
print_status(progress_chars[current])
|
||||
print_progress(progress_chars[current])
|
||||
current = (current+1)%4
|
||||
return sha256.hexdigest()
|
||||
|
||||
def print_status(status):
|
||||
text = "{}\033[{}D".format(status, len(status))
|
||||
print(text, end="")
|
||||
|
||||
def print_progress(progress):
|
||||
if g_print_progress:
|
||||
text = "{}\033[{}D".format(progress, len(progress))
|
||||
print(text, end="")
|
||||
|
||||
|
||||
def add_execution_right(file_path):
|
||||
current_permissions = stat.S_IMODE(os.lstat(file_path).st_mode)
|
||||
|
|
Loading…
Reference in New Issue