Update ffmpeg-mt (libav) submodule
[mplayer-build.git] / script / export
blob3774ae928ea7223cd6089b768f06dce0a6d165fd
1 #!/usr/bin/env python
3 import os
4 from helpers import run_command
5 from optparse import OptionParser
7 def write(local_path, path, revision, outdir):
8 if os.system("(cd %s && git archive --format=tar --prefix=%s/ %s | (cd %s && tar xf -))" % (local_path, path, revision, outdir)) != 0:
9 raise OSError
11 def subrev(revision, name):
12 return run_command(("git", "ls-tree", revision, name)).split()[2]
14 def export(revision, outdir, mt):
15 os.mkdir(outdir)
16 if mt:
17 ffmpeg = "ffmpeg-mt"
18 open(outdir + '/ffmpeg-mt-enabled', 'w').close()
19 else:
20 ffmpeg = "ffmpeg"
21 open(outdir + '/ffmpeg-mt-disabled', 'w').close()
22 if os.path.exists('ffmpeg-mt-enabled'):
23 local_ffmpeg = 'ffmpeg-mt'
24 else:
25 local_ffmpeg = 'ffmpeg'
26 mplayer_rev = subrev(revision, "mplayer")
27 libass_rev = subrev(revision, "libass")
28 ffmpeg_rev = subrev(revision, ffmpeg)
29 os.chdir('mplayer')
30 version = run_command('git describe --match v[0-9]* --always ' +
31 mplayer_rev).strip()
32 os.chdir('..')
33 write('.', '.', revision, outdir)
34 os.putenv('PYTHONDONTWRITEBYTECODE', '1')
35 os.system("cd %s && ./init --init-optionfiles-only" % outdir)
36 for name in 'clean disable-mt enable-mt init update'.split():
37 os.remove(outdir + '/' + name)
38 numeric_rev = run_command('git rev-parse ' + revision)
39 f = open(outdir + '/wrapper_export_version', 'w')
40 f.write(numeric_rev)
41 f.close()
42 write('mplayer', "mplayer", mplayer_rev, outdir)
43 f = open(outdir + '/mplayer/snapshot_version', 'w')
44 f.write(version)
45 f.close()
46 write('libass', "libass", libass_rev, outdir)
47 os.system("cd %s/libass && autoreconf -ivf" % outdir)
48 write(local_ffmpeg, ffmpeg, ffmpeg_rev, outdir)
51 def main():
52 usage = "usage: [options] revision outdir"
53 parser = OptionParser(usage=usage)
54 parser.add_option('--disable-mt', action='store_false', dest="mt",
55 help='use non-mt FFmpeg')
56 parser.set_defaults(mt=True)
57 options, args = parser.parse_args()
58 if len(args) != 2:
59 parser.error("incorrect number of arguments")
60 export(args[0], args[1], options.mt)
62 main()