spring / uberserver

uberserver, a matchmaking/chat lobby server for the spring rts project

Home Page:https://springrts.com/wiki/Uberserver

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

show git hash in motd

abma opened this issue · comments

commented

imho the easiest way without pulling in a new dependency:

version = subprocess.check_output(["git", "describe"], universal_newlines=True).strip()

commented

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!

commented

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/
dateutil/dateutil#984

(the same for npm, etc...)

commented

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.

commented

-> 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

commented

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.

commented

i wonder if its possible to pip install gitpython onto the server

no, because of the reasons i wrote.