from distutils.sysconfig import get_python_lib
from common import get_meson
+from common import git
SCRIPTDIR = os.path.dirname(os.path.realpath(__file__))
PREFIX_DIR = os.path.join(SCRIPTDIR, 'prefix')
env[var] = env[var].replace(os.pathsep + os.pathsep, os.pathsep).strip(os.pathsep)
-def get_subprocess_env(options):
+def get_subprocess_env(options, gst_version):
env = os.environ.copy()
env["CURRENT_GST"] = os.path.normpath(SCRIPTDIR)
prepend_env_var(env, "PATH", os.path.normpath(
"%s/subprojects/gst-devtools/validate/tools" % options.builddir))
prepend_env_var(env, "PATH", os.path.join(SCRIPTDIR, 'meson'))
- env["GST_VERSION"] = options.gst_version
- env["GST_ENV"] = 'gst-' + options.gst_version
+ env["GST_VERSION"] = gst_version
+ env["GST_ENV"] = 'gst-' + gst_version
env["GST_PLUGIN_SYSTEM_PATH"] = ""
env["GST_PLUGIN_SCANNER"] = os.path.normpath(
"%s/subprojects/gstreamer/libs/gst/helpers/gst-plugin-scanner" % options.builddir)
parser.add_argument("--srcdir",
default=SCRIPTDIR,
help="The top level source directory")
- parser.add_argument("--gst-version", default="master",
- help="The GStreamer major version")
options, args = parser.parse_known_args()
if not os.path.exists(options.builddir):
options.srcdir)
exit(1)
+ # The following incantation will retrieve the current branch name.
+ gst_version = git("rev-parse", "--symbolic-full-name", "--abbrev-ref", "HEAD", repository_path=options.srcdir)
+
if not args:
if os.name is 'nt':
args = [os.environ.get("COMSPEC", r"C:\WINDOWS\system32\cmd.exe")]
tmprc = tempfile.NamedTemporaryFile(mode='w')
with open(bashrc, 'r') as src:
shutil.copyfileobj(src, tmprc)
- tmprc.write('\nexport PS1="[gst-%s] $PS1"' % options.gst_version)
+ tmprc.write('\nexport PS1="[gst-%s] $PS1"' % gst_version)
tmprc.flush()
# Let the GC remove the tmp file
args.append("--rcfile")
args.append(tmprc.name)
try:
exit(subprocess.call(args, cwd=options.srcdir, close_fds=False,
- env=get_subprocess_env(options)))
+ env=get_subprocess_env(options, gst_version)))
except subprocess.CalledProcessError as e:
exit(e.returncode)