msys2: Pass extra argument directly to uninstalled.py

This commit is contained in:
Thibault Saunier 2016-12-13 15:22:15 -03:00 committed by Thibault Saunier
parent 1c46eb2751
commit 0857e59dea

View file

@ -6,6 +6,7 @@ import itertools
import os import os
import re import re
import sys import sys
import shlex
import shutil import shutil
import subprocess import subprocess
import tempfile import tempfile
@ -97,7 +98,7 @@ class Msys2Configurer(GstBuildConfigurer):
'gst-devtools', 'gstreamer', 'gst-plugins-base', 'gst-devtools', 'gstreamer', 'gst-plugins-base',
'gst-editing-services']] 'gst-editing-services']]
def setup(self): def setup(self, args):
if not os.path.exists(self.options.msys2_path): if not os.path.exists(self.options.msys2_path):
print("msys2 not found in %s. Please make sure to install" print("msys2 not found in %s. Please make sure to install"
" (from http://msys2.github.io/) specify --msys2-path" " (from http://msys2.github.io/) specify --msys2-path"
@ -111,8 +112,7 @@ class Msys2Configurer(GstBuildConfigurer):
os.environ['PKG_CONFIG_PATH'] = os.environ.get( os.environ['PKG_CONFIG_PATH'] = os.environ.get(
'PKG_CONFIG_PATH', '') + ':/mingw64/lib/pkgconfig:/mingw64/share/pkgconfig' 'PKG_CONFIG_PATH', '') + ':/mingw64/lib/pkgconfig:/mingw64/share/pkgconfig'
subprocess.check_call( subprocess.check_call(['pacman', '-S', '--needed', '--noconfirm'] + self.DEPENDENCIES)
['pacman', '-S', '--needed'] + self.DEPENDENCIES, env=os.environ)
source_path = os.path.abspath(os.path.curdir) source_path = os.path.abspath(os.path.curdir)
print('Making sure meson is present in root folder... ', end='') print('Making sure meson is present in root folder... ', end='')
@ -131,11 +131,15 @@ class Msys2Configurer(GstBuildConfigurer):
if not self.configure_meson(): if not self.configure_meson():
return False return False
print("Getting into msys2 environment")
try: try:
subprocess.call([sys.executable, if not args:
os.path.join(source_path, 'gst-uninstalled.py'), print("Getting into msys2 environment", flush=True)
'--builddir', os.path.join(source_path, 'build')]) subprocess.check_call([sys.executable,
os.path.join(source_path, 'gst-uninstalled.py'),
'--builddir', os.path.join(source_path, 'build')])
else:
print("Running %s" ' '.join(args), flush=True)
res = subprocess.check_call(args)
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
return False return False
@ -158,6 +162,10 @@ if __name__ == "__main__":
help="Where to find msys2 root directory." help="Where to find msys2 root directory."
"(deactivates msys if unset)", "(deactivates msys if unset)",
default="C:\msys64") default="C:\msys64")
parser.add_argument("-c", "--command", dest="command",
help="Command to run instead of entering environment.",
default="")
options, args = parser.parse_known_args() options, args = parser.parse_known_args()
if not shutil.which('cl'): if not shutil.which('cl'):
@ -168,5 +176,4 @@ if __name__ == "__main__":
configurer = Msys2Configurer(options, args) configurer = Msys2Configurer(options, args)
exit(not configurer.setup()) exit(not configurer.setup(shlex.split(options.command)))