spring / uberserver

uberserver, a matchmaking/chat lobby server for the spring rts project
https://springrts.com/wiki/Uberserver
Other
33 stars 38 forks source link

show git hash in motd #361

Closed abma closed 4 years ago

abma commented 4 years ago

imho the easiest way without pulling in a new dependency:

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

abma commented 4 years ago

side note: i've added a git tag to the current HEAD so "git describe" shows something useful

silentwings commented 4 years ago

imo the gitpython depency is cleaner - the subprocess way relies (slightly) on the os/envir

happy either way though, thanks!

abma commented 4 years ago

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

abma commented 4 years ago

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.

abma commented 4 years ago

-> its much cleaner to use subprocess for fetching a string in comparison of using a full bloat python module

silentwings commented 4 years ago

sure it will (perhaps not in all cases) use git, but it abstracts out the need for envir dependent code within uberserver

abma commented 4 years ago

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.

abma commented 4 years ago

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

no, because of the reasons i wrote.