donate-cpu.py: Add shebang, warn when run under Python 2 (#2336)

Add shebang to run the client via Python 3 by default.
Add warning if Python 2 is used.
As discussed in the forum https://sourceforge.net/p/cppcheck/discussion/development/thread/86813a8a53/ switching to Python 3 has some benefits.
This commit is contained in:
Sebastian 2019-11-09 18:18:57 +01:00 committed by GitHub
parent 0fed6f0091
commit b93321e038
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 0 deletions

View File

@ -1,3 +1,5 @@
#!/usr/bin/env python3
# Donate CPU # Donate CPU
# #
# A script a user can run to donate CPU to cppcheck project # A script a user can run to donate CPU to cppcheck project
@ -95,6 +97,21 @@ for arg in sys.argv[1:]:
print('Unhandled argument: ' + arg) print('Unhandled argument: ' + arg)
sys.exit(1) sys.exit(1)
if sys.version_info.major < 3:
print("#" * 80)
print("#" * 80)
print("IMPORTANT")
print("Please consider switching to Python 3.")
print("")
print("We plan to completely drop Python 2 support")
print("for the Donate CPU client in the near future.")
print("")
print("For further information and reporting complaints, ideas, ... see:")
print("https://sourceforge.net/p/cppcheck/discussion/development/thread/86813a8a53/")
print("#" * 80)
print("#" * 80)
time.sleep(5)
print('Thank you!') print('Thank you!')
if not check_requirements(): if not check_requirements():
sys.exit(1) sys.exit(1)