cppcheck/tools/test/start_donate_cpu_server_test_local.sh
Sebastian ec521fba36
donate-cpu-server.py: Upgrade to work with Python 3 (drop Python 2 support) (#2292)
* donate-cpu-server.py: Use tools to prepare code to work with Python 3

The following commands were used for these changes:
futurize -1 -w donate-cpu-server.py
2to3 -w donate-cpu-server.py

* Make the server work under Python 3

Manually fixed the Unicode issues. Received data is decoded, sent data
is encoded.

* Add backward compatible type hints (in comments)

This enables better static analysis and suggestions in an IDE.

* Fix Pylint warning "Comparison to literal"

* .travis.yml: Fix/enhance pylint verification and Python compilation

donate-cpu-server.py is only Python 3 compatible, so it must be ignored
for pylint verification under Python 2.
All Python scripts that were verified with pylint under Python 2 are
now also verified with pylint under Python 3.

* donate-cpu-server.py: Add shebang and mark script as executable

* start_donate_cpu_server_test_local.sh: Directly execute server

Since the server script is executable now and has a shebang it can
be directly executed.

* Use Python 3.0 function annotations instead of comment type hints

Reference: https://www.python.org/dev/peps/pep-3107/
2019-10-26 21:10:21 +02:00

32 lines
832 B
Bash

#!/bin/sh
# Script for setting up everything that is needed and then running donate-cpu-server.py as
# a local server for testing.
# To start a real server instead of a local one simply remove the "--test" parameter.
# You can move this script to another location but then you have to set this path accordingly.
cppcheck_tools_path=..
# Paths that should not be changed:
dacaathome_path=~/daca@home
donatedresults_path=${dacaathome_path}/donated-results
if [ ! -d "${dacaathome_path}" ]
then
mkdir "${dacaathome_path}"
fi
if [ ! -d "${donatedresults_path}" ]
then
mkdir "${donatedresults_path}"
fi
if [ ! -f "${dacaathome_path}/packages.txt" ]
then
python "${cppcheck_tools_path}/daca2-getpackages.py" > "${dacaathome_path}/packages.txt"
fi
while :
do
"${cppcheck_tools_path}/donate-cpu-server.py" --test
done