2
0

lint-python.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/bin/sh
  2. # check python style (and 2 to 3 migration)
  3. #
  4. # behold, the worst lowest effort shell script
  5. # ...given that we have more generic checking
  6. # for executables in other scripts already
  7. existence()
  8. {
  9. command -v "$1" >/dev/null 2>&1
  10. }
  11. # It is assumed that you are in 'lint'.
  12. LOGFILE="python-lint.log"
  13. # invoke from root of source!
  14. if [ $(basename $(pwd)) = "scripts" ]
  15. then
  16. return 1
  17. else
  18. if [ -e "${LOGFILE}" ]
  19. then
  20. rm ${LOGFILE}
  21. fi
  22. if existence python;
  23. then
  24. python --version >> ${LOGFILE}
  25. fi
  26. if existence python2;
  27. then
  28. python2 --version >> ${LOGFILE}
  29. fi
  30. if existence python3;
  31. then
  32. python3 --version >> ${LOGFILE}
  33. fi
  34. if existence python3.7;
  35. then
  36. python3.7 --version >> ${LOGFILE}
  37. fi
  38. if existence flake8;
  39. then
  40. echo >> ${LOGFILE}
  41. echo "flake8:" >> ${LOGFILE}
  42. echo >> ${LOGFILE}
  43. flake8 >> ${LOGFILE}
  44. fi
  45. if existence flake8-3.7;
  46. then
  47. echo >> ${LOGFILE}
  48. echo "flake8:" >> ${LOGFILE}
  49. echo >> ${LOGFILE}
  50. flake8-3.7 >> ${LOGFILE}
  51. fi
  52. if existence 2to3;
  53. then
  54. echo >> ${LOGFILE}
  55. echo "2to3" >> ${LOGFILE}
  56. echo >> ${LOGFILE}
  57. 2to3 -v -d . >> ${LOGFILE}
  58. 2to3 -v -p . >> ${LOGFILE}
  59. fi
  60. if existence 2to3-3.7;
  61. then
  62. echo >> ${LOGFILE}
  63. echo "2to3" >> ${LOGFILE}
  64. echo >> ${LOGFILE}
  65. 2to3-3.7 -v -d . >> ${LOGFILE}
  66. 2to3-3.7 -v -p . >> ${LOGFILE}
  67. fi
  68. fi