Closed abma closed 4 years ago
side note: i've added a git tag to the current HEAD so "git describe" shows something useful
imo the gitpython depency is cleaner - the subprocess way relies (slightly) on the os/envir
happy either way though, thanks!
pip3 install gitpython vs apt install git (which is already required for installation: https://github.com/spring/uberserver#installation)
the gitpython relies on os/env as it must be manually installed, too :-)
side node: pip is known to have fake packages, so IMHO always try to avoid using pip and only trust the official packages provided by debian.
https://www.bleepingcomputer.com/news/security/ten-malicious-libraries-found-on-pypi-python-package-index/ https://github.com/dateutil/dateutil/issues/984
(the same for npm, etc...)
hehe:
https://gitpython.readthedocs.io/en/stable/intro.html#requirements Git 1.7.0 or newer
internally gitpython seems to use the git executable, too.
-> its much cleaner to use subprocess for fetching a string in comparison of using a full bloat python module
sure it will (perhaps not in all cases) use git, but it abstracts out the need for envir dependent code within uberserver
gitpython isn't a module which is in the default distribution of python, so its envir dependent code no matter what is used. please KISS, don't use an extra module for this.
i wonder if its possible to pip install gitpython onto the server
no, because of the reasons i wrote.
imho the easiest way without pulling in a new dependency:
version = subprocess.check_output(["git", "describe"], universal_newlines=True).strip()