-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scripts: Convert qemu-version.sh to qemu-version.py
The sh script are harder to maintain for compatible different xsh environment so convert it to python script Also incorporate the fixes in https://patchew.org/QEMU/[email protected]/ According to msys2/MSYS2-packages#2176 We need use CYGWIN=noglob and MSYS=noglob in the environment variable for disable wildcard expanding in msys or cygwin git, and setting the shell=False Signed-off-by: Yonggang Luo <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
- Loading branch information
Showing
3 changed files
with
38 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# | ||
# Script for retrieve qemu git version information | ||
# | ||
# Authors: | ||
# Yonggang Luo <[email protected]> | ||
# | ||
# This work is licensed under the terms of the GNU GPL, version 2.1 | ||
# or, at your option, any later version. See the COPYING file in | ||
# the top-level directory. | ||
|
||
import sys | ||
import subprocess | ||
import os | ||
import os.path | ||
|
||
def main(_program, dir, pkgversion, version, *unused): | ||
os.chdir(dir) | ||
if not pkgversion and os.path.exists('.git'): | ||
pc = subprocess.run( | ||
['git', 'describe', '--match', 'v*', '--dirty', '--always'], | ||
env=dict(os.environ, CYGWIN="noglob", MSYS='noglob'), | ||
stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, | ||
encoding='utf8', shell=False) | ||
if pc.returncode == 0: | ||
pkgversion = pc.stdout.strip() | ||
|
||
fullversion = version | ||
if pkgversion: | ||
fullversion = "{} ({})".format(version, pkgversion) | ||
|
||
print('#define QEMU_PKGVERSION "%s"' % pkgversion) | ||
print('#define QEMU_FULL_VERSION "%s"' % fullversion) | ||
|
||
if __name__ == "__main__": | ||
main(*sys.argv) |
This file was deleted.
Oops, something went wrong.